No BLE possible with CONFIG_NO_OPTIMIZATIONS=y for a nRF5340 project

Dear Support-Team,

 I have checked that now back and forth: When I add 

CONFIG_NO_OPTIMIZATIONS=y
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

in my prj.conf and build with sysbuild, flashing the merged_CPUNET.hex and merged.hex to the application core, the application hangs in bt_init().

When I remove these settings and build and flash everything again, the application starts.

Do you have an explanation for this?

Best regards

Stefan

Parents
  • You can reproduce that by using the nrf/samples/bluetooth/peripheral_cts_client sample, building it with "west build -p -b nrf5340dk/nrf5340/cpuapp/ns":
    The sample as it is works, when I add "CONFIG_NO_OPTIMIZATIONS=y" to the prj.conf the firmware will not return from

    "err = bt_enable(NULL);"

    For both cases I use "nrfutil device program --firmware nrf\samples\bluetooth\peripheral_cts_client\build\merged_CPUNET.hex --options verify=VERIFY_READ,chip_erase_mode=ERASE_CTRL_AP --core=network" and JLink and with the Cortex-M plugin for the application core

  • Hi,

    Is it a particular reason you are using no optimizations? If you use it for debugging, I would recommend using CONFIG_DEBUG_OPTIMIZATIONS=y instead. This use -Og instead of -O0, so it allows good debugging experience while still having the most important optimizations in place. (With no optimization you can expect more problems such as stack overflows etc in multiple threads, which then has to be adjusted. There may also be other problems.)

Reply
  • Hi,

    Is it a particular reason you are using no optimizations? If you use it for debugging, I would recommend using CONFIG_DEBUG_OPTIMIZATIONS=y instead. This use -Og instead of -O0, so it allows good debugging experience while still having the most important optimizations in place. (With no optimization you can expect more problems such as stack overflows etc in multiple threads, which then has to be adjusted. There may also be other problems.)

Children
Related