The DATA_SECTION pragma
allocates space for the symbol in a section called section
name. The syntax for the pragma in C is:
#pragma DATA_SECTION (symbol, "section name");
The syntax for the pragma in C++ is:
#pragma DATA_SECTION ( "section name");
The DATA_SECTION pragma is useful if you have data objects that you
want to link into an area separate from the .bss section.
This directive is illustrated in the following example.
Using the DATA_SECTION Pragma
a) C source file
#pragma DATA_SECTION(bufferB, "my_sect")
char bufferA[512];
char bufferB[512]:
//
执行完此三条语句之后,数组bufferB被分配到段名为
"my_sect"的自定义段中
b) C++ source file
char bufferA[512];
#pragma DATA_SECTION("my_sect")
char bufferB[512];
c) Assembly source