I am trying to load a symbol file at the time of linking. I am providing the symbol.txt file along with other libraries that I link. These are the two things I tried.
1st, I provided the symbol file exactly as what was the output of arm-none-eabi-nm, but this returned with a syntax error on line 1 itself.
2nd, I changed the format a bit. I added #< SYMDEFS >#
at the beginning of the file and made the changes to follow ARM's symdef file format. This gave me the error
file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status
Does anyone have any experience in loading symbol files to the linker (arm-none-eabi-ld)? If yes, please help me figure out what I am missing above.
The first few lines of my symbol file is as follows:
"#< SYMDEFS >#" ;There is no " here, I used it to remove the markup
0x00000000 A __heap_size
0x00000000 R __vect_table
0x00000000 R __vector_table
0x00000074 A ___data_size
I know that this format works with armlink.
If you're using the GNU linker, just create a file that looks something like this and include it on the linker command line:
__intstk_top__ = __syspage_base__ + 0x2000;
__abortstk_top__ = __syspage_base__ + 0x3000;
__undefinedstk_top__ = __syspage_base__ + 0x4000;
__svcstk_top__ = __syspage_base__ + 0x6000;
__sysstk_top__ = __syspage_base__ + 0x8000;
__boot_pgd__ = __syspage_base__ + 0x8000;
__boot_pgd_physical__ = __syspage_physical_base__ + 0x8000;
__boot_pte0__ = __syspage_base__ + 0xC000;
__boot_pte0_physical__ = __syspage_physical_base__ + 0xC000;
__boot_pte1__ = __syspage_base__ + 0xD000;
__boot_pte1_physical__ = __syspage_physical_base__ + 0xD000;
__syspage_physical_base__ = 0x48000000;
__syspage_base__ = 0x80000000;
__syspage_size__ = 0xE000;
__device_base__ = 0xC0000000;
__user_limit__ = 0x7FFFFFFF;
__virtual_offset__ = 0x80000000 - __syspage_physical_base__;
__dev_offset__ = 0xC0000000;
__mmu_enabled__ = 1;
__kernel_base__ = __syspage_base__;
As you can see, the symbols can be defined as constants or with simple expressions that can be resolved at link time.
User contributions licensed under CC BY-SA 3.0