Переглянути джерело

fix SD card bootloader being slow

The SD card bootloader was disabling XIP cache. This combined with
flash programming resetting the flash clock to slow default resulted
in slow firmware loading from SD card.

Fixed by keeping XIP cache enabled on RP2350. It was being disabled
only because on RP2040 there were historically some problems (may
be that those too have been fixed in later SDK versions).
Petteri Aimonen 3 місяців тому
батько
коміт
fe61c739d9
1 змінених файлів з 4 додано та 2 видалено
  1. 4 2
      lib/BlueSCSI_platform_RP2MCU/program_flash.cpp

+ 4 - 2
lib/BlueSCSI_platform_RP2MCU/program_flash.cpp

@@ -86,13 +86,15 @@ bool platform_rewrite_flash_page(uint32_t offset, uint8_t buffer[PLATFORM_FLASH_
     // Avoid any mbed timer interrupts triggering during the flashing.
     uint32_t saved_irq = save_and_disable_interrupts();
 
+#ifndef ZULUSCSI_MCU_RP23XX
     // For some reason any code executed after flashing crashes
-    // unless we disable the XIP cache.
+    // unless we disable the XIP cache on RP2040.
     // Not sure why this happens, as flash_range_program() is flushing
     // the cache correctly.
     // The cache is now enabled from bootloader start until it starts
     // flashing, and again after reset to main firmware.
     xip_ctrl_hw->ctrl = 0;
+#endif
 
     flash_range_erase(offset, PLATFORM_FLASH_PAGE_SIZE);
     flash_range_program(offset, buffer, PLATFORM_FLASH_PAGE_SIZE);
@@ -151,4 +153,4 @@ void btldr_reset_handler()
 __attribute__((section(".btldr_vectors")))
 const void * btldr_vectors[2] = {&__StackTop, (void*)&btldr_reset_handler};
 
-#endif // PLATFORM_BOOTLOADER_SIZE
+#endif // PLATFORM_BOOTLOADER_SIZE