Forum : ST7/STM8
Post Information | Post |
---|---|
June 29, 2012 - 10:42pm
|
Hi All, I am looking into how the linker handles memory relocation and have a few questions. First some background is needed: I have looked through the linker manual and see that it mentions memory relocation and custom relocation order, but this only seems to allow you to control the order that the objects are placed in that the data or code sections, not allow the definition of two separate spaces inside the code and data sections. How would we best achieve what I am describing? Thanks. |
Hi,
The relocation directives such as CODE or DATA allow to set the order of the routines or data blocks, but first of all the set the address you want them to be.
This is described in 5.3 Absolute relocation in the ST7/STM8 Linker Manual.
You can group all routines from a C file using regular expressions.
To set the code of the Towers example at 0x9500:
CODE(%\?PR\?\?.*TOWERS(09500h))
% indicates that regular expressions are in use.
The ? must be escaped with \
.* matches zero or more characters.
Use DATA directive to set addresses in data.
Regards,
Stéphane