-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
cmake: sysbuild: Fix image signing alignment not using write size #18888
Conversation
Fixes an issue whereby the alignment was fixed to 4 bytes and not taken from DTS where the write block size alignment is stored Signed-off-by: Jamie McCrae <[email protected]>
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: cdc5d0ee9abfda2d1c9b14715a9ee78e74957435 more detailssdk-nrf:
Github labels
List of changed files detected by CI (4)
Outputs:ToolchainVersion: f51bdba1d9 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
if(NOT write_block_size) | ||
set(write_block_size 4) | ||
message(WARNING "slot0_partition write block size devicetree parameter is missing, assuming write block size is 4") | ||
endif() |
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.
IMHO this should not be done this way.
This should be MCUboot Kconfig option that is either set by SoC configuration Kconfg and the SoC Kconfig may pick that from DTS controller, eventually.
Directly poking at DTS here crosses through module boundaries and entangles, directly, imgtool invocation with DTS definition of Flash partition/controller, and that definitions should belong to driver only.
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.
MCUboot does the exact same thing here: https://github.com/mcu-tools/mcuboot/blob/main/boot/zephyr/CMakeLists.txt#L417 it is a hardware property, it should not be in Kconfig. Now there is a problem with devices that have variable sector(/erase) sizes and that can't be represented in dts, in fact I don't really see a way of supporting them
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 know there is precedence for that, and I do not like it either. MCUboot is poking at something that does not belong to it, that is hardware property for a driver not a software stack above it.
This injects property of a subsystem into a driver and makes it impossible to independently modify driver without affecting system.
This is one of Flash problems in Zephyr that it is not accessed via common interface but rather through directly poking at internals, and gets impossible to move forward because patterns are repeated and suddenly every device has to have write-block-size or erase-block-size, because other subsystems expect it, even though these can vary at run-time (like in STM32 device, where write block size may change with voltage level applied to device).
Alignment here is a software property, not a hardware property. You can set here N * write-block-size (N is int > 1)) of a device and it will work; the hardware property is here constrain for software.
Memory footprint analysis revealed the following potential issuessample.matter.template.release[nrf7002dk/nrf5340/cpuapp]: High ROM usage: 811902[B] - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic) Note: This message is automatically posted and updated by the CI (latest/sdk-nrf/PR-18888/1) |
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.
OK, fixes the problem, but I still believe that we should fix that in Zephyr, by addressing the https://github.com/nrfconnect/sdk-nrf/pull/18888/files#r1842078803, and bring it in.
ACK as is.
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.
tested quarantined scenarios from test-sdk-mcuboot CI (mcuboot.direct_xip.with_revert), fix works
Fixes an issue whereby the alignment was fixed to 4 bytes and not taken from DTS where the write block size alignment is stored
ref.: NCSDK-30263