Hi
I continue with my problems due to GCC optimizations, but now with somewhat weirder results. I have a circuit with a Kinetis MK66 microcontroller that communicates via serial port with a Raspberry. I work with MCUXpresso in C with the GCC compiler, if the source is not optimized everything works, the funny thing is optimizing depending on how it is connected, it works or stays stopped and also does not allow Raspberry to start.
These three possible situations are generated:
1.- With the Jlink programmer connected and powered, even if a Debug session is not started, everything always works with and without optimization.
2.- With the Jlink programmer connected but without power, nothing starts up, as if the Kinetis were in a continuous Reset (the Kinetis does have a supply voltage, of course).
3.- The Jlink programmer not connected, then only the circuit works without source optimization. As soon as it is optimized, something very strange happens, the Kinetis starts up but when it tries to communicate via serial port with the Raspberry, it stops and the Raspberry doesn't start.
For now the only thing I can think of is to put pullup resistors on the Reset, TX and RX line of the Kinetis. I have already defined the variables of the UART buffers as volatile, without any result. What surprises me the most is that the Raspberry does not start, I suppose it is because of the state of the TX and RX lines that the Kinetis handles.