I am using an nrf51822 DK with a (so far) very simple code along:
main()
{
//... init I/O
run();
}
Inside run:
run()
{
uint32_t retval = NRF_SUCCESS;
// nrf_gpio_* calls to set up some GPIOs...
// Set up UART...
// VALUE_SIZE >2
snprintf(value, VALUE_SIZE, "%s", "TI");
// Initial states.
foo = WAIT_NOTHING;
return retval;
}
Now if I run the code I never get to 'foo = WAIT_NOTHING'. But if I comment the snprintf line I can get to the last statement.
If I step-debug after snprintf gets called the cursor goes back to the nrf_gpio_* calls.
EDIT: after some trial and error I figured out that if I use snprintf in a debug build (-O0 -g3) code will do what's described above. If I set a release build (-O3) the code works, but I can no longer debug the rest of the code... So, what am I missing here?
Notes: I am using jlink 6.12.5, SDK v10.0.0,