Hello, question about mcuboot, particularly the imgtool.py.
When I run west build, the build eventually fails on:
Error: Image size (0xbac8) + trailer (0xc30) exceeds requested size 0x1000
The builder runs the script with --slot-size 4096
scripts/imgtool.py sign --version 0.0.0+0 --header-size 0x200 --slot-size 4096 --align 8 --key
Which is way too low.
Before that it reports after building the application that my application is about 47480 bytes.
Memory region Used Size Region Size %age Used
FLASH: 47480 B 67248 B 70.60%
RAM: 10752 B 31 KB 33.87%
RetainedMem: 0 GB 4 B 0.00%
IDT_LIST: 0 GB 32 KB 0.00%
My pm_static.yml looks like:
mcuboot:
address: 0x00000000
end_address: 0x0000C800
size: 0xC800 # 50 KB
region: flash_primary
app:
address: 0x0000C800
end_address: 0x00012800
size: 0x12800 # 74 KB
region: flash_primary
app_pad:
address: 0x0001F000
end_address: 0x00020000
size: 0x1000 # 4 KB
region: flash_primary
And my dts:
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,boot-mode = &retention0;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(50)>; // 50 KB
read-only;
};
slot0_partition: partition@C800 {
label = "image-0";
reg = <0x0000C800 DT_SIZE_K(74)>; // 74 KB
};
slot1_partition: partition@1F000 {
label = "image-1";
reg = <0x0001F000 DT_SIZE_K(4)>; // 4 KB dummy partition
};
};
};
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_REBOOT=y
CONFIG_RETENTION_BOOT_MODE=y
CONFIG_RETAINED_MEM=y
CONFIG_RETENTION=y
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="root-rsa-2048.pem"
CONFIG_BOOT_SIGNATURE_KEY_FILE="./root-rsa-2048.pem"
CONFIG_BOOT_SERIAL_BOOT_MODE=y
CONFIG_RETENTION_BOOT_MODE=y
CONFIG_RETENTION=y
CONFIG_RETAINED_MEM=y
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
CONFIG_CONSOLE=y
CONFIG_FLASH=y
Because of my limited flash size (128kb) I want to run mcuboot as single app as specified in my prj.conf.
The linker appears to think it should sign the appliction for the slot1_partition which I confirmed when I increased the slot1 dummy partition size. Ideally I do not need to define a slot1, but that seems to be a requirement as I get CMake errors that it expects a slot1 when I remove it entirely.
Any help/guidance would be welcome!