Topic : Variables at an absolute address

Forum : ARM

Original Post
Post Information Post
April 29, 2008 - 5:45pm
Guest

Hi,

I want to place a variable at an absolute address in RAM on an STR7xx. How can this be done?

regards,
Kris

Replies
Post Information Post
+1
0
-1
May 9, 2008 - 1:52pm
Guest

Hi

That's not very easy with GCC (much easier with the Raisonance proprietary compilers).

A first solution would be to define a specific section (as done for the interrupt vectors) and to relocate it in the ld file. You can specify the section with '_attribute_' in your source file.

A second solution would be to initialize a pointer with a constant address. This solution is used by the STRx libraries (see the 7xx_map .h file in RIDE\LIB\ARM\STRxx...). But in this case, the pointed object is not allocated, just accessed at an absolute address.

Matloub

+1
0
-1
May 9, 2008 - 2:40pm
Guest

Thanks,

I prefer to use the 'section' method, since the other solution seems to be intrinsically unsafe or I have exclude it from the memory map which will come down to the first solution.

BTW, can you point out the differences between de Raisonance propriatory compilers and the GCC. If you like you can use the mail adres signum at skynet.be for this purpose.

regards
Kris

+1
0
-1
May 9, 2008 - 6:20pm
Guest

Hi

If you take the case of our compiler for 8051 targets there is a directive "at" which allows to do this operation instead of using one of the two methods posted before.
But it is not the case with the compler gcc we use for ARM.

Best regards,
Matloub