This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0b98e9e680d45a0e9292dc084a236fed46e58dbf
Author: wangmingrong1 <[email protected]>
AuthorDate: Tue Jul 30 22:09:47 2024 +0800

    board_reset: flush cache before reset
    
    Signed-off-by: wangmingrong1 <[email protected]>
---
 boards/boardctl.c   | 3 +++
 sched/misc/assert.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/boards/boardctl.c b/boards/boardctl.c
index 388e1e00a7..9e652560d6 100644
--- a/boards/boardctl.c
+++ b/boards/boardctl.c
@@ -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;
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 7e6fd98ed3..53b16d297e 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -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>
@@ -569,6 +570,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);
 }
 
@@ -754,6 +756,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 (; ; )

Reply via email to