Hi,
I have a few sets of assembly files and source files which I need to link. Is there a way to define a symbol in scatter file that can be accessed in assembly file. The assembly file that I have is in gnu syntax(since armclang v6.7 supports gnu syntax).
Is it possible to have a symbol defined in scatter file that can be accessed in gnu assembly file.
Regards.
Hi Paul..
I want to use a macro defined in scatter file in assembly file
Lets have an example of defining a stack region in scatter file:
#define STACK_START 0x400000000
LR_1 {
....
STACK STACK_START EMPTY -0x1000 {}
...
}
Is it possible to somehow use STACK_START in assembly file.
I think I can use the linker generated symbol for stack. Am i correct?
OK, looks like you're initialising your stack using an address calculated in a scatter file? You should be able to import that definition using the IMPORT command.
Let me know how that goes for you,
Paul.
For ARM linker, load regions and execute regions are named slightly differently - it'll be specified in this case as Load$$LR$$STACK_START$$Base and Load$$LR$$STACK_START$$Length and Load$$LR$$STACK_START$$Limit so those would be the symbols you need to import in the assembly file.
This is a little different if you're used to gcc and GNU binutils where the ld script can insert arbitrarily named symbols at any address within the image. You have less control here although it better conforms with the definitions of the scatter file:
https://developer.arm.com/docs/dui0474/latest/accessing-and-managing-symbols-with-armlink/region-related-symbols
Since these names are rather hideous to use, the best way to use them is to pick the ones you want and rename them using a steering file
.. although assemblers should be happy with $$ in the name, and you can even make variable aliases in C to them to give them nicer names, which also gives a nice route for compatibility between ARM and GNU linkers (alias Load$$/Image$$/etc. when using ARM Compiler and don't need to on GNU).
Ta,
Matt