File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 18
18
*/
19
19
#ifndef MBED_DEBUG_H
20
20
#define MBED_DEBUG_H
21
- #include "device.h"
21
+ #if DEVICE_STDIO_MESSAGES
22
+ #include <stdio.h>
23
+ #include <stdarg.h>
24
+ #endif
22
25
23
26
#ifdef __cplusplus
24
27
extern "C" {
25
28
#endif
26
29
27
- #if DEVICE_STDIO_MESSAGES
28
- #include <stdio.h>
29
- #include <stdarg.h>
30
30
31
31
/** Output a debug message
32
32
*
33
33
* @param format printf-style format string, followed by variables
34
34
*/
35
35
static inline void debug (const char * format , ...) {
36
+ #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG )
36
37
va_list args ;
37
38
va_start (args , format );
38
39
vfprintf (stderr , format , args );
39
40
va_end (args );
41
+ #endif
40
42
}
41
43
44
+
42
45
/** Conditionally output a debug message
43
46
*
44
- * NOTE: If the condition is constant false (!= 1 ) and the compiler optimization
47
+ * NOTE: If the condition is constant false (== 0 ) and the compiler optimization
45
48
* level is greater than 0, then the whole function will be compiled away.
46
49
*
47
- * @param condition output only if condition is true (== 1 )
50
+ * @param condition output only if condition is true (!= 0 )
48
51
* @param format printf-style format string, followed by variables
49
52
*/
50
53
static inline void debug_if (int condition , const char * format , ...) {
51
- if (condition == 1 ) {
54
+ #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG )
55
+ if (condition ) {
52
56
va_list args ;
53
57
va_start (args , format );
54
58
vfprintf (stderr , format , args );
55
59
va_end (args );
56
60
}
61
+ #endif
57
62
}
58
63
59
- #else
60
- static inline void debug (const char * format , ...) {}
61
- static inline void debug_if (int condition , const char * format , ...) {}
62
-
63
- #endif
64
64
65
65
#ifdef __cplusplus
66
66
}
Original file line number Diff line number Diff line change 33
33
*---------------------------------------------------------------------------*/
34
34
35
35
#include "cmsis_os.h"
36
+ #include "mbed_error.h"
36
37
37
38
38
39
/*----------------------------------------------------------------------------
@@ -244,7 +245,6 @@ void os_idle_demon (void) {
244
245
/*----------------------------------------------------------------------------
245
246
* RTX Errors
246
247
*---------------------------------------------------------------------------*/
247
- extern void error (const char * format , ...);
248
248
extern osThreadId svcThreadGetId (void );
249
249
250
250
void os_error (uint32_t err_code ) {
You can’t perform that action at this time.
0 commit comments