ソースを参照

Account for the Optiboot bootloader when reporting flash usage

The size report compared program size against the full flash size,
overstating how much headroom is actually left once the bootloader's
reserved 1024 bytes are excluded.
k4be 1 週間 前
親
コミット
e8ca4e1e68
1 ファイル変更、11 行追加、1 行削除
  1. 11 1
      soft/Makefile

+ 11 - 1
soft/Makefile

@@ -18,6 +18,16 @@ FLASH_SIZE = 65536
 RAM_SIZE   = 4096
 EEPROM_SIZE = 2048
 
+### Flash available to this app, i.e. FLASH_SIZE minus the Optiboot bootloader
+### section actually reserved on this device: optiboot/Makefile.1284 forces
+### -DBIGBOOT for the atmega644p target, which hardcodes __BOOT_SIZE__ to
+### 1024 bytes in optiboot.c's "#if BIGBOOT" branch - confirmed independently
+### by the programmed high fuse (hfuse=0x14, optiboot/Makefile:736): BOOTSZ1:
+### BOOTSZ0 = 1:0 = "10", the 644P's 512-word (1024-byte) boot size option,
+### boot address 0x7E00 (word) = 0xFC00 (byte). Re-check both if the fuse
+### settings or optiboot's BIGBOOT option for this target ever change.
+FLASH_APP_SIZE = 64512
+
 ### Bootloader port
 PROGPORT ?= /dev/ttyUSB0
 
@@ -154,7 +164,7 @@ size:
 		$$1==".text" || $$1==".data" { prog += $$2 } \
 		$$1==".data" || $$1==".bss" || $$1==".noinit" { ram += $$2 } \
 		END { \
-			printf "Program: %6d bytes (%5.1f%% of %d byte flash on $(DEVICE))\n", prog, prog*100.0/$(FLASH_SIZE), $(FLASH_SIZE); \
+			printf "Program: %6d bytes (%5.1f%% of %d byte flash on $(DEVICE), %d bytes reserved for the bootloader)\n", prog, prog*100.0/$(FLASH_APP_SIZE), $(FLASH_APP_SIZE), $(FLASH_SIZE) - $(FLASH_APP_SIZE); \
 			printf "Data:    %6d bytes (%5.1f%% of %d byte RAM on $(DEVICE))\n", ram, ram*100.0/$(RAM_SIZE), $(RAM_SIZE); \
 		}'