Skip to content

Commit c24fed1

Browse files
Merge pull request #5032 from 0xc0170/fix_mts_debug
mts targets: fix debug() usage
2 parents 908a05b + 52f8481 commit c24fed1

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/system_clock.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
**/
3636

3737
#include "stm32f4xx.h"
38+
#include "mbed_debug.h"
3839

3940
/*!< Uncomment the following line if you need to relocate your vector Table in
4041
Internal SRAM. */
@@ -240,8 +241,6 @@ uint8_t SetSysClock_PLL_HSI(void)
240241
/******************************************************************************/
241242
void HardFault_Handler(void)
242243
{
243-
#if !defined(NDEBUG) || NDEBUG == 0
244-
printf("Hard Fault\n");
245-
#endif
244+
debug("Hard Fault\n");
246245
NVIC_SystemReset();
247246
}

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/device/system_clock.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
**/
3636

3737
#include "stm32f4xx.h"
38-
38+
#include "mbed_debug.h"
3939

4040
/*!< Uncomment the following line if you need to relocate your vector Table in
4141
Internal SRAM. */
@@ -243,8 +243,6 @@ uint8_t SetSysClock_PLL_HSI(void)
243243
/******************************************************************************/
244244
void HardFault_Handler(void)
245245
{
246-
#if !defined(NDEBUG) || NDEBUG == 0
247-
printf("Hard Fault\n");
248-
#endif
246+
debug("Hard Fault\n");
249247
NVIC_SystemReset();
250248
}

targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/device/system_clock.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
#include "stm32l1xx.h"
3939
#include "stdio.h"
40+
#include "mbed_debug.h"
4041

4142
/*!< Uncomment the following line if you need to relocate your vector Table in
4243
Internal SRAM. */
@@ -253,9 +254,7 @@ uint8_t SetSysClock_PLL_HSI(void)
253254
/******************************************************************************/
254255
void HardFault_Handler(void)
255256
{
256-
#if !defined(NDEBUG) || NDEBUG == 0
257-
printf("Hard Fault\n");
258-
#endif
257+
debug("Hard Fault\n");
259258
NVIC_SystemReset();
260259
}
261260

targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/xdot_low_power.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@
3030

3131
#include "xdot_low_power.h"
3232
#include "stdio.h"
33-
34-
#if defined(NDEBUG) && NDEBUG == 1
35-
#define xdot_lp_debug(...) do {} while(0)
36-
#else
37-
#define xdot_lp_debug(...) printf(__VA_ARGS__)
38-
#endif
33+
#include "mbed_debug.h"
3934

4035
static uint32_t portA[6];
4136
static uint32_t portB[6];
@@ -236,7 +231,7 @@ void xdot_enter_stop_mode() {
236231
HSERCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
237232
HSERCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV3;
238233
if (HAL_RCC_OscConfig(&HSERCC_OscInitStruct) != HAL_OK) {
239-
xdot_lp_debug("OSC initialization failed - initiating soft reset\r\n");
234+
debug("OSC initialization failed - initiating soft reset\r\n");
240235
NVIC_SystemReset();
241236
}
242237

@@ -247,7 +242,7 @@ void xdot_enter_stop_mode() {
247242
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; // 32 MHz
248243
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 32 MHz
249244
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
250-
xdot_lp_debug("PLL initialization failed - initiating soft reset\r\n");
245+
debug("PLL initialization failed - initiating soft reset\r\n");
251246
NVIC_SystemReset();
252247
}
253248

@@ -260,7 +255,7 @@ void xdot_enter_stop_mode() {
260255
HSIRCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
261256
HAL_StatusTypeDef ret = HAL_RCC_OscConfig(&HSIRCC_OscInitStruct);
262257
if ( ret != HAL_OK ) {
263-
xdot_lp_debug("HSI initialization failed - ADC will not function properly\r\n");
258+
debug("HSI initialization failed - ADC will not function properly\r\n");
264259
}
265260
}
266261

0 commit comments

Comments
 (0)