fixes to db update
This commit is contained in:
parent
e9d2d1bd25
commit
718dff1589
|
@ -86,7 +86,10 @@ app_err_t eth_db_lookup_erc20(erc20_desc_t* erc20) {
|
|||
app_err_t eth_db_update(fs_entry_t* entries, size_t len) {
|
||||
app_err_t err = fs_erase_all(_eth_db_match_all, NULL);
|
||||
|
||||
if (err != ERR_OK) {
|
||||
// since our matcher doesn't know when it has reached
|
||||
// completion, if everything went OK the error code
|
||||
// will be ERR_DATA on success.
|
||||
if (err != ERR_DATA) {
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
#include "common.h"
|
||||
|
||||
APP_ALIGNED(uint8_t g_mem_heap[MEM_HEAP_SIZE], 4);
|
||||
APP_ALIGNED(uint8_t g_flash_swap[HAL_FLASH_BLOCK_SIZE], 4);
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
#define _MEM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "hal.h"
|
||||
|
||||
#define MEM_HEAP_SIZE (64 * 1024)
|
||||
|
||||
extern uint8_t g_mem_heap[MEM_HEAP_SIZE];
|
||||
extern uint8_t g_flash_swap[HAL_FLASH_BLOCK_SIZE];
|
||||
|
||||
#endif
|
||||
|
|
|
@ -244,7 +244,7 @@ app_err_t fs_write(fs_entry_t* first_entry, size_t total_length) {
|
|||
}
|
||||
|
||||
app_err_t fs_erase(fs_entry_t* entry) {
|
||||
struct fs_erase_ctx erase_ctx = { .block = 0, .data = g_mem_heap, .predicate = _fs_erase_one, .ctx = entry, .err = ERR_OK, .stop = 0 };
|
||||
struct fs_erase_ctx erase_ctx = { .block = 0, .data = g_flash_swap, .predicate = _fs_erase_one, .ctx = entry, .err = ERR_OK, .stop = 0 };
|
||||
_fs_iterate_page((uint8_t*) HAL_FLASH_BLOCK_ADDR(HAL_FLASH_ADDR_TO_BLOCK((uint32_t)entry)), _fs_erase_entries, &erase_ctx);
|
||||
_fs_commit_block(&erase_ctx);
|
||||
|
||||
|
@ -256,7 +256,7 @@ app_err_t fs_erase_all(fs_predicate_t predicate, void* ctx) {
|
|||
return ERR_HW;
|
||||
}
|
||||
|
||||
struct fs_erase_ctx erase_ctx = { .block = 0, .data = g_mem_heap, .predicate = predicate, .ctx = ctx, .err = ERR_DATA, .stop = 0, .pending_erase = 0 };
|
||||
struct fs_erase_ctx erase_ctx = { .block = 0, .data = g_flash_swap, .predicate = predicate, .ctx = ctx, .err = ERR_DATA, .stop = 0, .pending_erase = 0 };
|
||||
_fs_iterate(_fs_erase_entries, &erase_ctx);
|
||||
_fs_commit_block(&erase_ctx);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "error.h"
|
||||
|
||||
#define UR_MAX_PART_COUNT 32
|
||||
#define UR_PART_DESC_COUNT (UR_MAX_PART_COUNT + 5)
|
||||
#define UR_PART_DESC_COUNT (UR_MAX_PART_COUNT + 10)
|
||||
|
||||
typedef enum {
|
||||
BYTES = 0,
|
||||
|
|
Loading…
Reference in New Issue