三种方法,举例如下:
1.需要修改icf文件。
#pragma location ="ConstSection1"
__root __no_int char RELEASEDATE[16] @"ConstSection1";
在icf文件中增加下面
place at address mem:0x08001000 { readonly section ConstSection1 };
注意:icf中需要有';'结尾;
2.
__root __no_init char RELEASEDATE[16] @0x08010000;
3.
#pragma location =0x08010000
__root __no_init char
RELEASEDATE[16];
#if 1
#pragma location= "ConstSection1"
__root const unsigned int test = 0xaabb;
#pragma location= "ConstSection2"
__root const unsigned int test1 = 0xccdd;
#endif
#pragma location=0x9ff0
__root const unsigned int test[] = {0xaa,0xbb,0xcc};
__root const unsigned int test1 @0x9ff8 = 0xaabc;