diff options
Diffstat (limited to 'tinyusb/common')
| -rw-r--r-- | tinyusb/common/assertion.h | 10 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 6 | ||||
| -rw-r--r-- | tinyusb/common/errors.h | 1 |
3 files changed, 9 insertions, 8 deletions
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index 4082f4b59..6ac46086c 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -57,6 +57,7 @@ extern "C" #endif #include "tusb_option.h" +#include "hal/hal.h" //--------------------------------------------------------------------+ // Compile-time Assert @@ -92,7 +93,8 @@ extern "C" #endif #ifndef _TEST_ASSERT_ - #define ASSERT_ERROR_HANDLER(x, para) return (x) + #define ASSERT_ERROR_HANDLER(x, para) \ + return (x) #else #define ASSERT_ERROR_HANDLER(x, para) Throw(x) #endif @@ -101,7 +103,11 @@ extern "C" do{\ setup_statement;\ if (!(condition)) {\ - ASSERT_MESSAGE(format, __VA_ARGS__);\ + if (hal_debugger_is_attached()){\ + hal_debugger_breakpoint();\ + }else{\ + ASSERT_MESSAGE(format, __VA_ARGS__);\ + }\ error_handler(error, handler_para);\ }\ }while(0) diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index a433fef06..323ff8ee8 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -83,12 +83,6 @@ //--------------------------------------------------------------------+ // MACROS //--------------------------------------------------------------------+ -#ifndef _TEST_ - #define ASM_BREAKPOINT __asm("BKPT #0\n") // Place breakpoint to stop the debugger at desire -#else - #define ASM_BREAKPOINT -#endif - #define STRING_(x) #x // stringify without expand #define XSTRING_(x) STRING_(x) // expand then stringify #define STRING_CONCAT_(a, b) a##b // concat without expand diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h index 81bb5cce6..826e8dd44 100644 --- a/tinyusb/common/errors.h +++ b/tinyusb/common/errors.h @@ -49,6 +49,7 @@ #ifndef _TUSB_ERRORS_H_ #define _TUSB_ERRORS_H_ +#include "primitive_types.h" #include "tusb_option.h" #ifdef __cplusplus |
