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.

Running from RAM on TMS570LS3137

Other Parts Discussed in Thread: TMS320F28335, TMS570LS3137, HALCOGEN

Hello,

I would like to run my program from RAM in order to achieve better performance. I found this thread where a workaround is proposed and it seems to work, but as its over 1 year old, referring to the previous CCS and its another modell I wanted to ask the following:

  • Is there any better method to do this now? Any script or something in CCS5?
  • Don't you provide a "copy from Flash to RAM routine" as you for example did for the TMS320F28335?
  • What aproximate range of performance gain could I expect?
  • If there is no simpler way, could I proceed in the same way as in the mentioned thread?

Thanks in advance and regards!

Martin

Edited: corrected link

  • Martin,

    The Linker can generate a copy table structure for you automatically and there is a function in the runtime support library that you can call to use the copy table to copy the section(s) in the copy table to RAM.  Please see section 7.8 Linker-Generated Copy Tables in the ARM Assembly Language Tools v5.0 manual (ti literature # SPNU118K).

    I couldn't see the other thread (issue with link) but the copy table I think is the simplest way and best supported by the toolchain.

    Performance gain will depend on the mix of code.. whether you have 32-bit instructions or 16-bit instructions in your critical loop, as well as the # of wait states (and therefore frequency) of operation.    I saw a gain of about 15% myself on one benchmark that was full of floating point (32-bit) opcodes in the critical loop; by moving this loop to flash.  But that's just one data point.   You usually won't get the full gain of running the code from zero-wait-state flash by copying to RAM because of program/data conflicts that are created when both are in RAM.

    Best Regards,

    -Anthony

    edit: Martin just saw you corrected the link and I skimmed through the thread.   That thread seems to be describing how to swap the complete RAM and Flash banks in the memory space.   The above method I'm suggesting is how you would still link your algorithm to be loaded into flash (so stored there between power cycles) but copied to RAM at runtime.  The rest of the program would remain in flash and the memory banks are not swapped that way.   I think that's probably what you want.

  • Thanks a lot for your fast, extensive and detailed response Anthony!

    During my current testing almost 100% of my code is the algorithm (except for the initializations of course) and it's computationally quite heavy (many nested loops) but not very large, so I wouldn't mind if all of it went to RAM. And I don't think it will get much more code later, as all the functional logic will run elsewhere.

    I will definitively try your solution, but this will probably later on as right now I'm having to focus on other issues :-)

    Beste regards!

    Martin

  • Sorry for the outsiders question. I'm using TMS570LS3137.
    Now I try to do same task as Martin.
    i.e. I want to run my program from RAM .
    I want to load .text section into ROM and run from RAM.
    I know that the method is described in ARM Assembly Language Tools(spnu118o) and need to edit linker command file.
    But I cannot understand. sorry...

    Now I use default linker command file generated by HALCoGen.

    MEMORY
    {
    VECTORS (X) : origin = 0x00000000, length = 0x00000020
    FLASH0 (RX) : origin = 0x00000020, length = 0x0017FFE0
    FLASH1 (RX) : origin = 0x00180000, length = 0x00180000
    STACKS (RW) : origin = 0x08000000, length = 0x00001500
    RAM (RW) : origin = 0x08001500, length = 0x0003EB00
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .system : {} > RAM
    }

    If anyone can, pls tell me concretely about editing linker command file.