I am new to GNU compiler.
I have C source code containing some structures and variables in which I need to place certain variables in certain places.
So, I wrote a script linker file and used C. to declare the variable in the source code. __ attribute__("SECTION")
I use the GNU compiler (cygwin) to compile the source code and create the .hex file using the parameter -objcopy, but I don't get how to link the script linker file at compilation to move the variables accordingly.
I am linking the script linker file and the C source file for the link.
Please help me link the script linker file to my source code by creating a .hex file using GNU.
MEMORY
{
base_table_ram : org = 0x00700000, len = 0x00000100
mem2 : org =0x00800200, len = 0x00000300
}
SECTIONS
{
BASE_TABLE : { } > base_table_ram
GROUP :
{
.text : { } { *(SEG_HEADER) }
.data : { } { *(SEG_HEADER) }
.bss : { } { *(SEG_HEADER) }
} > mem2
}
Source Code C:
const UINT8 un8_Offset_1 __attribute__((section("BASE_TABLE"))) = 0x1A;
const UINT8 un8_Offset_2 __attribute__((section("BASE_TABLE"))) = 0x2A;
const UINT8 un8_Offset_3 __attribute__((section("BASE_TABLE"))) = 0x3A;
const UINT8 un8_Offset_4 __attribute__((section("BASE_TABLE"))) = 0x4A;
const UINT8 un8_Offset_5 __attribute__((section("BASE_TABLE"))) = 0x5A;
const UINT8 un8_Offset_6 __attribute__((section("SEG_HEADER"))) = 0x6A;
, "BASE_TABLE" , script, "SEG_HEADER", script.
, .hex , , 0x00, linker script.
, script .
- script, - , .
,
SureshDN.