-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
CONFIG_BOOTLOADER_SRAM_SIZE should not be defined by default #49484
Comments
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
@microbuilder what are the next steps here? I'm happy to provide more context and why this is necessary. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
@d3zd3z Mind taking a look at this? |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
@microbuilder @d3zd3z reminder please |
I'm not sure why it is defined on xtensa, either, since only arm even makes use of the symbol. 21628d4 added this, which allows a particular configuration with a bootloader that uses this reserved memory for its sram so that the image can use the rest of the sram. @benwrs do you have any insight on when this gets used, and if maybe we could make the configuration clearer? |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
@benwrs @peter-mitsis, can you help look at this issue. |
This SRAM space is reserved for the case only when Zephyr is configured to act as a bootloader and not for all bootloaders. I thought I will mention this incase it helps. |
Thanks for the context. I didn't understand the use case here. |
This does feel very arbitrary:
And given that using Zephyr AS the bootloader is a pretty specific edge case, this shouldn't be reserved by default in every case for Arm/Xtensa. I'm not the right person to sort this out since I don't know the various use cases, but @d3zd3z or @peter-mitsis or @bendiscz If you have suggestions, this should be updated to reflect that it's an exception not the rule with Arm/Xtensa, etc. |
@nordicjm @carlescufi Do you know of use cases for using Zephyr itself as the bootloader with Nordic customers? Struggling to understand the context for this, since I've normally only seen MCUBoot or a HW bootloader used with Zephyr, not Zephyr as bootloader. |
I'd suggest this should default to
Or:
|
Sorry for all the messages, but ... the mystery that is I'm going to flag this for review in the arch meeting since I don't know the context here, but we should sort it out. @quic-egmc I'm not sure this is still important to you, but can you give me some context on how you're hitting this issue? It seems like this should only be enabled if Doing a quick test with a random Arm board, I'm not seeing the 16KB being assigned: $ west build -p auto -b qemu_cortex_m0 samples/hello_world
...
Memory region Used Size Region Size %age Used
FLASH: 15518 B 256 KB 5.92%
RAM: 3936 B 16 KB 24.02%
IDT_LIST: 0 GB 2 KB 0.00% If you can give me a build target where EDIT: Some other useful context here, trying to clarify what this does: #6180 (comment) |
this is going a long ways back so will have to dig deep. I did a few experiments, namely to un-do our workaround which was to force CONFIG_BOOTLOADER_SRAM_SIZE=0 and I indeed see that our .config gets a default CONFIG_BOOTLOADER_SRAM_SIZE=16 even though we definitely not using Zephyr "as the bootloader". Since the units of this option are KB, this is pretty significant. Yes, CONFIG_ARM=y and CONFIG_XIP is not set. You could argue that either the default value should be zero or that the depends on !XIP clause should be removed. This statement in Kconfig.zephyr:
reaches an incorrect conclusion - just because somebody (or thing) is loading zephyr does not mean we want a reservation in the memory map. |
@quic-egmc Thanks for the reply, Eugene. I'll raise a PR tomorrow setting the default to 0, but I'd like to discuss the !XIP bit in the arch call to make sure I understand where this came from and why, and see how we can better document this. And also why it's only enabled for Arm and Xtensa. |
I'm struggling to get CONFIG_XIP not set upstream versus on our internal projects.... |
Ok I found a real example in-tree. Look at the board bcm958402m2_m7_defconfig. It disables XIP but does not override BOOTLOADER_SRAM_SIZE and in its .config it gets:
and the resulting RAM usage map shows the total RAM reduced by 16K, at 496KB:
now force CONFIG_BOOTLOADER_SRAM_SIZE to zero in boards/arm/bcm958402m2_m7/bcm958402m2_m7_defconfig and you instead see the total RAM size increased to 512KB:
this stems from boards/arm/bcm958402m2_m7/bcm958402m2_m7_defconfig: |
@quic-egmc I raised a PR setting the default to |
Not directly, but MCUboot is a Zephyr application. |
The Kconfig option BOOTLOADER_SRAM_SIZE defaults to reserving 16KB if XIP is not defined and, strangely, only on ARM or Xtensa architectures.
The description states:
This option specifies the amount of SRAM (measure in kB) reserved for a bootloader image, when either: - the Zephyr image itself is to act as the bootloader, or - Zephyr is a !XIP image, which implicitly assumes existence of a bootloader that loads the Zephyr !XIP image onto SRAM.
but the implicit assumption that we want to reserve space for a bootloader is not valid for many platforms. Please make this flag explicit or dependent on something obvious. This default behavior results in wasted space and is non-obvious!
The text was updated successfully, but these errors were encountered: