Part Number: MSP432P4111
Tool/software: Code Composer Studio
Hello,
I'm writing code on msp432 with CCS 8.3.1.00004 and TI compiler v19.6.0 STS.
My application needs to fit in 4000hex size in flash so I have no other choice but using compiler optimization in order to reduce final size code.
Today I am encountering a weird issue. I need to make a LED blink, I quickly write a very simple code to do the job where I need it.
My issue : I does work when optimization is set to "off" at approximately 10Hz, with 10% duty cycle. But when I set for example, lv 0 register optimization, the frequency goes up to 50kHz, 50% duty cycle.
I tried to debug step by step and the software jump over the loop, I had some watches and I see something weird, two variables are mapped on the same register ! I put an instruction into the loop to be sure the optimization doesn't skip something, And the variable on the same register decrease together... I don't understand the situation, and my friend google too.
I succed to override the optimization for that specific function with #pragma and adding volatile to all variables. I don't like my workaround and it seems that my coworker have the same issue with a bigger software on the same MSP/compiler.
I make a big screenshot to show you what I said :
- the code vdBlinkRedLed() on the top right corner ;
- watches on top left ;
- the disassembly view with optimization on the left ;
- the disassembly view with my workaround on the right ;
Does anybody know what happened here ? thanks