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.

LP-MSPM0G3507: LP-MSPM0G3507

Part Number: LP-MSPM0G3507


Hello, I have a question. Why does my program not work when I use the static keyword with pll_config_t and run it with optimization level O0? However, when I remove the static keyword, it works. Can you explain why this happens?

Best regards

  • Did your MCU run into default_handler?

    Could you debug to find the code/step MCU run away?

    I guess static keyword may force the format of the structure to be modified. Please check the register of SYSPLL.

  • The reason it didn't work is because I should never use static or global variables in SystemInit() as they are not initialized yet. It is possible that this problem does not exist at higher optimization levels. In my case, the code was already optimized at -O1 so that there was no direct memory access to the uninitialized variable.