Skip to content

arch/Kconfig: add boot memory configuration options - #19831

Open
Laczen wants to merge 1 commit into
apache:masterfrom
Laczen:improve_bootloader_support
Open

arch/Kconfig: add boot memory configuration options#19831
Laczen wants to merge 1 commit into
apache:masterfrom
Laczen:improve_bootloader_support

Conversation

@Laczen

@Laczen Laczen commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Add extra boot memory options to enforce the use of boot memory configuration options. This allows linker files to detect if they should prefer the specified boot memory options. This supports using boot memory config without breaking the existing defconfigs.

Add extra boot memory option to describe the size of an image header when a bootloader would need one.

When using the image header by a bootloader that is in nuttx-apps I would use the PREBUILD mechanism or a equivalent cmake mechanism to set the boot memory configuration and the image header size (using kconfig-tweak).

Impact

None, enabler for improving bootloader support.

Testing

tested on qemu-armv7a:nsh

...
user_main: Exiting
ostest_main: Exiting with status 0
nsh>

@github-actions github-actions Bot added the Size: S The size of the change in this PR is small label Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Comment thread arch/Kconfig
Set this option to enforce using the boot memory configuration if
supported by the linker script.

config FLASH_HEADER_SIZE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but no nuttx code reference these new macro?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, I wanted the OK to do it like that. I can add an example linker modification if wanted.

Add extra boot memory options to enforce the use of boot memory
configuration options. This allows linker files to detect if they
should prefer the specified boot memory options. This supports
using boot memory config without breaking the existing defconfigs.

Add extra boot memory option to describe the size of an image header
when a bootloader would need one.

Add a sample modification for the linker script of nucleo-f411re

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
@Laczen
Laczen force-pushed the improve_bootloader_support branch from 6667445 to 5eb024d Compare August 13, 2026 15:14
@Laczen
Laczen requested a review from raiden00pl as a code owner August 13, 2026 15:14
*/

#include <nuttx/config.h>
#ifdef CONFIG_USE_BOOT_MEMORY_CONFIG

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not always use CONFIG_FLASH_xxx option

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this would break existing defconfigs (many don't have valid CONFIG_FLASH_START).

It is possible to do some simple validity check insteads of using the CONFIG_USE_BOOT_MEMORY_CONFIG. But I am unsure if a simple check would be sufficient.

@Laczen

Laczen commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

It might be possible to avoid any additional Kconfig: depending on the meaning of "CONFIG_FLASH_START". If this is considered to be the nuttx FLASH_START it should not care if there is a image header or not. It would be the responsability of the user to take into account a header that is added to the image.

This would be logic, but it might be contradictory to the definition of board_boot_image() which takes a header size as argument.

@xiaoxiang781216, @raiden00pl what do you think is the correct interpretation of CONFIG_FLASH_START?

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Laczen this is a new feature, so to avoid "Another Hidden Feature of NuttX", please document it, i.e. here: https://nuttx.apache.org/docs/latest/implementation/index.html

@Laczen

Laczen commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@Laczen this is a new feature, so to avoid "Another Hidden Feature of NuttX", please document it, i.e. here: https://nuttx.apache.org/docs/latest/implementation/index.html

Let us first agree on what the current meaning of the properties are in NuttX, it might be that this new feature is not needed anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: arm Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants