Datasheet

ARM Compiler Reference
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 3-5
Where
name
is the name to use for the section and
sort_type
is one of:
code
rwdata
rodata
zidata
.
If
sort_type
is specified but
name
is not, the section name for
sort_type
is
reset to the default value. Enter
#pragma arm section
on its own to restore
the names of all object sections to their defaults. See Example 3-1.
Example 3-1 Section naming
int x1 = 5; // in .data (default)
int y1[100]; // in .bss (default)
int const z1[3] = {1,2,3}; // in .constdata (default)
#pragma arm section rwdata = "foo", rodata = "bar"
int x2 = 5; // in foo (data part of region)
int y2[100]; // in .bss
int const z2[3] = {1,2,3}; // in bar
char *s2 = "abc"; // s2 in foo, "abc" in bar
#pragma arm section rodata
int x3 = 5; // in foo
int y3[100]; // in .bss
int const z3[3] = {1,2,3}; // in .constdata
char *s3 = "abc"; // s3 in foo, "abc" in .constdata
#pragma arm section code = "foo"
int add1(int x) // in foo (code part of region)
{
return x+1;
}
#pragma arm section code
Use a scatter-loading description file with the linker to control placing a named section
at a particular address in memory (see the ADS Linker and Utilities Guide).