XMC flash support - WIP by ChocolateFrogsNuts · Pull Request #6725 · esp8266/Arduino (original) (raw)

If we drop some sanity checks in the eboot section handler, it all just barely fits. I don't think there is much reason to have the checks there if we're using our own elf2bin.py script and can guarantee anything we create is valid. If anything was uploaded that's invalid, well, that would kind of crash anyway I think.

diff --git a/bootloaders/eboot/eboot.c b/bootloaders/eboot/eboot.c
index 8d00ed0e..dc943808 100644
--- a/bootloaders/eboot/eboot.c
+++ b/bootloaders/eboot/eboot.c
@@ -60,7 +60,7 @@ int load_app_from_flash_raw(const uint32_t flash_addr)
         pos += sizeof(section_header);

         const uint32_t address = section_header.address;
-
+#if 0
         bool load = false;

         if (address < 0x40000000) {
@@ -79,7 +79,7 @@ int load_app_from_flash_raw(const uint32_t flash_addr)
             pos += section_header.size;
             continue;
         }
-
+#endif
         if (SPIRead(pos, (void*)address, section_header.size))
             return 3;

@@ -118,11 +118,13 @@ int copy_raw(const uint32_t src_addr,
              const uint32_t dst_addr,
              const uint32_t size)
 {
+#if 0
     // require regions to be aligned
     if ((src_addr & 0xfff) != 0 ||
         (dst_addr & 0xfff) != 0) {
         return 1;
     }
+#endif

     const uint32_t buffer_size = FLASH_SECTOR_SIZE;
     uint8_t buffer[buffer_size];