テスト用のあれこれ共用フォルダ
修訂 | ae5fc44842bef96d0a3d650a1cc12df7f7aaec4d (tree) |
---|---|
時間 | 2018-04-21 23:56:14 |
作者 | takemasa <suikan@user...> |
Commiter | takemasa |
Default Exception Handler is successfuly overwriten.
Confirmed, the exception triggeres the Post motem process and the buffer
contents are flushed. DMA stop timming have to be adjusted.
@@ -18,6 +18,8 @@ void InitTestUart(UART_HandleTypeDef * uart_handle); | ||
18 | 18 | void DoTestUart(void); |
19 | 19 | // For the STM32 HAL assertion_failed(); |
20 | 20 | void CustomAssertFailed(uint8_t* file, uint32_t line); |
21 | +// For exception handling | |
22 | +void CustomDefaultHandler(); | |
21 | 23 | #ifdef __cplusplus |
22 | 24 | } |
23 | 25 | #endif |
@@ -42,10 +42,19 @@ void InitTestUart(UART_HandleTypeDef * uart_handle) | ||
42 | 42 | // String output test. |
43 | 43 | void DoTestUart(void) |
44 | 44 | { |
45 | + | |
46 | + typedef void (* func_ptr)(); | |
47 | + | |
48 | + func_ptr const func = reinterpret_cast<func_ptr>(1); | |
49 | + | |
45 | 50 | // MURASAKI_ASSERT(counter % 2 == 0, "Odd counter"); |
46 | 51 | // by murasaki debugging output. You can use this in both task and interrupt context. |
47 | 52 | // non blocking |
48 | - murasaki::debugger->Printf(MSG); | |
53 | + murasaki::debugger->Printf("Count down 3 \r\n"); | |
54 | + murasaki::debugger->Printf("Count down 2 \r\n"); | |
55 | + murasaki::debugger->Printf("Count down 1 \r\n"); | |
56 | + | |
57 | + func(); | |
49 | 58 | |
50 | 59 | } |
51 | 60 |
@@ -80,3 +89,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef * huart) | ||
80 | 89 | } |
81 | 90 | |
82 | 91 | |
92 | +void CustomDefaultHandler() | |
93 | +{ | |
94 | + murasaki::debugger->DoPostMotem(); | |
95 | +} |
@@ -124,9 +124,11 @@ LoopForever: | ||
124 | 124 | * @retval : None |
125 | 125 | */ |
126 | 126 | .section .text.Default_Handler,"ax",%progbits |
127 | + .global CustomDefaultHandler | |
127 | 128 | Default_Handler: |
128 | 129 | Infinite_Loop: |
129 | - b Infinite_Loop | |
130 | + b CustomDefaultHandler | |
131 | +// b Infinite_Loop | |
130 | 132 | .size Default_Handler, .-Default_Handler |
131 | 133 | /****************************************************************************** |
132 | 134 | * |