lib: os: disable caches before reboot
This ensures that all pending writes are committed. This is relevant for flags in .noinit SRAM that are read back after reset. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
This commit is contained in:
parent
a5f9fc2382
commit
b94ab6e9f1
1 changed files with 12 additions and 0 deletions
|
|
@ -14,6 +14,18 @@ extern void sys_arch_reboot(int type);
|
||||||
FUNC_NORETURN void sys_reboot(int type)
|
FUNC_NORETURN void sys_reboot(int type)
|
||||||
{
|
{
|
||||||
(void)irq_lock();
|
(void)irq_lock();
|
||||||
|
|
||||||
|
/* Disable caches to ensure all data is flushed */
|
||||||
|
#if defined(CONFIG_ARCH_CACHE)
|
||||||
|
#if defined(CONFIG_DCACHE)
|
||||||
|
sys_cache_data_disable();
|
||||||
|
#endif /* CONFIG_DCACHE */
|
||||||
|
|
||||||
|
#if defined(CONFIG_ICACHE)
|
||||||
|
sys_cache_instr_disable();
|
||||||
|
#endif /* CONFIG_ICACHE */
|
||||||
|
#endif /* CONFIG_ARCH_CACHE */
|
||||||
|
|
||||||
sys_clock_disable();
|
sys_clock_disable();
|
||||||
|
|
||||||
sys_arch_reboot(type);
|
sys_arch_reboot(type);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue