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.

CCS/TMS570LS1224: Why does a function that runs in RAM fail to return to its original position after executing all the statements?

Part Number: TMS570LS1224

Tool/software: Code Composer Studio

As shown in the figure below, before the main function is initialized, I copy the Fun_test(2) function to the RAM area with the address 0x080014FC, and then when I step through the debugging, it actually jumps to 0x080014FC when I run to Fun_test(). Run, but after running all the statements of this function, it directly prompts "No source available for "0x8001538"". What I want to ask is why I don't jump back to where I originally called him.

1, start calling the function, the address of the PC pointer is 0x0000 7428 (in the flash area)

2. The program jumps to 0x080014FC to start the entry of the Fun_test(2) function. The screenshot below is the PC pointer when running to the last statement of Fun_test(2). I thought that after running the last code, the function would jump back to where it was originally called, but it went wrong, see Figure 3.

3. The program execution error, it seems that the prompt is not available code execution.

So, the problem is a function that copies from flash to RAM. Why does this function report an error when it finishes running, and it doesn't jump back to where it was originally called, and then how to solve this problem?

  • Sorry, it seems to be ok, I shielded _copyAPI2RAM_();, so that the actual program is not copied to RAM, but it can be entered during simulation (this is why?), the only effect is that it cannot jump Back to where was originally called? Then execute _copyAPI2RAM_(); then you can jump back to where you called it.

    Here is another question. Why can't the _copyAPI2RAM_() function be executed to jump to the execution function in RAM?
  • Hi BJ,

    Yes you can execute copy function in SRAM. I will provide a example later.
  • Hello BJ,

    I provided example in your another post.

    1. In c, put the function which will be executed in SDRAM or SRAM to a user defined section
    #pragma SET_CODE_SECTION(".blinky_section")
    void blinky()
    {
    int i;
    gioSetDirection(hetPORT1, 1);
    while(1)
    {
    gioToggleBit(hetPORT1, 0);
    for(i=0;i<1000000;i++);
    }
    }
    #pragma SET_CODE_SECTION()

    2. Linker CMD file
    - Add the follwing under MEMORY
    - SDRAM (RWX) : origin=0x80000000 length=0200000000
    - Add the follwing under SECTIONS
    - .blinky_section : RUN = SDRAM, LOAD = FLASH0 | FLASH1
    LOAD_START(BlinkyLoadStart), LOAD_END(BlinkyLoadEnd), LOAD_SIZE(BlinkySize),
    RUN_START(BlinkyStartAddr ), RUN_END(BlinkyEndAddr )

    After you load the project, the function blinky() will be placed in SDRAM and execute from SDRAM.