This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using linker to place .text section for a specific file.

What is the best way to instruct the linker to place a section of specific file in a memory.  For example I would like to place the .text section of all compiled code in SDRAM, except for a single file where I would like the .text section for that file to reside in IRAM.  Is there a label which can be used to represent the .text section of a particular file?

Thanks!

  • I found some information on how to do this and the following solution seems to work:

    SECTIONS
    {  
        /* C standard sections */
        .boot_load  >       IRAM_BOOT
        .cinit      >       SDRAM
        .text       >       SDRAM
        .fasttext : {
            optDspRtns.obj(.text)
            }        >         IRAM_REST
        .stack      >       IRAM_REST
        .bss        >       IRAM_REST
        .const      >       IRAM_REST
        .data       >       SDRAM
        .far        >       IRAM_REST
        .switch     >       IRAM_REST
        .sysmem     >       IRAM_REST
        .tables     >       SDRAM
        .cio        >       SDRAM
        .pinit       >        IRAM_REST
    }

    where optDspRtns is the code to be run from internal RAM.