Topics

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?

Thanks

Abderrezak


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.

Christopher Friedt
 


Hi Ab,

On Wed., Jan. 15, 2020, 12:54 p.m. Abderrezak Mekkaoui, <ab.mekka@...> wrote:
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.

Have you tried using CONFIG_NO_OPTIMIZATIONS=y ? I've found that will achieve the same ends as explicitly changing CMakeLists.txt to use -O0.

Abderrezak Mekkaoui <ab.mekka@...>
 

Thanks Chris.
That works. And using zephyr_cc_option(-O0) with CONFIG_NO_OPTIMIZATIONS=y  does not cause any trouble.
Still seems strange that other program do not seem to bother!

Kind regards

Abder

On 1/15/2020 1:12 PM, Christopher Friedt wrote:

Hi Ab,

On Wed., Jan. 15, 2020, 12:54 p.m. Abderrezak Mekkaoui, <ab.mekka@...> wrote:
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.

Have you tried using CONFIG_NO_OPTIMIZATIONS=y ? I've found that will achieve the same ends as explicitly changing CMakeLists.txt to use -O0.