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

How to link extension code to existing ROM code?

My application has most of its code in ROM. However, the functionality can be extended with code in RAM. The RAM can be switched between CODE and XDATA. For extensions, the RAM is switched into XDATA memory, the code is loaded into RAM and then switched back to CODE memory.
The code extensions are in separate directories/files. I compile the ROM as well as the extension code and link them together like this:

    BL51 {all object files} TO {target} \ 
    CODE(0 - 0x5FFF, ?PR?*?EXTENSIONS(0x8000)) \ 
    XDATA(0 - 0x0EFF, ?XD?*?EXTENSIONS(0x0F00)) \ 
    RAMSIZE(256) NOOVERLAY


As you can see I have dedicated areas for the ROM code and the extension code (as well as XDATA). From the resulting hex-file I extract the code for the RAM area.

This works fine so far. However, sometimes I get a bunch of linker errors ERROR 107 (ADDRESS SPACE OVERFLOW), although I didn't change anything in the ROM part of the code. And I'm not out of space. Somehow this depends on the number of local variables and initializations I do in the extension functions; yet I couldn't figure out the root cause.

1. Can somebody explain what exactly is going on there?
2. Is there a more elegant way to approach the linking of the extension code?