Sometimes when I run my TI-RTOS based application, I don't get to main(). Can you please explain what happens with a TI-RTOS based application before main() and how to debug the issue?
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.
Sometimes when I run my TI-RTOS based application, I don't get to main(). Can you please explain what happens with a TI-RTOS based application before main() and how to debug the issue?
Here is the standard boot sequence without TI-RTOS:
When the device is released from reset, the reset vector initiates C runtime initialization at the _c_int00() entry point. One of the first steps is to initialize the system stack pointer. This same stack is used during initial booting, as well as in and after main().
Once the .cinit and table of .pinit functions has been processed, the main() function is called. If there are arguments to pass to main() (depending upon the application build options), the args_main() function is used to call main(). At this point, the C runtime environment has been fully initialized, and the application can begin its intended purpose.
The kernel has several points where it adds items into the boot sequence.
The application can plug-in the “user” reset function as follows in the .cfg file.
var Startup = xdc.useModule('xdc.runtime.Startup'); Startup.resetFxn = "&foo";
Note: the application must supply the reset function in their code (e.g. “foo”).
You can look in ROV->Startup and see the user reset function.
Note: it’s best to assume nothing has happened before your reset function is called. So no cinit, heap, etc. For some devices, the stack may not have been setup either (so no local variables).
These are not used often, but for completeness here are examples of plugging the first and last functions in the .cfg file:
var Startup = xdc.useModule('xdc.runtime.Startup'); Startup.firstFxns.$add("&myFirst"); Startup.lastFxns.$add("&myLast");
You can see the new first and last functions in ROV also. Note: you may have to hover over the fields to see the full list.
If you are having problems getting to main here are some pointers
Please refer to http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_20_04_68/exports/docs/rtscpedia/Using_xdc.runtime_Startup/Using_xdc.runtime_Startup.html#Boot_Sequence_and_Control_Points for more details.