zephyr_cc_option(-O0) issue in 1.14.99

Abderrezak Mekkaoui <ab.mekka@...>

Hi All,

I had a program than ran with no problems in 1.13. But would crash in 1.14.99 if  zephyr_cc_option(-O0) is present in the CMakeLists.txt file.
The program is based on the peripheral_esp sample. The peripheral_esp sample itself has the same problem: builds and runs if zephyr_cc_option(-O0)
is not present and would crash if it is present. Strangely it does not have any problem with zephyr_cc_option(-On) n=1,2 or 3.
Other programs, not using Bluetooth, have no problem with this option.
Any hints on what I might be doing wrong?



Output of peripheral_esp sample when build with zephyr_cc_option(-O0):

***** Booting Zephyr OS build zephyr-v1.14.0-2216-g3da2985b2837 *****
Bluetooth initialized
Advertising successfully started
***** USAGE FAULT *****
  Illegal load of EXC_RETURN into PC
***** Hardware exception *****
Current thread ID = 0x20000048
Faulting instruction address = 0x20001e28
Fatal fault in thread 0x20000048! Aborting.

Join devel@lists.zephyrproject.org to automatically receive all group messages.