Context: Embedded project, STM32H7, GCC Arm V9, using PPP to communicate with
a ublox Nina W152 WiFi module. Lwip V2.1.2.
We have the need to build our code size optimised (-Os). We use a debug build
(Og) and a release build with Os. We have had very robust and reliable
communications on debug build. Unfortunately since building a release build,
the PPP connection to the module seemed unstable and erratic and
communications was unreliable.
After several days of debugging it was traced down to a single function
vj_uncompress_tcp in vj.c. By disabling size optimisation of just this
function (leaving it at Og). communications is excellent. Compiling this
function with Os breaks communication. This is completely repeatable.
I have not delved into exactly what happens inside this function causing it to
become an issue.
To fix the problem (when the entire project is built with Os):