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 1818 */ 
1919#ifndef  MBED_DEBUG_H 
2020#define  MBED_DEBUG_H 
21- #include  "device.h" 
21+ #if  DEVICE_STDIO_MESSAGES 
22+ #include  <stdio.h> 
23+ #include  <stdarg.h> 
24+ #endif 
2225
2326#ifdef  __cplusplus 
2427extern  "C"  {
2528#endif 
2629
27- #if  DEVICE_STDIO_MESSAGES 
28- #include  <stdio.h> 
29- #include  <stdarg.h> 
3030
3131/** Output a debug message 
3232 * 
3333 * @param format printf-style format string, followed by variables 
3434 */ 
3535static  inline  void  debug (const  char  * format , ...) {
36+ #if  DEVICE_STDIO_MESSAGES  &&  !defined(NDEBUG )
3637    va_list  args ;
3738    va_start (args , format );
3839    vfprintf (stderr , format , args );
3940    va_end (args );
41+ #endif 
4042}
4143
44+ 
4245/** Conditionally output a debug message 
4346 * 
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 
4548 * level is greater than 0, then the whole function will be compiled away. 
4649 * 
47-  * @param condition output only if condition is true (== 1 ) 
50+  * @param condition output only if condition is true (!= 0 ) 
4851 * @param format printf-style format string, followed by variables 
4952 */ 
5053static  inline  void  debug_if (int  condition , const  char  * format , ...) {
51-     if  (condition  ==  1 ) {
54+ #if  DEVICE_STDIO_MESSAGES  &&  !defined(NDEBUG )
55+     if  (condition ) {
5256        va_list  args ;
5357        va_start (args , format );
5458        vfprintf (stderr , format , args );
5559        va_end (args );
5660    }
61+ #endif 
5762}
5863
59- #else 
60- static  inline  void  debug (const  char  * format , ...) {}
61- static  inline  void  debug_if (int  condition , const  char  * format , ...) {}
62- 
63- #endif 
6464
6565#ifdef  __cplusplus 
6666}
Original file line number Diff line number Diff line change 3333 *---------------------------------------------------------------------------*/ 
3434
3535#include  "cmsis_os.h" 
36+ #include  "mbed_error.h" 
3637
3738
3839/*---------------------------------------------------------------------------- 
@@ -244,7 +245,6 @@ void os_idle_demon (void) {
244245/*---------------------------------------------------------------------------- 
245246 *      RTX Errors 
246247 *---------------------------------------------------------------------------*/ 
247- extern  void  error (const  char *  format , ...);
248248extern  osThreadId  svcThreadGetId  (void );
249249
250250void  os_error  (uint32_t  err_code ) {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments