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.

Should MSP430 linker --cinit_hold_wdt hold the watchdog around pinit as well as cinit

Other Parts Discussed in Thread: MSP430F5529

When MSP430 CGT v4.2.3 is used with the --cinit_hold_wdt set to ON the watchdog is held over the duration of cinit in the _auto_init_hold_wdt RTS function.

With a C++ application, with --cinit_hold_wdt set to ON, using std::cout the MSP430F5529 watchdog was firing during pinit, meaning main was never reached. To prevent the watchdog from firing had to add a _system_pre_init function to the project to disable the watchdog.

Is there reason why the _auto_init_hold_wdt RTS function can hold the watchdog over cinit, but not pinit?

  • Chester Gillon said:
    Is there reason why the _auto_init_hold_wdt RTS function can hold the watchdog over cinit, but not pinit?

    During cinit auto-initialization, all that occurs is C global variables are initialized by fairly straightforward code that comes directly from the RTS library supplied with the compiler.  The most likely reason the watchdog fires during cinit is that a lot of data is being copied.  During pinit auto-initialization, user supplied C++ constructors are called. These C++ routines can do anything.  Things are much less controlled.  As you've noted, you can overcome this built-in limitation by disabling the watchdog timer in the _system_pre_init function.

    Background and further details can be found in slides 32-35 of the MSP430 presentation on the compiler tips and tricks page.

    Thanks and regards,

    -George