Answer | To do so with gcc, a specific section must be created using the linker flags. Here is an example on how to proceed to place a string variable at address 0x80010000: Declare the variable specifying location in .testloc section: const char string[] __attribute__ ((section (".testloc"))) = "String at fixed address";
To create section in linker option: In AVR32 Studio:-
Open the project properties: highlight the project name and press Alt+Enter.
-
Select the C/C++ Build / Settings category.
-
Select the Tool Settings tab.
-
Expand the AVR32/GNU Linker and highlight the miscellaneous item.
-
In the Linker Flags field add the -Wl,-section-start=.testloc=0x80010000 option.
-
Refer also to the attached screen shot (new-section.png).
In Atmel Studio 6.x:-
Open the Project Properties (Solution Explorer -> Right click on the project -> Properties).
-
Select ‘Toolchain -> AVR32/GNU Linker -> Miscellaneous’.
-
Add ‘-Wl,-section-start=.testloc=0x80010000‘ in ‘Linker Flags’.
-
Refer to the snap shot ‘new-section-AS6’ attached.
Note:-
Section can also be created in the respective device linker script files.
-
Example illustrating the same is available in Atmel Software Framework (also in Atmel Studio 6.x).
-
In Atmel Studio 6.x : File -> New -> Example Project from ASF -> FLASH/ FLASHCDW Example
-
In ASF: asf-3.x\avr32\drivers\flash [or] flashcdw
-
AVR32795: Using the GNU Linker Scripts on AVR UC3 Devices can also be useful a reference to understand the GCC linker scripts.
|
|
---|