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.

TMS320F28377S: F28377S: Moving ".text" segment to RAM

Part Number: TMS320F28377S

Hi,

at the start of the flash-program the code is copied to RAM (c_int00 -> main, copy code to RAM -> code running in RAM).

.TI.ramfunc : {} LOAD = FLASH, RUN = RAM, PAGE = 0, ALIGN(4)
{ "../lib/C28_DSP_FPU_Lib/lib/c28x_fpu_dsp_library.lib"
  "../lib/flash_api/lib/F021_API_F2837xS_FPU32.lib"
  "../lib/C28_FPU_FastRTS/lib/rts2800_fpu32_fast_supplement_coff.lib"
  module1.obj (.text)
  module2.obj (.text)
  module3.obj (.text)
}

That's common practice. And the ".text"-segment is located in the flash, so that c_int00 and main will execute from flash. Everything is fine.

But now I need to execute every ".text"-function from RAM, except some real flash functions for startup: c_int00, main and so on . Hence, even the (hidden) functions like FS$$DIV and so on will be in the RAM. Of course, I can locate the ".text" to LOAD = FLASH, RUN = RAM, but if I do so, everything will be in the RAM and startup will get impossible.

How can I say to the linker that some functions (especially C-lib-functions) should execute from flash? Is there a tutorial for a (nearly) 100% RAM-program which is stored in the flash?

Thanks!
Edwin

  • Hi,

    If you want to keep the entire .text in RAM, it is possible. Instead of taking the symbols and doing memory in the main, you can use the BINIT section to do that copy during the boot time instead

    .text :  LOAD = FLASH, RUN = RAM, TABLE(BINIT)

    .binit :> FLASH

    For more details :

    https://www.ti.com/lit/ug/spru513q/spru513q.pdf

    Regards,

    Veena

  • Hi,

    I tried, but somehow I got a problem: Which function does the binit (DO_BINIT in the boot28.asm) copy? The c_int00 is located in the .text segment ... and when the boot loader calls c_int00 the uC hangs, because the c_int00 was not copied to the RAM. Somehow complicated ...

    How can I solve this problem?

    Note: Since I am working with c2000 (late 2002, TMX320F2812, eval board, hence, from the beginning) I always copied the needed functions to RAM by self written code.

    Best regards,
    Edwin

  • The binit is done as part of Boot flow, which is before cinit. There could be some RTS functions that may not work with LOAD/RUN and the boot flow might be different in the debug environment.

    Hence it is better to move out those functions to Flash itself. The other .text section can be run from RAM


    .text : LOAD >> FLASH
    RUN >> RAM
    TABLE(BINIT)
    ALIGN(8)

    flashText {
    rts*(.text)
    led_ex1_blinky.obj (.text:main)
    <device>_codestartbranch.obj(.text)
    } >FLASH, ALIGN(8)

    .binit : > FLASH, ALIGN(8)

    Regards,

    Veena