|
发表于 2011-3-29 08:49:14
|
显示全部楼层
这个应该同编译器的编译链接脚本有关吧。
大概看了看KEIL下
Using __attribute__((section("name")))
Placing a code or data object in its own source file and then placing the object file sections uses standard coding techniques. However, you can also use __attribute__((section("name"))) and a scatter-loading description file to place named sections. Create a module, for example, adder.c and name a section explicitly as shown in Example 5.4.
Example 5.4. Naming a section
int variable __attribute__((section("foo"))) = 10;
Use a scatter-loading description file to specify where the named section is placed, see Example 5.5. If both code and data sections have the same name, the code section is placed first.
Example 5.5. Placing a section
FLASH 0x24000000 0x4000000
{
... ; rest of code
ADDER 0x08000000
{
adder.o (foo) ; select section foo from adder.o
}
}
Using __at sections to place sections at a specific address
A section can be given a special name that encodes the address at which it must be placed. The name can be specified as follows:
.ARM.__at_address
Where:
address
is the required address of the section. This can be specified in hexadecimal or decimal. Sections in the form of .ARM.__at_address are referred to by the abbreviation __at.
In the compiler, variables can be assigned to __at sections by either explicitly naming the section using the __attribute__((section(”name”))) or by using the attribute __at which sets up the name of the section for you. See Example 5.6.
Note |
|