zephyr: CONFIG_BOOTLOADER_SRAM_SIZE should not be defined by default

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!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (15 by maintainers)

Most upvoted comments

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:

CONFIG_BOOTLOADER_SRAM_SIZE=16

and the resulting RAM usage map shows the total RAM reduced by 16K, at 496KB:

Memory region         Used Size  Region Size  %age Used
           FLASH:          0 GB         0 GB
             RAM:       24596 B       496 KB      4.84%
        IDT_LIST:          0 GB         2 KB      0.00%

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:

Memory region         Used Size  Region Size  %age Used
           FLASH:          0 GB         0 GB
             RAM:       24596 B       512 KB      4.69%
        IDT_LIST:          0 GB         2 KB      0.00%

this stems from boards/arm/bcm958402m2_m7/bcm958402m2_m7_defconfig: #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K - CONFIG_BOOTLOADER_SRAM_SIZE * 1K)