Browse Source

Fix usage of RAMEND

RAMEND is the last valid address, not one-past as I expected it to be...
Yuri D'Elia 2 years ago
parent
commit
f7dc8dcaef
3 changed files with 4 additions and 4 deletions
  1. 1 1
      Firmware/Dcodes.cpp
  2. 1 1
      Firmware/bootapp.h
  3. 2 2
      Firmware/xflash_dump.cpp

+ 1 - 1
Firmware/Dcodes.cpp

@@ -278,7 +278,7 @@ void dcode_1()
     */
 void dcode_2()
 {
-    dcode_core(RAMSTART, RAMEND, dcode_mem_t::sram, 2, _N("SRAM"));
+    dcode_core(RAMSTART, RAMEND+1, dcode_mem_t::sram, 2, _N("SRAM"));
 }
 #endif
 

+ 1 - 1
Firmware/bootapp.h

@@ -7,7 +7,7 @@
 #include <inttypes.h>
 
 
-#define RAMSIZE        (RAMEND-RAMSTART)
+#define RAMSIZE        (RAMEND+1-RAMSTART)
 #define boot_src_addr  (*((uint32_t*)(RAMSIZE - 16)))
 #define boot_dst_addr  (*((uint32_t*)(RAMSIZE - 12)))
 #define boot_copy_size (*((uint16_t*)(RAMSIZE - 8)))

+ 2 - 2
Firmware/xflash_dump.cpp

@@ -63,7 +63,7 @@ static void xfdump_dump_core(dump_header_t& hdr, uint32_t addr, uint8_t* buf, ui
     xflash_wait_busy();
 
     // write data
-    static_assert(sizeof(dump_t::data) <= RAMEND, "dump area size insufficient");
+    static_assert(sizeof(dump_t::data) <= RAMEND+1, "dump area size insufficient");
     xflash_multipage_program(addr, buf, cnt);
 }
 
@@ -96,7 +96,7 @@ void xfdump_full_dump_and_reset(dump_crash_reason reason)
     wdt_enable(WDTO_500MS);
 
     // write all addressable ranges (this will trash bidirectional registers)
-    xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data), 0, RAMEND);
+    xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data), 0, RAMEND+1);
 
     // force a reset even sooner
     softReset();