Browse Source

Add bootloader flash limit

Thomas Hondema 3 days ago
parent
commit
b61ae89ecb
2 changed files with 11 additions and 0 deletions
  1. 6 0
      README.md
  2. 5 0
      platformio.ini

+ 6 - 0
README.md

@@ -7,6 +7,12 @@ original V10 image.
 
 
 Besides the original hardware this firmware can also be compiled for ATmega328P based 16 MHz Arduino Uno R3, Nano and Pro Mini.
 Besides the original hardware this firmware can also be compiled for ATmega328P based 16 MHz Arduino Uno R3, Nano and Pro Mini.
 
 
+Application flash limits are board-specific: 31,744 bytes for the original
+meCoffee controller (the verified bootloader starts at `0x7c00`), 32,256 bytes
+for Uno, and the board definitions' 30,720 bytes for Pro Mini and Nano.
+The original-controller limit also applies to `328p8m_aligned` and `float_check`.
+An original-controller uploader must preserve and verify all of `0x7c00–0x7fff`.
+
 ## Toolchain
 ## Toolchain
 
 
 The registry toolchain `toolchain-atmelavr@1.70300.191015` is an x86_64 build and does not run on
 The registry toolchain `toolchain-atmelavr@1.70300.191015` is an x86_64 build and does not run on

+ 5 - 0
platformio.ini

@@ -14,6 +14,8 @@ extra_scripts = pre:tools/apply_cplusplus_flags.py
 [env:328p8m]
 [env:328p8m]
 platform = atmelavr@5.3.0
 platform = atmelavr@5.3.0
 board = 328p8m
 board = 328p8m
+; The device-matched original bootloader occupies 0x7c00..0x7fff (1 KiB).
+board_upload.maximum_size = 31744
 framework = arduino
 framework = arduino
 ; The registry toolchain (x86_64 avr-gcc 7.3) does not run on Apple Silicon without
 ; The registry toolchain (x86_64 avr-gcc 7.3) does not run on Apple Silicon without
 ; Rosetta. tools/toolchain-native wraps the Homebrew avr-gcc 9.5 (arm64).
 ; Rosetta. tools/toolchain-native wraps the Homebrew avr-gcc 9.5 (arm64).
@@ -34,6 +36,7 @@ upload_speed = 57600
 [env:uno]
 [env:uno]
 extends = env:328p8m
 extends = env:328p8m
 board = uno
 board = uno
+board_upload.maximum_size = 32256
 board_build.f_cpu = 16000000L
 board_build.f_cpu = 16000000L
 build_flags =
 build_flags =
     ${common.build_flags}
     ${common.build_flags}
@@ -43,11 +46,13 @@ upload_speed = 115200
 [env:pro_mini]
 [env:pro_mini]
 extends = env:uno
 extends = env:uno
 board = pro16MHzatmega328
 board = pro16MHzatmega328
+board_upload.maximum_size = 30720
 upload_speed = 57600
 upload_speed = 57600
 
 
 [env:nano]
 [env:nano]
 extends = env:uno
 extends = env:uno
 board = nanoatmega328new
 board = nanoatmega328new
+board_upload.maximum_size = 30720
 upload_speed = 115200
 upload_speed = 115200
 
 
 ; Bench-only BLE upload experiment, pinned to the verified stock Uno Optiboot 4.4.
 ; Bench-only BLE upload experiment, pinned to the verified stock Uno Optiboot 4.4.