feat(freertos): Add "noreturn" to save IRAM

Put some functions to flash.
This commit is contained in:
Dong Heng
2018-10-25 17:08:32 +08:00
parent d28329d713
commit f730498b89
3 changed files with 9 additions and 8 deletions

View File

@ -131,7 +131,7 @@ static void panic_stack(StackType_t *start_stk, StackType_t *end_stk)
* *
* @return none * @return none
*/ */
static void panic_info(void *frame, int wdt) static __attribute__((noreturn)) void panic_info(void *frame, int wdt)
{ {
extern int _chip_nmi_cnt; extern int _chip_nmi_cnt;
@ -210,7 +210,7 @@ static void panic_info(void *frame, int wdt)
while (1); while (1);
} }
void IRAM_ATTR panicHandler(void *frame, int wdt) void __attribute__((noreturn)) panicHandler(void *frame, int wdt)
{ {
int cnt = 10; int cnt = 10;
@ -220,13 +220,10 @@ void IRAM_ATTR panicHandler(void *frame, int wdt)
REG_WRITE(INT_ENA_WDEV, 0); REG_WRITE(INT_ENA_WDEV, 0);
} }
// for panic the function that disable cache
Cache_Read_Enable_New();
panic_info(frame, wdt); panic_info(frame, wdt);
} }
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) void __attribute__((noreturn)) _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
{ {
printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x at %p\n", rc, __builtin_return_address(0)); printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x at %p\n", rc, __builtin_return_address(0));
printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression); printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression);

View File

@ -315,7 +315,7 @@ int xPortInIsrContext(void)
return _xt_isr_status != 0; return _xt_isr_status != 0;
} }
void __attribute__((weak)) vApplicationStackOverflowHook(xTaskHandle xTask, const char *pcTaskName) void __attribute__((weak, noreturn)) vApplicationStackOverflowHook(xTaskHandle xTask, const char *pcTaskName)
{ {
int *p = NULL; int *p = NULL;

View File

@ -1421,6 +1421,7 @@ nmi_rfi:
#endif #endif
#endif /* NMI */ #endif /* NMI */
.global Cache_Read_Enable_New
.global _xt_ext_panic .global _xt_ext_panic
.type _xt_ext_panic, @function .type _xt_ext_panic, @function
.align 4 .align 4
@ -1477,7 +1478,10 @@ _panic_dump_reg:
s32i a0, sp, XT_STK_A0 s32i a0, sp, XT_STK_A0
call0 Cache_Read_Enable_New
//Call panic handler //Call panic handler
mov a2, sp mov a2, sp
movi a3, 0 movi a3, 0
call0 panicHandler movi a0, panicHandler
callx0 a0