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

This commit is contained in:
morris 2020-03-06 11:08:10 +08:00
parent 63cd2b0613
commit 8b6c0947c7
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

@ -113,10 +113,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);
}