Fix incorrect maximum RAM and flash size in NRF board.jsons #765
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Every NRF52 board json file has maximum_ram_size set incorrectly, and a couple of them have maximum_size (flash size) set incorrectly. It's not super important, as it's only used by the platformio size-checker to create the output for the build log and to stop you uploading a firmware above what you have set in maximum_size.
This PR solves that, and brings the RAK board.json in tree so that we can fix it too.
Note that neither maximum_ram_size/maximum_size settings will stop the firmware actually getting built. The linker will throw an error and stop if you exceed the limits set in the linker scripts, but those limits are not the same as what is set in the board.json files.
nrf52840_s140_v*.ld defines maximum RAM as
LENGTH = 0x20040000 - 0x20006000
in nrf52840_s140_v*.ld, minus another 2kb for the stack as seen in nrf_common.ld:This leaves us with 235520 bytes of RAM allowed by the linker.
You can confirm this by forcing a RAM usage increase with a big array, and once RAM usage gets past 235520 bytes the linker will choke:
arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 537128960 bytes