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.

TMS570LS3137: Linker command file for RAM execution

Part Number: TMS570LS3137

Where can I find a linker command file for the TMS570LS3137 that causes code execution to occur from RAM and not Flash?

  • Hi Steven,

    Please refer to the cmd file used in bootloader. The bootloader copies the F021 plash API to RAM and execute APIs from RAM instead of Flash.

    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x0005EB00 //LS04x and RM42 Flash size is 0x60000
    SRAM (RW) : origin=0x08002000 length=0x00006000 //LS04x and RM42 SRAM size is 0x8000
    STACK (RW) : origin=0x08000000 length=0x00002000
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    Fapi_UserDefinedFunctions.obj (.text)
    bl_flash.obj (.text)
    --library= ..\..\..\lib\F021_API_CortexR4_BE.lib (.text)
    } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

    .text > FLASH0
    .const > FLASH0
    .cinit > FLASH0
    .pinit > FLASH0
    .data > SRAM
    .bss > SRAM
    }
  • Thank you for your response.  I had seen this previously as well.  Is there an example that copies ALL of the .text from flash to RAM, and not just the bootloader and FAPI portions? 

    I am trying to write a reprogrammer that executes from RAM.  This reprogrammer calls functions that call functions that call functions, etc.  These lower-level functions are used by both the reprogrammer and the application (non-reprogrammer) part of the code.  I first attempted to copy to RAM only the functions that I needed, but then I kept uncovering other functions (some in the processor library code) that would also need to be copied.  Instead of trying to figure out which functions to copy and which ones I don't need to copy, I was wanting to try just copying everything.  Is there a way to do this?

  • Hello Steven,

    You can use the scripts in CCS to swap flash and RAM.

  • What scripts?  How do I find information about these scripts?

  • Hi Steven,

    Please refer to discussion in this thread:

    e2e.ti.com/.../533475 swap#533475

  • This did not resolve my issue. I'm not looking for how to debug from CCS using RAM. I'm looking for how to get the system at runtime to copy all of the code from FLASH to RAM.
  • Hello Steven,

    You can copy some objects to SRAM and execute the code from SRAM:

    1. To create an output section named test1 which is composed of the input sections inside {... ... }. The test1 is allocated to FLASH0 for loading, and allocated to SRAM0 for running. When the program is loaded, test1 is in the FLASH0 memory range. During running sys_startup.c which runs in FLASH0, it copies output section test1 from FLASH0 to SRAM. Note this copy is not done automatically.

    1. allocate the output sections (test1) to flash and SRAM

    /*----------------------------------------------------------------------------*/

    /* Section Configuration                                                      */

    SECTIONS

    {

       .intvecs : {} > VECTORS

       test1:

       {

          sys_main.obj (.text)

          sys_selftest.obj (.text)

          sys_vim.obj (.text)

          system.obj (.text)

          pinmux.obj (.text)

          esm.obj (.text)

          rti.obj (.text)

          errata_SSWF021_45.obj (.text)

          gio.obj (.text)

          sys_core.obj (.text)

          sys_pmu.obj (.text)

          notification.obj (.text)

       } load = FLASH0, run = RAM, LOAD_START(loadStart), RUN_START(runStart), SIZE(codeSize)

       .text    : {} > FLASH0

       .const   : {} > FLASH0

       .cinit   : {} > FLASH0

       .pinit   : {} > FLASH0

       .bss     : {} > RAM

       .data    : {} > RAM

       .sysmem  : {} > RAM

    /* USER CODE BEGIN (4) */

    /* USER CODE END */

    }

    2. Copy the output section test1 to SRAM using _copyAPI2RAM_()

    3. Please find the code of _copyAPI2RAM_() in TI CAN bootloader

  • BTW, you can't execute all the code (for example sys_intvecs.asm) in SRAM.