Skip to content
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

RFC: Remove CONFIG_BOOTLOADER_SRAM_SIZE #65121

Closed
nordicjm opened this issue Nov 13, 2023 · 4 comments · Fixed by #65156
Closed

RFC: Remove CONFIG_BOOTLOADER_SRAM_SIZE #65121

nordicjm opened this issue Nov 13, 2023 · 4 comments · Fixed by #65156
Labels
RFC Request For Comments: want input from the community

Comments

@nordicjm
Copy link
Collaborator

Introduction

This is an RFC to discuss potentially removing of the Kconfig BOOTLOADER_SRAM_SIZE symbol, why you might ask, read on to find out why:

Problem description

This symbol sounds like it's useful for non-XIP applications, so you can have your application set up then set this symbol to the amount of RAM that your bootloader uses and away you go, thinking it would offset the start of your image by the value given. This however, is not the case, this is the Cortex-M code for this Kconfig:

#if defined(CONFIG_XIP)  
#if defined(CONFIG_IS_BOOTLOADER)
#define RAM_SIZE (CONFIG_BOOTLOADER_SRAM_SIZE * 1K)
#define RAM_ADDR (CONFIG_SRAM_BASE_ADDRESS + \
        (CONFIG_SRAM_SIZE * 1K - RAM_SIZE))
#else
#define RAM_SIZE (CONFIG_SRAM_SIZE * 1K)
#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS
#endif
#else
#define RAM_SIZE (CONFIG_SRAM_SIZE * 1K - CONFIG_BOOTLOADER_SRAM_SIZE * 1K)
#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS
#endif

So from looking at it, I don't really see what the point of this symbol is, it adjusts the total RAM size of your application, but does nothing to the base SRAM address? If you assume that the bootloader uses 64KB of RAM (at the start address of RAM, as we do other partitions e.g. flash) then want to load your application after, you can't use this Kconfig, you have to play with the Kconfigs for the RAM base address and total RAM size.

Proposed change

Remove this Kconfig. Alternatively, change it so it applies to the start of RAM and affects both the address and size, instead of just the end size address.

Concerns and Unresolved Questions

Unknown is anyone using this Kconfig, whom that is I do not know. @GAnthony since you seem to use this symbol on cc3220sf, do you have any input on this? And why it adjusts the end address of RAM to the application, not the start address and total size?

@nordicjm nordicjm added the RFC Request For Comments: want input from the community label Nov 13, 2023
@Laczen
Copy link
Collaborator

Laczen commented Nov 13, 2023

@nordicjm, at first I was thinking that the code was wrong, but I think it is correct. It supposes the bootloader runs in xip, and assigns a ram region at the highest part to the bootloader.

@nordicjm
Copy link
Collaborator Author

@nordicjm, at first I was thinking that the code was wrong, but I think it is correct. It supposes the bootloader runs in xip, and assigns a ram region at the highest part to the bootloader.

Seems like moving to partitioning the RAM in dts would be a solution

@Laczen
Copy link
Collaborator

Laczen commented Nov 13, 2023

Why. there is no problem with the existing solution. The application is always setup to the start of the ram, only a modification is applied to the bootloader. It would even be possible to reclaim the bootloader ram if there is no application written to the bootloader (ram) part.

@nordicjm
Copy link
Collaborator Author

We use DTS for configuration, not Kconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments: want input from the community
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants