Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Optimization level cause to crash.

I am new to Segger Embedded Studio, I do a test on ble_app_template demo on nRFSDK_v16.0.0 on nRF52840 with S140. There are two configurations of the project, namely Debug and

Release. In Debug configuration, things go well. In Release configuraion,  application crash and show log below:

<info> app_timer: RTC: initialized.
<error> app: Fatal error
<warning> app: System reset

The reason is that sd_ble_gap_ppcp_set() return NRF_ERROR_INVALID_PARAM inside gap_params_init() function. When I change Release configuration to optimization level 0, it works well.

So it is the optimization level that cause the crash. Anyone know why?

Best regards!

Young

Related