Merge branch 'refactor/hal_function_set_exception_vector_table' into 'master'

soc: add hal api to set exception vector table base address

See merge request espressif/esp-idf!7905
This commit is contained in:
Angus Gratton 2020-03-11 14:44:42 +08:00
commit 59381b60c0
6 changed files with 29 additions and 12 deletions

View File

@ -130,10 +130,8 @@ void IRAM_ATTR call_start_cpu0(void)
bootloader_init_mem();
//Move exception vectors to IRAM
asm volatile (\
"wsr %0, vecbase\n" \
::"r"(&_init_start));
// Move exception vectors to IRAM
cpu_hal_set_vecbase(&_init_start);
rst_reas[0] = rtc_get_reset_reason(0);
@ -273,9 +271,8 @@ static void wdt_reset_cpu1_info_enable(void)
void IRAM_ATTR call_start_cpu1(void)
{
asm volatile (\
"wsr %0, vecbase\n" \
::"r"(&_init_start));
// Move exception vectors to IRAM
cpu_hal_set_vecbase(&_init_start);
ets_set_appcpu_boot_addr(0);

View File

@ -114,10 +114,8 @@ void IRAM_ATTR call_start_cpu0(void)
bootloader_init_mem();
//Move exception vectors to IRAM
asm volatile (\
"wsr %0, vecbase\n" \
::"r"(&_init_start));
// Move exception vectors to IRAM
cpu_hal_set_vecbase(&_init_start);
rst_reas = rtc_get_reset_reason(0);

View File

@ -109,6 +109,13 @@ void cpu_hal_clear_watchpoint(int id);
#endif // SOC_CPU_WATCHPOINTS_NUM > 0
/**
* Set exception vector table base address.
*
* @param base address to move the exception vector table to
*/
void cpu_hal_set_vecbase(const void* base);
#ifdef __cplusplus
}
#endif

View File

@ -166,6 +166,11 @@ static inline void cpu_ll_break(void)
__asm__ ("break 0,0");
}
static inline void cpu_ll_set_vecbase(const void* vecbase)
{
asm volatile ("wsr %0, vecbase" :: "r" (vecbase));
}
#ifdef __cplusplus
}
#endif

View File

@ -162,6 +162,11 @@ static inline void cpu_ll_break(void)
__asm__ ("break 0,0");
}
static inline void cpu_ll_set_vecbase(const void* vecbase)
{
asm volatile ("wsr %0, vecbase" :: "r" (vecbase));
}
#ifdef __cplusplus
}
#endif

View File

@ -54,4 +54,9 @@ void cpu_hal_clear_watchpoint(int id)
{
cpu_ll_clear_watchpoint(id);
}
#endif // SOC_CPU_WATCHPOINTS_NUM > 0
#endif // SOC_CPU_WATCHPOINTS_NUM > 0
void cpu_hal_set_vecbase(const void* base)
{
cpu_ll_set_vecbase(base);
}