Commit f1843375 authored by Sergei Poselenov's avatar Sergei Poselenov
Browse files

RT #72064. Implemented reset_cpu() for STM32. Moved reset_cpu() and

 cortex_m3_irq_vec_get() from platform-specific cpu.c to the common CM3 code.
 However, a platform can implement their own reset_cpu().
parent 7675320b
......@@ -52,21 +52,6 @@ void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
reset_cpu(ulong addr)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
/*
* Perform reset but keep priority group unchanged.
*/
scb->aircr = (CM3_AIRCR_VECTKEY << CM3_AIRCR_VECTKEY_SHIFT) |
(scb->aircr &
(CM3_AIRCR_PRIGROUP_MSK << CM3_AIRCR_PRIGROUP_SHIFT)) |
CM3_AIRCR_SYSRESET;
cortex_m3_reset_cpu(addr);
}
/*
* Dump the registers on an exception we don't know how to process.
*/
unsigned char cortex_m3_irq_vec_get(void)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
return scb->icsr & CM3_ICSR_VECTACT_MSK;
}
......@@ -89,3 +89,32 @@ void hw_watchdog_reset(void)
wdt_strobe();
}
#endif
/*
* Perform the low-level reset.
* Note that we need for this function to reside in RAM since it
* can be used to self-upgrade U-boot in eNMV.
*/
void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
cortex_m3_reset_cpu(ulong addr)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
/*
* Perform reset but keep priority group unchanged.
*/
scb->aircr = (CM3_AIRCR_VECTKEY << CM3_AIRCR_VECTKEY_SHIFT) |
(scb->aircr &
(CM3_AIRCR_PRIGROUP_MSK << CM3_AIRCR_PRIGROUP_SHIFT)) |
CM3_AIRCR_SYSRESET;
}
/*
* Dump the registers on an exception we don't know how to process.
*/
unsigned char cortex_m3_irq_vec_get(void)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
return scb->icsr & CM3_ICSR_VECTACT_MSK;
}
......@@ -52,21 +52,5 @@ void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
reset_cpu(ulong addr)
{
/*
* TBD
*/
return;
}
/*
* Dump the registers on an exception we don't know how to process.
*/
unsigned char cortex_m3_irq_vec_get(void)
{
/*
* TBD
*/
return 0;
cortex_m3_reset_cpu(addr);
}
......@@ -59,4 +59,8 @@ struct cm3_systick {
#define CM3_SYSTICK_LOAD_RELOAD_MSK (0x00FFFFFF)
#define CM3_SYSTICK_CTRL_EN 1
void __attribute__((section(".ramcode"))) __attribute__ ((long_call))
cortex_m3_reset_cpu(ulong addr);
unsigned char cortex_m3_irq_vec_get(void);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment