board_reset: flush cache before reset

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2024-07-30 22:09:47 +08:00 committed by Xiang Xiao
parent 583dd00034
commit ba05a36eed
2 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/cache.h>
#include <nuttx/lib/modlib.h>
#include <nuttx/binfmt/symtab.h>
#include <nuttx/drivers/ramdisk.h>
@ -394,6 +395,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
case BOARDIOC_POWEROFF:
{
reboot_notifier_call_chain(SYS_POWER_OFF, (FAR void *)arg);
up_flush_dcache_all();
ret = board_power_off((int)arg);
}
break;
@ -410,6 +412,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
case BOARDIOC_RESET:
{
reboot_notifier_call_chain(SYS_RESTART, (FAR void *)arg);
up_flush_dcache_all();
ret = board_reset((int)arg);
}
break;

View File

@ -28,6 +28,7 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/cache.h>
#include <nuttx/coredump.h>
#include <nuttx/compiler.h>
#include <nuttx/irq.h>
@ -565,6 +566,7 @@ static noreturn_function int pause_cpu_handler(FAR void *arg)
{
memcpy(g_last_regs[this_cpu()], up_current_regs(), sizeof(g_last_regs[0]));
g_cpu_paused[this_cpu()] = true;
up_flush_dcache_all();
while (1);
}
@ -742,6 +744,7 @@ static void dump_fatal_info(FAR struct tcb_s *rtcb,
static void reset_board(void)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
up_flush_dcache_all();
board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE);
#else
for (; ; )