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.

TM4C1290NCPDT: run functions from ram

Part Number: TM4C1290NCPDT

Hallo,

can anyone provide the correct linker cmd file for .TI.ramfuncs or is this correct:

#ifdef __TI_COMPILER_VERSION__
   #if __TI_COMPILER_VERSION__ >= 15009000
    .TI.ramfunc : {} > SRAM
   #else
    ramfuncs    : > SRAM
   #endif
#endif

Thanks

Best regards

Steffen

  • Hi,

     I think you are using the directive as if TM4C129 is a RAM-based device. TM4C129 is a flash-based device so please reference to the TI Assembly Language Tools User's Guide https://www.ti.com/litv/SPNU118U for details. I have pasted the description below. 

    8.5.5.2.1 Example: Placing Functions in RAM
    The --ramfunc compiler option and ramfunc function attribute allow the compiler to specify that a function
    is to be placed in and executed from RAM. Most newer TI linker command files support the ramfunc
    option and function attribute by placing such functions in the .TI.ramfunc section. If you see a linker error
    related to this section, you should add the .TI.ramfunc section to your SECTIONS directive as follows. In
    these examples, RAM and FLASH are names of MEMORY regions for RAM and Flash memory; the
    names may be different in your linker command file.


    For RAM-based devices:
    .TI.ramfunc : {} > RAM


    For Flash-based devices:
    .TI.ramfunc : {} load=FLASH, run=RAM, table(BINIT)

    This below article will be also useful. If you still have question I will forward your question to our compiler/assembler tool experts.

    https://e2e.ti.com/blogs_/archives/b/toolsinsider/posts/helpful-tips-executing-code-from-ram

  • Hi Charles,

    thanks for the feedback. Your solution is not entirely correct. You have to add the binit section:

     .binit : {} > FLASH

    and the ram func section looks like that:

    .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)

    Then its working

    best regards

    Steffen

  • My complete linker cmd:

    /******************************************************************************
     *
     * Default Linker Command file for the Texas Instruments TM4C1290NCPDT
     *
     * This is derived from revision 15071 of the TivaWare Library.
     *
     *****************************************************************************/

    --retain=g_pfnVectors

    MEMORY
    {
        FLASH (RX) : origin = 0x00000000, length = 0x00100000
        SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    }

    /* The following command line options are set as part of the CCS project.    */
    /* If you are building using the command line, or for some reason want to    */
    /* define them here, you can uncomment and modify these lines as needed.     */
    /* If you are using CCS for building, it is probably better to make any such */
    /* modifications in your CCS project and leave this file alone.              */
    /*                                                                           */
    /* --heap_size=0                                                             */
    /* --stack_size=256                                                          */
    /* --library=rtsv7M4_T_le_eabi.lib                                           */

    /* Section allocation in memory */

    SECTIONS
    {
        .intvecs:   > 0x00000000
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .binit : {} > FLASH
        .init_array : > FLASH

        .vtable :   > 0x20000000
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM

        .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
    }

    __STACK_TOP = __stack + 512;