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

External flash programming

I'm programming an XC161 with internal flash memory at 0xC00000..0xC1FFFF and external flash at 0x400000..0xBFFFF (only 0xBB0000..0xBFFFFF 256K is used for program/data - the rest is for a flash file system).

Currently when the code is linked, it starts linking to the external memory at 0xBB0000. I presume because the address of the external memory is lower than the internal memory.

I want the code/data to be loaded into the internal flash memory where possible but if/when the code/data can't fit into the 128K internal flash I want it to be stored in the external flash.

Is there simple* way to specify that all code/data should be linked to the internal flash memory unless it can't fit, which case it should go into the external flash memory.

* By simple, I mean without hardcoding addresses (in the linker) of where to link each source module.

Regards
Paul

Parents
  • I'm not sure if this issue can be solved as simple as requested. We had a similar configuration and used the following approach:

    - We seperated our code into "frequently called" and "less frequently called".

    - The former went to the internal flash and

    - for the latter we introduced a code class, e.g. named ECODE. In the corresponding sources (we used a memory model with far code) we put

    #pragma RENAMECLASS(FCODE=ECODE)
    

    - For the locator, we just specified

    ECODE (0x400000-0x44FFFF)
    

    So there is only one address hardcoded.

Reply
  • I'm not sure if this issue can be solved as simple as requested. We had a similar configuration and used the following approach:

    - We seperated our code into "frequently called" and "less frequently called".

    - The former went to the internal flash and

    - for the latter we introduced a code class, e.g. named ECODE. In the corresponding sources (we used a memory model with far code) we put

    #pragma RENAMECLASS(FCODE=ECODE)
    

    - For the locator, we just specified

    ECODE (0x400000-0x44FFFF)
    

    So there is only one address hardcoded.

Children