diff --git a/Code/pico_multi_booter/README.md b/Code/pico_multi_booter/README.md index 9389d41..6da7169 100644 --- a/Code/pico_multi_booter/README.md +++ b/Code/pico_multi_booter/README.md @@ -4,7 +4,7 @@ Here is a bootloader for PicoCalc combined slightly modified [PicoMite](https:// - Pico1 - No sdcard inserted,load default app to run from flash. -- Sdcard inserted, SD boot menu will show up, load third pico app bin to run at FLASH TARGET OFFSET 2048k-188k +- Sdcard inserted, SD boot menu will show up, load third pico app bin to run at FLASH TARGET OFFSET 2048k-200k ## How to compile ``` @@ -37,7 +37,7 @@ config.h ### SD Card Application Build and Deployment **Important Note:** ``` -Applications intended for SD card boot "MUST REBUILD" using a custom linker script to accommodate the program's offset(188k) address. +Applications intended for SD card boot "MUST REBUILD" using a custom linker script to accommodate the program's offset(200k) address. Applications intended for SD card boot is in **bin** format, not uf2. diff --git a/Code/pico_multi_booter/applink.py b/Code/pico_multi_booter/applink.py index 7c3dc08..7973604 100644 --- a/Code/pico_multi_booter/applink.py +++ b/Code/pico_multi_booter/applink.py @@ -468,8 +468,8 @@ def Built(dir, app): print("original last: ", last," ",'{:02X}'.format(last)) print("orignal size: ","{:>3}k".format(Size(last-strt, 1024))) print("orignal used: ","{:>3}k".format(Size(last, 4*1024))) - if last < 0x1002F000: - last = 0x1002F000 + if last < 0x10032000: + last = 0x10032000 size = "{:>3}k".format(Size(last-strt, 1024)) used = "{:>3}k".format(Size(last, 4*1024)) diff --git a/Code/pico_multi_booter/linker_scripts/memmap_default.ld.mp.rp2040 b/Code/pico_multi_booter/linker_scripts/memmap_default.ld.mp.rp2040 index 6dcb8c7..f0251d5 100644 --- a/Code/pico_multi_booter/linker_scripts/memmap_default.ld.mp.rp2040 +++ b/Code/pico_multi_booter/linker_scripts/memmap_default.ld.mp.rp2040 @@ -1,7 +1,7 @@ /*arduino-pico*/ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = __FLASH_LENGTH__ - 188k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = __FLASH_LENGTH__ - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = __RAM_LENGTH__ SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/Code/pico_multi_booter/linker_scripts/memmap_mp_rp2040.ld b/Code/pico_multi_booter/linker_scripts/memmap_mp_rp2040.ld index 188c343..1905bf3 100644 --- a/Code/pico_multi_booter/linker_scripts/memmap_mp_rp2040.ld +++ b/Code/pico_multi_booter/linker_scripts/memmap_mp_rp2040.ld @@ -24,7 +24,7 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/Code/pico_multi_booter/linker_scripts/rpi-pico.ld b/Code/pico_multi_booter/linker_scripts/rpi-pico.ld index b9d4e9d..2a2b595 100644 --- a/Code/pico_multi_booter/linker_scripts/rpi-pico.ld +++ b/Code/pico_multi_booter/linker_scripts/rpi-pico.ld @@ -4,7 +4,7 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/Code/pico_multi_booter/memmap_default_rp2040.ld b/Code/pico_multi_booter/memmap_default_rp2040.ld index 53614ad..31efe94 100644 --- a/Code/pico_multi_booter/memmap_default_rp2040.ld +++ b/Code/pico_multi_booter/memmap_default_rp2040.ld @@ -1,6 +1,6 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/Code/pico_multi_booter/memmap_default_rp2350.ld b/Code/pico_multi_booter/memmap_default_rp2350.ld index ac9a8ce..100b9b6 100644 --- a/Code/pico_multi_booter/memmap_default_rp2350.ld +++ b/Code/pico_multi_booter/memmap_default_rp2350.ld @@ -23,7 +23,7 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 256k, LENGTH = 4096k - 256k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 4096k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k diff --git a/Code/pico_multi_booter/picomite/FileIO.c b/Code/pico_multi_booter/picomite/FileIO.c index 266fc8e..4c4f2bc 100644 --- a/Code/pico_multi_booter/picomite/FileIO.c +++ b/Code/pico_multi_booter/picomite/FileIO.c @@ -5490,6 +5490,7 @@ void SaveOptions(void) enable_interrupts_pico(); uSec(10000); disable_interrupts_pico(); + // XXX @cuu erased 4K, but only write sizeof(option) back? flash_range_program(FLASH_TARGET_OFFSET, (const uint8_t *)&Option, sizeof(struct option_s)); enable_interrupts_pico(); } diff --git a/Code/pico_multi_booter/picomite/MM_Misc.c b/Code/pico_multi_booter/picomite/MM_Misc.c index 3739ff5..4f634f2 100644 --- a/Code/pico_multi_booter/picomite/MM_Misc.c +++ b/Code/pico_multi_booter/picomite/MM_Misc.c @@ -4659,7 +4659,8 @@ tp = checkstring(cmdline, (unsigned char *)"HEARTBEAT"); enable_interrupts_pico(); uSec(10000); disable_interrupts_pico(); - flash_range_program(FLASH_TARGET_OFFSET, (const uint8_t *)&Option, 768); + // XXX @cuu not writing sizeof(option)? + flash_range_program(FLASH_TARGET_OFFSET, (const uint8_t *)&Option, sizeof(struct option_s)); enable_interrupts_pico(); _excep_code = RESET_COMMAND; SoftReset(); diff --git a/Code/pico_multi_booter/picomite/configuration.h b/Code/pico_multi_booter/picomite/configuration.h index 95d2851..0efca7a 100644 --- a/Code/pico_multi_booter/picomite/configuration.h +++ b/Code/pico_multi_booter/picomite/configuration.h @@ -162,7 +162,7 @@ extern "C" { #ifdef rp2350 #define HEAP_MEMORY_SIZE (288*1024) #define MAXVARS 768 // 8 + MAXVARLEN + MAXDIM * 4 (ie, 64 bytes) - these do not incl array members - #define FLASH_TARGET_OFFSET (968 * 1024) + #define FLASH_TARGET_OFFSET (1080 * 1024) // 200k + 880k -- make sure PicoMite binary is under 880k! (currently ~780k, leave 100k for expansion) #define MAX_CPU (rp2350a ? 396000 : 378000) #define MAXSUBFUN 512 // each entry takes up 4 bytes #ifdef USBKEYBOARD @@ -175,7 +175,7 @@ extern "C" { #else #define HEAP_MEMORY_SIZE (128*1024) #define MAXVARS 512 // 8 + MAXVARLEN + MAXDIM * 2 (ie, 56 bytes) - these do not incl array members - #define FLASH_TARGET_OFFSET (968 * 1024) + #define FLASH_TARGET_OFFSET (1080 * 1024) // 200k + 880k -- make sure PicoMite binary is under 880k! (currently ~780k, leave 100k for expansion) #define MAX_CPU 420000 #define MAXSUBFUN 256 // each entry takes up 4 bytes #ifdef USBKEYBOARD diff --git a/Code/pico_multi_booter/picomite/memmap_default_rp2040.ld b/Code/pico_multi_booter/picomite/memmap_default_rp2040.ld index 53614ad..31efe94 100644 --- a/Code/pico_multi_booter/picomite/memmap_default_rp2040.ld +++ b/Code/pico_multi_booter/picomite/memmap_default_rp2040.ld @@ -1,6 +1,6 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/Code/pico_multi_booter/picomite/memmap_default_rp2350.ld b/Code/pico_multi_booter/picomite/memmap_default_rp2350.ld index ac9a8ce..100b9b6 100644 --- a/Code/pico_multi_booter/picomite/memmap_default_rp2350.ld +++ b/Code/pico_multi_booter/picomite/memmap_default_rp2350.ld @@ -23,7 +23,7 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000 + 256k, LENGTH = 4096k - 256k + FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 4096k - 200k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k diff --git a/Code/pico_multi_booter/sd_boot/config.h b/Code/pico_multi_booter/sd_boot/config.h index bbe907b..c7ddd23 100644 --- a/Code/pico_multi_booter/sd_boot/config.h +++ b/Code/pico_multi_booter/sd_boot/config.h @@ -36,7 +36,7 @@ // According to the applink.map ,with combined PicoMite, here is 920k // This offset is used to ensure that the bootloader does not get overwritten // when loading a new application from the SD card -#define SD_BOOT_FLASH_OFFSET (188 * 1024) +#define SD_BOOT_FLASH_OFFSET (200 * 1024) // Maximum size of the application that can be loaded // This ensures we don't overwrite the bootloader itself diff --git a/Code/pico_multi_booter/sd_boot/main.c b/Code/pico_multi_booter/sd_boot/main.c index ae0b9d7..20f0d5c 100644 --- a/Code/pico_multi_booter/sd_boot/main.c +++ b/Code/pico_multi_booter/sd_boot/main.c @@ -285,7 +285,7 @@ void final_selection_callback(const char *path) if(path == NULL) { //load default app from flash - snprintf(status_message, sizeof(status_message), "SEL: %s", "FLASH+188k"); + snprintf(status_message, sizeof(status_message), "SEL: %s", "FLASH+200k"); text_directory_ui_set_status(status_message); sleep_ms(200); load_firmware_by_path(path);