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.

the initialization question for f2812, calling "LB _c_init00"

If I run the programme in the H0 saram, I don't need to have an instruction " LB _c_init00". If I run the programme in the flash, it must be done. I think the init fuction is a must, reasons shown as below.

1) Sets up the stack
2) Processes the runtime initialization table and autoinitializes global
variables (when using the –c option)
3) Calls all global constructors (when using C++)
4) Calls main
5) Calls exit when main returns

Who can explain why I don't need to branch to _c_init00 while running the debug programme.

  • Sidney,

    The processor needs to run through the _c_init00 routine for the reasons you mentioned.  In the case of debugging from Code Composer Studio - CCS 3.3 will often do a "restart" operation and force the program counter to the "entry point" of the application.  By default, this is _c_init00 routine so you don't have to branch to it.  You can also change it using the -e linker option.    After you load the program, take a look at the PC location and see if it is at _c_init00.

    In the case of CCS 4.0 there is an option that will not only force the PC to this location but also do a "go main" which will execute up to the main() routine.

    Regards

    Lori