shared_fooの不要ディレクトリ削除前のもの
修訂 | 119ff6ae1b867d75806aea8ebb65576de3f3cf0e (tree) |
---|---|
時間 | 2018-02-17 16:18:43 |
作者 | takemasa <suikan@user...> |
Commiter | takemasa |
Modified MURASAKI_ASSERT to stop at the assertion failure.
@@ -74,6 +74,7 @@ void DoTestUart(void) | ||
74 | 74 | // by murasaki debugging output. You can use this in both task and interrupt context. |
75 | 75 | // non blocking |
76 | 76 | murasaki::debugger->printf(MSG, counter); |
77 | + MURASAKI_ASSERT(10 > counter); | |
77 | 78 | #else |
78 | 79 | // by murasaki peripheral encapsulating class. You can use this only in the task conetxt. |
79 | 80 | // blocking |
@@ -13,7 +13,7 @@ | ||
13 | 13 | #include "murasaki_defs.hpp" |
14 | 14 | #include "debug.hpp" |
15 | 15 | |
16 | -#define MURASAKI_ASSERT_MSG "Assertion in function %s(), at line %d of file %s : %s \n\r" | |
16 | +#define MURASAKI_ASSERT_MSG "!! Assertion failure in function %s(), at line %d of file %s !!\n\r" | |
17 | 17 | /** |
18 | 18 | * \def MURASAKI_ASSERT |
19 | 19 | * \param COND Condition as bool type. |
@@ -21,6 +21,8 @@ | ||
21 | 21 | * \details |
22 | 22 | * Print the COND expression to the logging port if COND is false. Do nothing if CODN is true. |
23 | 23 | * |
24 | + * After printing the assertion failure message, currently running task is suspended. | |
25 | + * If it is the interrupt context, just continue the processing. | |
24 | 26 | * |
25 | 27 | * This assertion do nothing if programmer defines \ref MURASAKI_CONFIG_NODEBUG macro as true. |
26 | 28 | * This macro is defined in the file \ref platform_config.hpp. |
@@ -32,7 +34,13 @@ | ||
32 | 34 | #else |
33 | 35 | #define MURASAKI_ASSERT( COND )\ |
34 | 36 | if ( ! (COND) )\ |
35 | - murasaki::debugger->printf(MURASAKI_ASSERT_MSG, __func__, __LINE__,__FILE__, #COND); | |
37 | + {\ | |
38 | + murasaki::debugger->printf("--------------------\n\r");\ | |
39 | + murasaki::debugger->printf(MURASAKI_ASSERT_MSG, __func__, __LINE__,__FILE__ );\ | |
40 | + murasaki::debugger->printf("Fail expression : %s\r\n", #COND);\ | |
41 | + if ( murasaki::isTaskContext() )\ | |
42 | + vTaskSuspend(NULL);\ | |
43 | + } | |
36 | 44 | #endif |
37 | 45 | |
38 | 46 | namespace murasaki { |