#define BOOT_VERISON "0.8"...#pragma push#pragma section data_type const_type ".boot_version" ".boot_version" data_mode=far_absunsigned char boot_version_string[]=BOOT_VERSION;unsigned long dummy_try=0x55AA55AA;#pragma pop
MEMORY { ram : org = 0xFFF70000, len = 0x00020000 //data en ram externe rom : org = 0x00000000, len = 0x000FDFFE //Code en flash interne boot_info : org = 0x000FFFF0, len = 0x0000000F // Bootloader version}FORCEACTIVE{boot_version_string, dummy_try } SECTIONS { ...
//.boot_version (CONST) BIND(0x000FFFF0): {} > boot_info .boot_info: { *(.boot_version) }>boot_info
...
}
-lcf $(IRFDIR)5xx_Axiom_ROM_winidea.lcf -L$(CMPDIR)PowerPC_EABI_Support\MSL\MSL_C\PPC_EABI\Lib -fp hard -o $(OUTPUTDIR)$(OUTPUTFILE) -nostdlib -big -proc 56x -g -romaddr 0x00000000 -map debug.map @obj_list.txt -sdata2 2
The "boot_version_string" is locate in .sdata
I previously tried with this source file extract (and the same .lcf) :
#pragma push//#pragma readonly_strings//#pragma options(no_conststringconv)//#pragma const_strings on#pragma force_active on#pragma section const_type ".boot_version"__declspec(section ".boot_version") const UINT8 boot_version_string[]=BOOT_VERSION;#pragma section const_type#pragma force_active reset#pragma pop
This way, "boot_version_string" is well located in .boot_info section, but debug.map show that linker has put the variable elswhere in flash and try to copy it at c_init into the desired location (which is obviously not possible, and not what is expected)
Now, If I remove the -romaddr 0x000000 from command line tool, the "boot_version_string" is located at the chosen address 0x000FFFF0 (I verified with ICD probe), but I don't have .data section initialized anymore (all is linked without considering it is a rom image ?). Obvously, nothing works correctly wihtout .data initialization.
I have tried many things... But still can't manage to locate my string into a specific flash area.
Any idea ?
Thanks.
Code:#define BOOT_VERISON "0.8"...#pragma push#pragma section sconst_type const_type ".boot_version" ".boot_version" data_mode=far_absconst unsigned char boot_version_string[]=BOOT_VERSION;const unsigned long dummy_try=0x55AA55AA;#pragma pop
Memory map: Starting Size File ROM RAM Buffer address Offset Address Address .reset 00000000 00003224 00000380 00000000 02800000 .init 00003224 00000828 000035a4 00003224 02803224 .text 00004000 000295ec 00003dd0 00004000 02804000 .rodata 0002d5f0 00001810 0002d3c0 0002d5f0 0282d5f0 .ctors 0002ee00 00000008 0002ebd0 0002ee00 0282ee00 .dtors 0002ee08 00000008 0002ebd8 0002ee08 0282ee08 extab 0002ee10 00000888 0002ebe0 0002ee10 0282ee10 extabindex 0002f698 00000cfc 0002f468 0002f698 0282f698 .boot_info 000ffff0 00000008 00030164 00030394 02830394...
MEMORY { ram : org = 0xFFF70000, len = 0x00020000 //data en ram externe rom : org = 0x00000000, len = 0x000FDFFE //Code en flash interne boot_info : org = 0x000FFFF0, len = 0x0000000F // Bootloader version } FORCEACTIVE{boot_version_string, dummy_try } SECTIONS { ... .boot_version LOAD(0x000FFFF0): {} > boot_info
...
}