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.

Placing SYS/BIOS code in RAM [TMS320F28035]

Other Parts Discussed in Thread: SYSBIOS

I need to place part of the SYS/BIOS code in RAM, for performance reasons. Especially the .knl package needs to be executed from there, because the flash on my C28x Piccolo is too slow.

I found this in the FAQ:

http://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs#3_Placing_SYS.2FBIOS_code_in_different_memory_segments

I modified it for the C2000 architecture:

SECTIONS
{
    .knl: { *.*(.text:*ti_sysbios_knl*) } > L03SARAM PAGE = 1
}

It works in so far that the code is executed from RAM, but: Because the code is only loaded to RAM by the debugger, I cannot run the controller without a debugger attached. Usually, on the C2000 one would mark a function with

#pragma CODE_SECTION(name, "ramfuncs");

and load it from flash to RAM at the beginning of the program. What do I have to do to achieve something similar with SYS/BIOS code?

Any help would be greatly appreciated!

Torben Frenzel

  • Torben,
    I am not sure if this is a part of the answer you are looking for, but the linked Wiki article does not deal with loading a section to one segment and then copying it to another at runtime. For that you would have to have something like this in your linker command file:
    SECTIONS {
        .knl: { *.*(.text:*ti_sysbios_knl*) } : LOAD = FLASH, RUN = L03SARAM PAGE = 1, LOAD_START(_KnlLoadStart), LOAD_END(_KnlLoadEnd), RUN_START(_KnlRunStart)
    }

    and then use the defined symbols to copy the sections. Unfortunately, Program.sectMap can't deal with anything but simple section allocations, so you will have to use your own linker command file. If you are using CCS, you already have a linker command file added to your project and you can make change in it. I

  • Sasha,

    thank you for your assistance. I already tried something like this and it failed to link. However, your suggestion showed me that I was on the right track, so I tried a little harder..

    The code builds fine when I put this under SECTIONS in my .cmd file:

    .knl: { *.*(.text:*ti_sysbios_knl*) } LOAD = FLASH PAGE = 0,
                                                              RUN = L03SARAM PAGE = 1,
                                                              LOAD_START(_KnlLoadStart),
                                                              LOAD_SIZE(_KnlLoadSize),
                                                              LOAD_END(_KnlLoadEnd),
                                                              RUN_START(_KnlRunStart)

    Notice the missing ' : ' before LOAD, it won't build if it is there.

    I am travelling today and won't have access to the hardware. I will try it tomorrow and if it works, I will mark this as a verified answer.

    Thanks

    Torben Frenzel

  • Sorry for taking so long to get back to this. I had other (not SYS/BIOS related) trouble with my software and only just got a chance to try this again.

    As I mentioned earlier, the code suggested by Sasha fails to link, but put me on the right track. With my slight modifications it works.

    The only thing left after this is to actually copy the code from flash to RAM, which has to happen in a 'First' function. The SYS/BIOS Manual describes how to implement a 'First' function in chapter 3.1 "SYS/BIOS Startup Sequence". To do the actual copying I use the MemCopy function from the C2000 examples.

    I hope this helps anybody who has a similar problem.

    Cheers

    Torben Frenzel