Code and data Placement Control by self-defind Section
declare in code via
- pragma
- @
- __attribute__ (GNU)
link control via xx.icf: ILINK Configuration File (链接配置文件)
Data Section
#pragma location = ".STCM" int flag u32 check_martix[] @ ".STCM" = { 0x04,0x05,0x08,0x09,0x0C,0x0D,0x10,0x11,0x18,0x19,0x1C,0x1D,0x24,0x17,0x1A,0x1B, 0x1E,0x1F,0x22,0x23,0x26,0x27,0x2A,0x2B,0x2E,0x2F,0x32,0x33,0x36,0x37,0x3A,0x3B, 0x3E,0x3F,0x42,0x43,0x46,0x47,0x4A,0x4B,0x4E,0x4F,0x52,0x53,0x56,0x57,0x5A,0x5B, 0x5E,0x5F,0x62,0x63,0x66,0x67,0x6A,0x6B,0x6E,0x6F,0x72,0x73,0x76,0x77,0x7A,0x7B, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, } ////////////////////////////////////////////////////////////////////////////////////////////// #pragma default_variable_attributes = @ ".STCM" u32 var1; u32 var2; u32 var3; #pragma default_variable_attributes = #pragma data(".STCM") u32 var1; u32 var2; u32 var3; #pragma data()
define a region for place above .STCM section
define region SHARE_DATA_region = mem:[from 0x0x18000 to 0x183ff];
place at start of SHARE_DATA_region { readonly section .STCM };
place in SHARE_DATA_region { readonly section .STCM };
Code Section
#pragma location = ".SlowCode" void func1() void func1() @ ".SlowCode" {BODY;} ///////////////////////////////////////////////////////// #pragma default_function_attributes = @ ".SlowCode" void func1() void func2() void func3() #pragma default_function_attributes =
#pragma code(".SlowCode") void func1() void func2() void func3() #pragma code()
define a region for place above .SlowCode section
define region SLOWCODE_region = mem:[from 0x08000000 to 0x08003FFF];
place in SLOWCODE_region { readonly section .SlowCode };