-
Notifications
You must be signed in to change notification settings - Fork 8.1k
CMake: MCUboot: fix image hex address in RAM Load mode #97413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
CMake: MCUboot: fix image hex address in RAM Load mode #97413
Conversation
My first point would be that you are missing a |
Saw you need to manually specify it, so it is not default. Anyhow, this fixes it with the ranges property, otherwise you are declaring that the flash partitions start at 0x0 in dts, which is wrong:
|
@nordicjm STM32N6 is a specific kind of STM32: there is no internal flash. In default mode, the BootROM (internal and non updatable bootloader) will load the binary (called First Stage Boot Loader) from ext flash (at a specific location) to RAM, which will then execute in |
cmake/mcuboot.cmake
Outdated
endif() | ||
set(imgtool_args_alt_slot ${imgtool_args} --hex-addr ${slot1_partition_address}) | ||
set(imgtool_args ${imgtool_args} --hex-addr ${slot0_partition_address}) | ||
math(EXPR SLOT0_PARTITION_ADDRESS "${CONFIG_FLASH_BASE_ADDRESS} + ${slot0_partition_address}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm implementing a CMake function in cmake.extensions
, to replace dt_reg_addr
above, that will give the absolute address of the slot partition, similar to the macro
#define DT_FIXED_PARTITION_ADDR(node_id) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good thing but nack on the board impact part for now
37fe441
to
cf50563
Compare
Introduce a new dt_fixed_partition_addr() function that returns the absolute address of a fixed partition, meaning the sum of the base address of the containing grand-parent node and the partition's offset. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
In RAM LOAD mode, the app slot addr is taken as the hex-addr passed to imgtool, which is only correct if the grand-parent node's (usually the flash node) absolute address is actually 0, because the addresses of all the flash fixed-partitions in-tree are relative to their grand-parent node's address. Hence, use the newly added dt_fixed_partition_addr() function to get the absolute address of app slots partitions. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
cf50563
to
c6ca4e9
Compare
|
In MCUBoot RAM LOAD mode, the app slot addr is taken as the hex-addr passed to imgtool to create slot0 & 1 images, which is only correct if the grand-parent node's (usually the flash node) absolute address is actually 0, because the addresses of all the flash fixed-partitions in-tree are relative to their grand-parent node's address.
Hence, use the newly added dt_fixed_partition_addr() CMake function to get the absolute address of app slots partitions.