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.

How to program the code into RAM

Dear TI,

As my know, TMS570 running the  program on FLASH(default setting).

However, I want to test the CPU performance difference between Flash and RAM.

Could you explain how to program the code into RAM step by step?

Thanks a lot.

Fan

  • If RAM is configured to address 0x0 in your test program, you can first select "scripts " from CCS top manu bar. You will see options to put RAM to address 0x0. Then you can just load your code as normal.

    Thanks and regards,

    Zhaohong
  • Dear Zhaohong,

    Thanks a lot for your reply.

    But after I try your method, I still can't achieve my request. There are some problems.

    1. I configured the RAM to 0x0, but it will conflict with VECTOR and FLASH0. How do I continue to modify the other two space?

    2. In script , I can't find any options that you describe.

    3. For memory map, could we configure the address of RAM to 0x0? As my know, even we modify the cmd.file, we still must follow memory map's definition.

  • Do you want to run everything from RAM or only a portion of your code? If you want to everything from from the RAM, you will need to put all sections into RAM. If you only run a portion of your code, you need to define two sections: a load address in flash where the code is saved and a run address in RAM where the code will be executed. Before execution you will need to copy the opcodes from load address to the run address.

    Thanks and regards,

    Zhaohong
  • Dear Zhaohong,

    Thanks your reply.

    Do you want to run everything from RAM or only a portion of your code?

    I plan to run everything from RAM, because I want to test the performance difference between RAM and Flash.

     

    you will need to put all sections into RAM.

    For your reply, I modify the .cmd file to be as follows. After programming into code, it appeared No source available for "0xc."

    Could you help to solve this problem? Also, I attached my project.8032.20150408programRAM.rar

    SECTIONS
    {
        .intvecs : {} > RAM
        .text    : {} > RAM
        .const   : {} > RAM
        .cinit   : {} > RAM
        .pinit   : {} > RAM
        .bss     : {} > RAM
        .data    : {} > RAM
        .sysmem  : {} > RAM
      
    }

     

     

    a load address in flash where the code is saved and a run address in RAM where the code will be executed. Before execution you will need to copy the opcodes from load address to the run address.

    Could you explain more detail for this section? I don't know how to operate it. Could you provide any example code or material?

    In addition, could you explain my questions of previous post.

    1. If I modify the address of RAM to 0x0, how do I continue to modify the other space.

    2. Why I can't find any options in script  that you describe.

    3. If we modify the .cmd file, should we still must follow the definition of memory map?

    Please help to solve. Thanks more.

     

  • Shunfan,

    I took a look at the project you sent. To make it work by remapping RAM to address 0x0, there will be too many changes in the startup codes. If your goal is to compare the the execution of a function in RAM to compare with Flash, a better option is to just execute this function in RAM. I am attaching a link command file to illustrate this method.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/312/4331.-lnk16_5F00_flash_5F00_device.cmd

    In this example, we want to execute a function in the source file efuse_power_ashwin_bk.c from RAM. to do so, we defined a section EFUSE_LOAD in Flash, and a section EFUSE_RUN  in RAM.    We also defined the load and run addresses for the functions in efuse_power_ashwin_bk.c:  load= EFUSE_LOAD run=EFUSE_RUN. The code will be in the Flash image in the EFUSE_LOAD  section. In the beginning of main(), you need to copy the content from EFUSE_LOAD to the EFUSE_RUN section in RAM. When you call those functions. They will be executed from RAM.

    Thanks and regards,

    Zhaohong