Skip to content

Commit 156d9d9

Browse files
committed
Rename debug to core_debug to avoid issue
Several libraries provides debug.h or debug function __DEBUG define has been renamed CORE_DEBUG Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 41f92b2 commit 156d9d9

File tree

6 files changed

+25
-24
lines changed

6 files changed

+25
-24
lines changed
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#ifndef _DEBUG_H
2-
#ifdef __DEBUG
1+
#ifndef _CORE_DEBUG_H
2+
#define _CORE_DEBUG_H
3+
#ifdef CORE_DEBUG
34
#include <stdio.h>
45
#include <stdarg.h>
5-
#endif /* __DEBUG */
6+
#endif /* CORE_DEBUG */
67

78
#ifdef __cplusplus
89
extern "C" {
@@ -15,19 +16,19 @@ extern "C" {
1516
* the code, use a lot of stack. An alternative, will be to implement a tiny
1617
* and limited functionality implementation of printf.
1718
*/
18-
static inline void debug(const char *format, ...) {
19-
#ifdef __DEBUG
19+
static inline void core_debug(const char *format, ...) {
20+
#ifdef CORE_DEBUG
2021
va_list args;
2122
va_start(args, format);
2223
vfprintf(stderr, format, args);
2324
va_end(args);
2425
#else
2526
(void)(format);
26-
#endif /* __DEBUG */
27+
#endif /* CORE_DEBUG */
2728
}
2829

2930
#ifdef __cplusplus
3031
}
3132
#endif
3233

33-
#endif /* _DEBUG_H */
34+
#endif /* _CORE_DEBUG_H */

cores/arduino/stm32/spi_com.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/** @addtogroup STM32F4xx_System_Private_Includes
4747
* @{
4848
*/
49-
#include "debug.h"
49+
#include "core_debug.h"
5050
#include "stm32_def.h"
5151
#include "spi_com.h"
5252
#include "PinAF_STM32F1.h"
@@ -150,7 +150,7 @@ uint32_t spi_getClkFreqInst(SPI_TypeDef * spi_inst)
150150
break;
151151
#endif
152152
default:
153-
debug("CLK: SPI instance not set");
153+
core_debug("CLK: SPI instance not set");
154154
break;
155155
}
156156
}
@@ -204,7 +204,7 @@ void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb)
204204

205205
/* Pins MOSI/MISO/SCLK must not be NP. ssel can be NP. */
206206
if(spi_mosi == NP || spi_miso == NP || spi_sclk == NP) {
207-
debug("ERROR: at least one SPI pin has no peripheral\n");
207+
core_debug("ERROR: at least one SPI pin has no peripheral\n");
208208
return;
209209
}
210210

@@ -215,7 +215,7 @@ void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb)
215215

216216
// Are all pins connected to the same SPI instance?
217217
if(obj->spi == NP) {
218-
debug("ERROR: SPI pins mismatch\n");
218+
core_debug("ERROR: SPI pins mismatch\n");
219219
return;
220220
}
221221

cores/arduino/stm32/stm32_def.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "stm32_def.h"
2-
#include "debug.h"
2+
#include "core_debug.h"
33

44
#ifdef __cplusplus
55
extern "C" {
@@ -12,7 +12,7 @@ extern "C" {
1212
*/
1313
WEAK void _Error_Handler(const char * msg, int val) {
1414
/* User can add his own implementation to report the HAL error return state */
15-
debug("Error: %s (%i)\n", msg, val);
15+
core_debug("Error: %s (%i)\n", msg, val);
1616
while(1) {
1717
}
1818
}

cores/arduino/stm32/timer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/** @addtogroup STM32F4xx_System_Private_Includes
4747
* @{
4848
*/
49-
#include "debug.h"
49+
#include "core_debug.h"
5050
#include "timer.h"
5151
#include "board.h"
5252

@@ -545,7 +545,7 @@ uint32_t getTimerIrq(TIM_TypeDef* tim)
545545
#endif
546546
break;
547547
default:
548-
debug("TIM: Unknown timer IRQn");
548+
core_debug("TIM: Unknown timer IRQn");
549549
break;
550550
}
551551
}
@@ -653,7 +653,7 @@ uint8_t getTimerClkSrc(TIM_TypeDef* tim)
653653
clkSrc = 2;
654654
break;
655655
default:
656-
debug("TIM: Unknown timer instance");
656+
core_debug("TIM: Unknown timer instance");
657657
break;
658658
}
659659
}
@@ -687,7 +687,7 @@ uint32_t getTimerClkFreq(TIM_TypeDef* tim)
687687
#endif
688688
default:
689689
case 0:
690-
debug("TIM: Unknown clock source");
690+
core_debug("TIM: Unknown clock source");
691691
break;
692692
}
693693
/* When TIMPRE bit of the RCC_DCKCFGR register is reset,

cores/arduino/stm32/twi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
/** @addtogroup STM32F4xx_System_Private_Includes
4848
* @{
4949
*/
50-
#include "debug.h"
50+
#include "core_debug.h"
5151
#include "stm32_def.h"
5252
#include "twi.h"
5353
#include "PinAF_STM32F1.h"
@@ -167,14 +167,14 @@ void i2c_custom_init(i2c_t *obj, i2c_timing_e timing, uint32_t addressingMode, u
167167

168168
//Pins SDA/SCL must not be NP
169169
if(i2c_sda == NP || i2c_scl == NP) {
170-
debug("ERROR: at least one I2C pin has no peripheral\n");
170+
core_debug("ERROR: at least one I2C pin has no peripheral\n");
171171
return;
172172
}
173173

174174
obj->i2c = pinmap_merge_peripheral(i2c_sda, i2c_scl);
175175

176176
if(obj->i2c == NP) {
177-
debug("ERROR: I2C pins mismatch\n");
177+
core_debug("ERROR: I2C pins mismatch\n");
178178
return;
179179
}
180180

@@ -597,7 +597,7 @@ void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c)
597597
if(obj->slaveRxNbData < I2C_TXRX_BUFFER_SIZE) {
598598
obj->slaveRxNbData++;
599599
} else {
600-
debug("ERROR: I2C Slave RX overflow\n");
600+
core_debug("ERROR: I2C Slave RX overflow\n");
601601
}
602602
/* Restart interrupt mode for next Byte */
603603
if(obj->slaveMode == SLAVE_MODE_RECEIVE) {

cores/arduino/stm32/uart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*
3434
******************************************************************************
3535
*/
36-
#include "debug.h"
36+
#include "core_debug.h"
3737
#include "uart.h"
3838
#include "Arduino.h"
3939
#include "PinAF_STM32F1.h"
@@ -102,7 +102,7 @@ void uart_init(serial_t *obj)
102102

103103
/* Pins Rx/Tx must not be NP */
104104
if(uart_rx == NP || uart_tx == NP) {
105-
debug("ERROR: at least one UART pin has no peripheral\n");
105+
core_debug("ERROR: at least one UART pin has no peripheral\n");
106106
return;
107107
}
108108

@@ -113,7 +113,7 @@ void uart_init(serial_t *obj)
113113
obj->uart = pinmap_merge_peripheral(uart_tx, uart_rx);
114114

115115
if(obj->uart == NP) {
116-
debug("ERROR: U(S)ART pins mismatch\n");
116+
core_debug("ERROR: U(S)ART pins mismatch\n");
117117
return;
118118
}
119119

0 commit comments

Comments
 (0)