This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Code loaded from SD and executed in the heap.

Hi all,

I am using an NXP LPC2478 with a 16MB external ram that i use as a heap (malloc and free functions)

my intent is to produce code that i can load from SD and execute in the heap.
so, i think :), i have to use Position Indipendent Code.

this code is able to call code in ROM (use of --symdefs to produce a linking file)
this code must have at least one function that i can call from ROM (use of +FIRST)
this code has RW and ZI data, so it needs a sort of initialization
this code has to be loaded from SD and executed in the heap in a runtime known position

this is my scatter load file:

LR_ROM 0xA0000000 PI {
        ER_RO +0  {
                *.o (+RO +RW +ZI)
        }
}

the problems are:

PROBLEM1
If i try to put my function as first...

LR_ROM 0xA0000000 PI {
        ER_RO +0  {
                *.o (LOADERFIRST, +First)
                *.o (+RO +RW +ZI)
        }
}

...i receive this error from linker:
Error: L6942E: Execution Region ER_RO contains multiple +FIRST, sections:

PROBLEM2
Linker create __main function and Region$$Table to initialize RW and ZI data
how can i manage this functions in a PI world?

thank you.