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.

Stack Pointer afer POR

What is the value in the SP and other registers after POR.

In the User guide it is written that user should set up the SP manually, but I cannot see this in the TI examples.

 

regards

g.

  • If the example is in c, the standard c-startup code does that (and other things) behind your back and before the example code has control of the CPU.

    If the example is in assembly, it should initialize SP. Alternatively, the code may not need to use SP at all.

  • hmmm, that's interesting.

    Can i find somewhere what else the C-startup does behind my back?

    I checked and in asm it is a SP init.

     

    thanks for answer

  • This is in the Run-Time Support Library for the device.  The MSP430 Optimizing C/C++ Compiler User's Guide (SLAU132) discusses the Run-Time Support library.  The source of the RTS library is available in the code generation tools for CCE in the lib directory.

  • The C Run-Time Support library is what does this and is called immediately from reset.  The MSP430 Optimizing C/C++ Compiler User's Guide (SLAU132) discusses the RTS library and the source for the RTS library is in the CCE code generation tools directory in lib.

  • Take a look at boot.c to see what is being done to initialize the C runtime environment. Basically it is initializing stack pointer and doing global variable initialization.

    Unzip the file rtssrc.zip in C:\Program Files\Texas Instruments\CC Essentials v3.1\tools\compiler\MSP430\lib, which will extract the runtime source files and you will find boot.c in there.

  • I do not use c, so I do not know much about this. But I think it depends on which tool-chain you are using. At least one of them did not hold the watchdog, nor kick it occasionally, while doing all these. And can cause a watchdog reset and start over and over and over ....

    Does CCE do that? Try something with a big initialized array of global variable.

**Attention** This is a public forum