Topics

zephyr_cc_option(-O0) issue in 1.14.99 (nrf52840)

Abderrezak Mekkaoui <ab.mekka@...>
 

Hi Chris and All,

I replied too quickly. CONFIG_NO_OPTIMIZATIONS=y  only delays the point at which the program hangs.
In my case it starts by displaying data and BLE advertising as expected, but crashes when a BLE connection is attempted.
It still runs as expected if
zephyr_cc_option(-O0)  and CONFIG_NO_OPTIMIZATIONS=y are not used. The zephyr sample
peripheral_esp  behaves the same way.

This is a queer behavior. Any hint is most welcome.

kind regards

Abder

build command:

>west build -b nrf52840_pca10056 src -- -G"Eclipse CDT4 - Ninja" -DCMAKE_ECLIPSE_NINJA_ARGUMENTS=-j100 -DCMAKE_ECLIPSE_VERSION=4.7

original description of the issue:

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?

On 1/15/2020 1:46 PM, Abderrezak Mekkaoui wrote:

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.

pawel.dunaj@...
 

Hi,

I suggest checking the stack sizes. CONFIG_NO_OPTIMIZATIONS is sometimes used to decide which size to apply. Stack overflow could cause strange issues.
You can enlarge stacks enable stack analysis and see how much you need.

Regards,