Question

I am developing small hello world app for Freescale iMX6 board, that will run from On-chip RAM. I am able to run the complete code from OCRAM but if I modify the linker script to generate a data section in external DDR ram's memory space, the output binary file suddenly increases in size from 114 KB to 259 MB. It works just fine if that section is created in OCRAM. It is surely related to linking but I cannot find the reason and how to avoid it. Below are selected portions from the linker script:

`MEMORY
{
    OCRAM (rwx) : ORIGIN = 0x00900000, LENGTH = 256K
    DDR (rwx)   : ORIGIN = 0x10000000, LENGTH = 2048M
}`

.
.
.
.ex_ram (ORIGIN(DDR)) : { . = . + 0x10; } > DDR

Looks like something related to huge gap between the OCRAM and DDR ram address space to me, but can't rectify it!

Was it helpful?

Solution

of course it does, you asked it to convert the file to a binary right? So even if you have only a single byte of data in the data segment you need to have (0x10000000-0x00900000)+(amount of data) bytes in the .bin file...the raw binary file format does not have any address information therefore it needs to cover all loadable segments and pad with fill in between, so you get that size of a file (0x10000000-0x00900000)+(amount of data). Do an experiment and change your 0x10000000 to 0x20000000 and you will see a file more than twice the size.

If you use elf or coff or intel hex or srec or some binary format that includes addresses as well as data and does not require padding between the segments in the file, then your files wills stay small...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top