Custom linker placement file leads to large binary output file
I am using CrossWorks studio with an LPC4350. It has 2 internal SRAM sections, section one is 64K and section 2 is 32K. I am writing an Ethernet firmware loader. The goal is to transfer a binary build file and use the SPIFI library to write that file to flash, and then boot from it.
I am almost done, but I ran out of SRAM memory, so I decided to import the linker placement file, and move a few sections around since only one of the SRAMs was full.
I am now able to run from SRAM, and transfer my file into SDRAM, but my binary output file went from being 64K to 520K! Has anyone ran into anything like this before? I only have 100K of SRAM memory and somehow the binary is 520K, it has a giant section of 0's in the middle of it.
Here is my linker placement file:
<!DOCTYPE Linker_Placement_File>
<Root name="SRAM Section Placement">
<MemorySegment name="SRAM1">
<ProgramSection load="Yes" name=".vectors"/>
<ProgramSection alignment="4" load="Yes" name=".fast"/>
<ProgramSection alignment="4" load="Yes" name=".init"/>
<ProgramSection alignment="4" load="Yes" name=".text"/>
<ProgramSection alignment="4" load="Yes" name=".dtors"/>
<ProgramSection alignment="4" load="Yes" name=".ctors"/>
</MemorySegment>
<MemorySegment name="SRAM2">
<ProgramSection alignment="4" load="Yes" name=".data"/>
<ProgramSection alignment="4" load="Yes" name=".rodata"/>
<ProgramSection alignment="4" load="Yes" name=".constdata"/>
<ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end"/>
<ProgramSection alignment="4" load="No" name=".bss"/>
<ProgramSection alignment="4" load="No" name=".non_init"/>
<ProgramSection name=".heap" load="No" alignment="4" size="__HEAPSIZE__"/>
<ProgramSection name=".stack" load="No" alignment="4" size="__STACKSIZE__"/>
<ProgramSection name=".stack_irq" load="No" alignment="4" size="__STACKSIZE_IRQ__"/>
<ProgramSection name=".stack_fiq" load="No" alignment="4" size="__STACKSIZE_FIQ__"/>
<ProgramSection name=".stack_svc" load="No" alignment="4" size="__STACKSIZE_SVC__"/>
<ProgramSection name=".stack_abt" load="No" alignment="4" size="__STACKSIZE_ABT__"/>
<ProgramSection name=".stack_und" load="No" alignment="4" size="__STACKSIZE_UND__"/>
<ProgramSection name=".tbss" load="No" alignment="4"/>
<ProgramSection name=".tdata" load="Yes" alignment="4"/>
</MemorySegment>
</Root>
Any suggestions would be greatly appreciated.
Thanks,
Bun
-
When I move my constant data into SRAM1 then the image goes back down to 56 k
<!DOCTYPE Linker_Placement_File>
<Root name="SRAM Section Placement">
<MemorySegment name="SRAM1">
<ProgramSection load="Yes" name=".vectors"/>
<ProgramSection alignment="4" load="Yes" name=".fast"/>
<ProgramSection alignment="4" load="Yes" name=".init"/>
<ProgramSection alignment="4" load="Yes" name=".text"/>
<ProgramSection alignment="4" load="Yes" name=".dtors"/>
<ProgramSection alignment="4" load="Yes" name=".ctors"/>
<ProgramSection alignment="4" load="Yes" name=".data"/>
<ProgramSection alignment="4" load="Yes" name=".rodata"/>
<ProgramSection alignment="4" load="Yes" name=".constdata"/>
<ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end"/>
</MemorySegment>
<MemorySegment name="SRAM2">
<ProgramSection alignment="4" load="No" name=".bss"/>
<ProgramSection alignment="4" load="No" name=".non_init"/>
<ProgramSection name=".heap" load="No" alignment="4" size="__HEAPSIZE__"/>
<ProgramSection name=".stack" load="No" alignment="4" size="__STACKSIZE__"/>
<ProgramSection name=".stack_irq" load="No" alignment="4" size="__STACKSIZE_IRQ__"/>
<ProgramSection name=".stack_fiq" load="No" alignment="4" size="__STACKSIZE_FIQ__"/>
<ProgramSection name=".stack_svc" load="No" alignment="4" size="__STACKSIZE_SVC__"/>
<ProgramSection name=".stack_abt" load="No" alignment="4" size="__STACKSIZE_ABT__"/>
<ProgramSection name=".stack_und" load="No" alignment="4" size="__STACKSIZE_UND__"/>
<ProgramSection name=".tbss" load="No" alignment="4"/>
<ProgramSection name=".tdata" load="Yes" alignment="4"/>
</MemorySegment>
</Root> -
Raw binary (.bin) files have no address information, therefore if there is a gap between memory segments the gap will need to be included in the binary file in order to get from one segment to the other. If you use an file format that has address information (i.e. elf, srec, hex, etc), you shouldn't have this problem.
Regards,
Jon
Please sign in to leave a comment.
Comments
3 comments