Added a couple more debug statements
This commit is contained in:
parent
16f611358b
commit
c772ea043d
2 changed files with 10 additions and 3 deletions
|
@ -1,18 +1,22 @@
|
|||
#ifndef _SYSPARAM_H_
|
||||
#define _SYSPARAM_H_
|
||||
|
||||
#include <esp/types.h>
|
||||
|
||||
/** @file sysparam.h
|
||||
*
|
||||
* Read/write "system parameters" to persistent flash.
|
||||
*
|
||||
* System parameters are stored as key/value pairs. Keys are string values
|
||||
* between 1 and 255 characters long. Values can be any data up to 255 bytes
|
||||
* in length (but are most commonly also strings).
|
||||
* in length (but are most commonly also text strings). Up to 126 key/value
|
||||
* pairs can be stored at a time.
|
||||
*
|
||||
* Keys and values are stored in flash using a progressive list structure
|
||||
* which allows space-efficient storage and minimizes flash erase cycles,
|
||||
* improving write speed and increasing the lifespan of the flash memory.
|
||||
*/
|
||||
|
||||
#include <esp/types.h>
|
||||
|
||||
#ifndef SYSPARAM_REGION_SECTORS
|
||||
/** Number of (4K) sectors that make up a sysparam region. Total sysparam data
|
||||
* cannot be larger than this. Note that the full sysparam area is two
|
||||
|
|
|
@ -577,6 +577,7 @@ sysparam_status_t sysparam_set_data(const char *key, const uint8_t *value, size_
|
|||
|
||||
if (!value) value_len = 0;
|
||||
|
||||
debug(1, "updating value for '%s' (%d bytes)", key, value_len);
|
||||
if (value_len && ((intptr_t)value & 0x3)) {
|
||||
// The passed value isn't word-aligned. This will be a problem later
|
||||
// when calling `sdk_spi_flash_write`, so make a word-aligned copy.
|
||||
|
@ -709,6 +710,8 @@ sysparam_status_t sysparam_set_data(const char *key, const uint8_t *value, size_
|
|||
_sysparam_info.end_addr = write_ctx.addr;
|
||||
}
|
||||
|
||||
debug(1, "new addr is 0x%08x (%d bytes remaining)", _sysparam_info.end_addr, _sysparam_info.cur_base + _sysparam_info.region_size - _sysparam_info.end_addr - 4);
|
||||
|
||||
// Delete old value (if present) by setting it's id to 0x00
|
||||
if (old_value_addr) {
|
||||
status = _delete_entry(old_value_addr);
|
||||
|
|
Loading…
Reference in a new issue