SDK 9.0, examples/ble_peripheral/ble_app_hrs
Trying to use DFU with a bond device, I got aware, that after the update, some "static" data seems to get corrupted during startup.
I found in main.c, app_context_load:
static uint32_t context_data;
dm_application_context_t context;
context.len = sizeof(context_data);
context.p_data = (uint8_t *)&context_data;
err_code = dm_application_context_get(p_handle, &context);
and in dm_application_context_get:
err_code = pstorage_load(p_context->p_data,
&block_handle,
DEVICE_MANAGER_APP_CONTEXT_SIZE,
(APP_CONTEXT_STORAGE_OFFSET + sizeof(uint32_t)));
Though DEVICE_MANAGER_APP_CONTEXT_SIZE is set to 16 in config/device_manager_cnfg.h
Fixing DEVICE_MANAGER_APP_CONTEXT_SIZE to 4 (or enlarging the context_data) makes the startup after update working.
So my question: must the context data match exactly the size defined in DEVICE_MANAGER_APP_CONTEXT_SIZE, or should dm_application_context_get obey the given size in context.len?