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

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5e32aa14bfa513a8d1d9ec6feb791b443a588430
Author: Gustavo Henrique Nihei <gustavo.ni...@espressif.com>
AuthorDate: Mon Jul 11 15:16:41 2022 -0300

    risc-v/esp32c3: Fix verification of ROM function return values
    
    cache_dbus_mmu_set and cache_ibus_mmu_set return positive values in case
    of errors, so DEBUVERIFY could never detect them since this macro checks
    for negative values.
    Besides, the successful execution of those functions is mandatory for
    the reliable operation under Protected Mode, so the verification is
    always performed, even when DEBUG is not enabled.
    
    Signed-off-by: Gustavo Henrique Nihei <gustavo.ni...@espressif.com>
---
 arch/risc-v/src/esp32c3/esp32c3_userspace.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/risc-v/src/esp32c3/esp32c3_userspace.c 
b/arch/risc-v/src/esp32c3/esp32c3_userspace.c
index 9f885a92e5..5628c90603 100755
--- a/arch/risc-v/src/esp32c3/esp32c3_userspace.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_userspace.c
@@ -157,16 +157,16 @@ static noinline_function IRAM_ATTR void 
configure_mmu(void)
   drom_lma_aligned = app_drom_lma & MMU_FLASH_MASK;
   drom_vma_aligned = app_drom_vma & MMU_FLASH_MASK;
   drom_page_count = calc_mmu_pages(app_drom_size, app_drom_vma);
-  DEBUGVERIFY(cache_dbus_mmu_set(MMU_ACCESS_FLASH, drom_vma_aligned,
+  ASSERT(cache_dbus_mmu_set(MMU_ACCESS_FLASH, drom_vma_aligned,
                                  drom_lma_aligned, 64,
-                                 (int)drom_page_count, 0));
+                                 (int)drom_page_count, 0) == 0);
 
   irom_lma_aligned = app_irom_lma & MMU_FLASH_MASK;
   irom_vma_aligned = app_irom_vma & MMU_FLASH_MASK;
   irom_page_count = calc_mmu_pages(app_irom_size, app_irom_vma);
-  DEBUGVERIFY(cache_ibus_mmu_set(MMU_ACCESS_FLASH, irom_vma_aligned,
-                                 irom_lma_aligned, 64,
-                                 (int)irom_page_count, 0));
+  ASSERT(cache_ibus_mmu_set(MMU_ACCESS_FLASH, irom_vma_aligned,
+                            irom_lma_aligned, 64,
+                            (int)irom_page_count, 0) == 0);
 
   cache_resume_icache(autoload);
 }
@@ -197,8 +197,8 @@ static noinline_function IRAM_ATTR const void 
*map_flash(uint32_t src_addr,
 
   src_addr_aligned = src_addr & MMU_FLASH_MASK;
   page_count = calc_mmu_pages(size, src_addr);
-  DEBUGVERIFY(cache_dbus_mmu_set(MMU_ACCESS_FLASH, MMU_BLOCK63_VADDR,
-                                 src_addr_aligned, 64, (int)page_count, 0));
+  ASSERT(cache_dbus_mmu_set(MMU_ACCESS_FLASH, MMU_BLOCK63_VADDR,
+                            src_addr_aligned, 64, (int)page_count, 0) == 0);
 
   cache_resume_icache(autoload);
 

Reply via email to