sysparam: always create the semaphore on init.

Otherwise when initialization was not successful it may fail with an
assertion in FreeRTOS rather than returning SYSPARAM_ERR_NOINIT.
This commit is contained in:
Our Air Quality 2018-06-05 22:21:35 +10:00
parent 93d43d7825
commit 090db8da5e

View file

@ -505,6 +505,8 @@ sysparam_status_t sysparam_init(uint32_t base_addr, uint32_t top_addr) {
struct sysparam_context ctx; struct sysparam_context ctx;
uint16_t num_sectors; uint16_t num_sectors;
_sysparam_info.sem = xSemaphoreCreateMutex();
// Make sure we're starting at the beginning of the sector // Make sure we're starting at the beginning of the sector
base_addr -= (base_addr % sdk_flashchip.sector_size); base_addr -= (base_addr % sdk_flashchip.sector_size);
@ -584,8 +586,6 @@ sysparam_status_t sysparam_init(uint32_t base_addr, uint32_t top_addr) {
_sysparam_info.end_addr = ctx.addr; _sysparam_info.end_addr = ctx.addr;
} }
_sysparam_info.sem = xSemaphoreCreateMutex();
return SYSPARAM_OK; return SYSPARAM_OK;
} }