Hello,
Considering nRF5_SDK_14.2.0_17b948a.
In SDK documentation I can read that the steps to use the app_pwm library is to:
- instantiate a context with APP_PWM_INSTANCE
- call app_pwm_init to initialize the context
OK, now in APP_PWM_INSTANCE, the app_pwm_cb_t m_pwm_##name##_cb structure is just instantiated, not initialized. So what you get in the state field when compiling for release is just what the RAM contains there, am I wrong ?
Then in app_pwm_init there is this test close to the beginning of the function:
if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
so, you test something that has not been initialized.
My questions are the following:
- do you rely on the compiler generating some start-up code setting all static memory to zero before entering the main function ?
- does this mean that the APP_PWM_INSTANCE macro cannot be called within a function, like in a thread --- as that would be allocated in the stack, not in the static memory ? If so, I just notice that this constraint is not documented.
Vincent.