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.

TMS320F280049: Combining codestart.asm into source file

Part Number: TMS320F280049

Hi team,

I have noticed some of my customer is combining codestart.asm into their source file like this:

This is a .cpp source file where a few functions is defined and no main() is included. In MainSwitch() function, they check the data in a certain flash address to determine whether to execute the flash operation. In the end of the function, they use the LB command to jump to the starting address of app code.

My question is: Regarding these code is in a .cpp source code, why the asm command can be executed at the beginning? And if the PC jump to mainswitch() and then to app code. The asm("LB _c_int00") will not be executed at all. So how is the C environment established?

This is not the first time I noticed this operation, could you help to explain the internal principle?

Regards,

Brian

  • Hi Brian,

    You may need to look at the linker command file to check if the code sections codestart, normalfuncs are allocated in the contiguous memory locations or not. Typically on a power-on reset, the BootROM branches to a known location and the codestart section is placed in this known location. codestart section typically contains LB _c_int00.
    In the snapshot you shared, I assume the branch statements to MainSwitch and c_int00 function are placed at different memory locations and the BootROM or some other init code branches to these locations based on some parameters.

    Regards,
    Veena