-
Notifications
You must be signed in to change notification settings - Fork 8k
Boards: STM32H750B-DK: Introduce App in Ext Flash variant #97037
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?
Boards: STM32H750B-DK: Introduce App in Ext Flash variant #97037
Conversation
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.
@JarmouniA I was wondering if snippets could be used instead of adding a target each time we need to introduce an ext_mem app. Did you look at this possibility ?
Just thinking out loud, maybe the combination with sysbuild doesn't work great.
Not sure what we would put in them, maybe an ext Flash-specific snippet, but then the internal Flash is not necessarily the same, its sector size... |
Many Zephyr subsystems as well MCUboot rely on the write-block-size and erase-block-size properties, of the chosen Flash device in DT, to determine the optimal parameters for using the flash & its partitions. Include the soc-nv-flash binding in STM32 External NOR Flash binding so that those two properties can be specified in the external Flash node in board DT. Until now, the workaround for STM32 boards using MCUboot has been to disable CONFIG_BOOT_MAX_IMG_SECTORS_AUTO in MCUboot's board extra conf and to set CONFIG_BOOT_MAX_IMG_SECTORS manually depending on the app slot size & the NOR Flash sector size. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Pull in the necessary MCUboot bits, will be removed before merging the PR. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
95ac7ff
to
573417e
Compare
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with PR revision and 1 project with metadata changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
573417e
to
00106a2
Compare
Introduce a board variant for storing an app in external QSPI NOR Flash and chainloading it with MCUboot (placed in internal Flash) to be executed either in place (XiP) (set by default, MCUBOOT_MODE_DIRECT_XIP) or to be loaded to RAM and be executed there (MCUBOOT_MODE_RAM_LOAD). The new variant requires a board DT overlay on the MCUboot side to set the internal Flash & Flash controller as the chosen 'zephyr,flash' & 'zephyr,flash-controller'. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Add stm32h750b_dk/stm32h750xx/ext_flash_app target to CI platforms Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
Add stm32h750b_dk/stm32h750xx/ext_flash_app target to CI platforms. Signed-off-by: Abderrahmane JARMOUNI <[email protected]>
00106a2
to
b26dafd
Compare
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
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.
Nice!
Though, I think we can get rid of the mcuboot overlay by using stm32h750b_dk
as the mcuboot target. This way, mcuboot is a usual zephyr application running on internal flash.
(Note also that zephyr,code-partition = &boot_partition;
is already defined in mcuboot app.overlay)
To do this, you probably need to add a sysbuild.cmake
file to the board, stating:
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
set_target_properties(mcuboot PROPERTIES BOARD stm32h750b_dk/stm32h750xx)
endif()
and no mcuboot dependency anymore.
Can you have a try and report back (somehow I can't find any stm32h750b_dk here anymore to test it myself) ?
I already thought of that, but the MCUboot App build depends on info specified in ext_flash_app variant dts, an example is info about the slots There are potentially other interdependencies at the sysbuild level as well, I don't think it's a good idea to use different targets. |
It builds on my side. I'm just unable to test it. |
The MCUboot partitions (slot0, slot1...) are not relevant to the base variant, which is supposed to be used with a regular Zephyr app (MCUboot is not a regular app, it's a bootloader) in internal Flash & external Flash is used for storage or whatever,
So why would we put the MCUboot partitions in the common dtsi, and of what use would be the ext_flash_app variant in that case? |
We already have this case on other boards where "main" variant .dts provides slot0/slot1 on internal flash and this "main" variant could be used either as a "direct" zephyr application or chainloaded behind mcuboot. Difference here is that we need a variant to be able to specify different Also note that these boards (based on h750, h7r/s) are a bit specific in the way that they have a quite limited internal flash and are meant to be used with a ext_flash, from which the main application should run. Last point about interest of the ext_flash_app variant is that it could be used to specify configurations that would not be supported on the main variant running on the internal flash (thinking about video use cases for instance). But I need to verify this point. |
It could definitely be used that way in a product where app upgrade is not needed by just relocating the big/non-critical parts of the app, running from internal Flash, to ext Flash. |
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
slot0_partition: partition@0 { |
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.
This does not work in RAM_LOAD mode, build system considers the slot address as the user app's hex address (where image will be flashed), which is actually at an offset of 0x90000000.
Line 151 in 8c13c07
set(imgtool_args ${imgtool_args} --hex-addr ${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.
Did you try with CONFIG_XIP=n
? (required when RAM_LOAD is used)
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.
It's done by sysbuild
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_XIP n) |
Introduce a board variant for storing an app in external QSPI NOR Flash and chainloading it with MCUboot (which is placed in internal Flash) to be executed either in place (XiP) (MCUBOOT_MODE_DIRECT_XIP, set by default in board's
Kconfig.sysbuild
) or to be loaded to RAM and be executed there (MCUBOOT_MODE_RAM_LOAD).The ext Flash memory partition also allows for using the Swap-using-offset & swap-using-move MCUboot image upgrade algorithms, eventhough it's not optimal as it has same-sized slots.
The new variant requires a board DT overlay on the MCUboot side (mcu-tools/mcuboot#2479) to set the internal Flash & Flash controller as the chosen 'zephyr,flash' & 'zephyr,flash-controller'. This way, no overlay will be needed at the Zephyr user app level.