newt: Allow third linker script to maximize split image size #414
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.
This resolves a limitation of the split image build process, allowing for larger builds.
Prior to this change, the split build process worked like so:
That doesn't use the split image setup to its full potential, though. The regular linker script needs to enforce that the resulting image fits inside the provided flash area, but in the case of the build in step 1, this flash area is less than what is actually available, as it counts the various symbols that will be re-linked and eliminated from the image in step 4. That artificially limits the size of the app to its own code, plus the shared code, minus any non-overlapping code in the loader image. In reality, it has (almost) the entirely of both flash areas to play with, as long as the portion shared with the loader doesn't overflow in step 2, and it doesn't overstep the various needs of the boot loader (though existing scripts don't account for that as it stands).
This PR changes step 1 to use an optional third linker script specified by "bsp.wholeapplinkerscript". This allows a bsp to specify an initial app linker script that allows the full use of both image slots; in the absence of such a script, it falls back on existing behavior. The resulting app image may not be workable if too much of it consists of dependencies on loader code, but that will be revealed later by a failure in step 3.
It also changes the name of the setting in step 4 to "bsp.splitapplinkerscript", which is more accurate and implies the connection between the two settings ("bsp.part2linkerscript" was misleading anyway, as technically that was stage 3 of the linking process). It maintains backwards compatibility with existing bsp.yml files that still use "bsp.part2linkerscript", but in the presence of both, prefers "bsp.splitapplinkerscript".