program offset back to 200k, picomite size increase to 880k (1080k in total)

This commit is contained in:
Yatao Li 2025-06-18 10:06:34 +08:00
parent eb3b15e188
commit 7ce75c9ee0
14 changed files with 18 additions and 16 deletions

View File

@ -4,7 +4,7 @@ Here is a bootloader for PicoCalc combined slightly modified [PicoMite](https://
- Pico1 - Pico1
- No sdcard inserted,load default app to run from flash. - 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 ## How to compile
``` ```
@ -37,7 +37,7 @@ config.h
### SD Card Application Build and Deployment ### SD Card Application Build and Deployment
**Important Note:** **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. Applications intended for SD card boot is in **bin** format, not uf2.

View File

@ -468,8 +468,8 @@ def Built(dir, app):
print("original last: ", last," ",'{:02X}'.format(last)) print("original last: ", last," ",'{:02X}'.format(last))
print("orignal size: ","{:>3}k".format(Size(last-strt, 1024))) print("orignal size: ","{:>3}k".format(Size(last-strt, 1024)))
print("orignal used: ","{:>3}k".format(Size(last, 4*1024))) print("orignal used: ","{:>3}k".format(Size(last, 4*1024)))
if last < 0x1002F000: if last < 0x10032000:
last = 0x1002F000 last = 0x10032000
size = "{:>3}k".format(Size(last-strt, 1024)) size = "{:>3}k".format(Size(last-strt, 1024))
used = "{:>3}k".format(Size(last, 4*1024)) used = "{:>3}k".format(Size(last, 4*1024))

View File

@ -1,7 +1,7 @@
/*arduino-pico*/ /*arduino-pico*/
MEMORY 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__ RAM(rwx) : ORIGIN = 0x20000000, LENGTH = __RAM_LENGTH__
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k

View File

@ -24,7 +24,7 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k

View File

@ -4,7 +4,7 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k

View File

@ -1,6 +1,6 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k

View File

@ -23,7 +23,7 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 256k, LENGTH = 4096k - 256k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 4096k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k
SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k

View File

@ -5490,6 +5490,7 @@ void SaveOptions(void)
enable_interrupts_pico(); enable_interrupts_pico();
uSec(10000); uSec(10000);
disable_interrupts_pico(); 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)); flash_range_program(FLASH_TARGET_OFFSET, (const uint8_t *)&Option, sizeof(struct option_s));
enable_interrupts_pico(); enable_interrupts_pico();
} }

View File

@ -4659,7 +4659,8 @@ tp = checkstring(cmdline, (unsigned char *)"HEARTBEAT");
enable_interrupts_pico(); enable_interrupts_pico();
uSec(10000); uSec(10000);
disable_interrupts_pico(); 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(); enable_interrupts_pico();
_excep_code = RESET_COMMAND; _excep_code = RESET_COMMAND;
SoftReset(); SoftReset();

View File

@ -162,7 +162,7 @@ extern "C" {
#ifdef rp2350 #ifdef rp2350
#define HEAP_MEMORY_SIZE (288*1024) #define HEAP_MEMORY_SIZE (288*1024)
#define MAXVARS 768 // 8 + MAXVARLEN + MAXDIM * 4 (ie, 64 bytes) - these do not incl array members #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 MAX_CPU (rp2350a ? 396000 : 378000)
#define MAXSUBFUN 512 // each entry takes up 4 bytes #define MAXSUBFUN 512 // each entry takes up 4 bytes
#ifdef USBKEYBOARD #ifdef USBKEYBOARD
@ -175,7 +175,7 @@ extern "C" {
#else #else
#define HEAP_MEMORY_SIZE (128*1024) #define HEAP_MEMORY_SIZE (128*1024)
#define MAXVARS 512 // 8 + MAXVARLEN + MAXDIM * 2 (ie, 56 bytes) - these do not incl array members #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 MAX_CPU 420000
#define MAXSUBFUN 256 // each entry takes up 4 bytes #define MAXSUBFUN 256 // each entry takes up 4 bytes
#ifdef USBKEYBOARD #ifdef USBKEYBOARD

View File

@ -1,6 +1,6 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 188k, LENGTH = 2048k - 188k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k

View File

@ -23,7 +23,7 @@
MEMORY MEMORY
{ {
FLASH(rx) : ORIGIN = 0x10000000 + 256k, LENGTH = 4096k - 256k FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 4096k - 200k
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k
SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k

View File

@ -36,7 +36,7 @@
// According to the applink.map ,with combined PicoMite, here is 920k // According to the applink.map ,with combined PicoMite, here is 920k
// This offset is used to ensure that the bootloader does not get overwritten // This offset is used to ensure that the bootloader does not get overwritten
// when loading a new application from the SD card // 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 // Maximum size of the application that can be loaded
// This ensures we don't overwrite the bootloader itself // This ensures we don't overwrite the bootloader itself

View File

@ -285,7 +285,7 @@ void final_selection_callback(const char *path)
if(path == NULL) { if(path == NULL) {
//load default app from flash //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); text_directory_ui_set_status(status_message);
sleep_ms(200); sleep_ms(200);
load_firmware_by_path(path); load_firmware_by_path(path);