Removed the extra dereference of __top_of_ram in the GNU ARMv8-A low-level initialization, so _tx_initialize_unused_memory now holds the first free address instead of garbage - #726
Open
fdesbiens wants to merge 1 commit into
Conversation
…level initialization, so _tx_initialize_unused_memory now holds the first free address instead of garbage __top_of_ram is a linker-defined symbol whose address is the value of interest, so LDR x1, =__top_of_ram already loads the top of RAM. The following LDR x1, [x1] read whatever happened to be stored there and handed that garbage to _tx_initialize_unused_memory. The Arm Compiler ports are not affected: they load a literal .quad that holds the address, so the dereference is correct there. The SMP GNU ports already had the correct form; this aligns the remaining GNU ports with them. Assisted-by: Copilot (Opus 5) <noreply@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #435.
__top_of_ramis defined in the linker script as__top_of_ram = .;, so it is a linker-defined symbol whose address is the value of interest.LDR x1, =__top_of_ramtherefore already loads the top of RAM intox1. TheLDR x1, [x1]that followed dereferenced that address and read whatever happened to be stored at the top of RAM, so_tx_initialize_unused_memorywas set to garbage. The startup code in the same example builds gets this right:ldr x5, =__top_of_ramwith no dereference.The Arm Compiler ports are not affected. They load
zi_limit/heap_limit, which are literal pool entries declared as.quad (Image$$TOP_OF_RAM$$Base), so the extra dereference is correct there. The GNU ports appear to have inherited the instruction sequence without adjusting it for the different symbol.The SMP GNU ports already have the correct form, which is what the fixed ports now match. This change removes the offending instruction from the 13 non-SMP GNU Cortex-A ports, from the ARMv8-A architecture source they are generated from, and from the two Cortex-A35 module example builds. That is every remaining occurrence in the tree.
scripts/check_ports.shpasses. ThegnuCI job assembles the AArch64 ports with the Arm GNU toolchain, so the change is build-verified there. It has not been run on hardware.