Fix write & read to flash partition.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-04-09 19:58:33 +02:00
parent 1ba109bd0a
commit ab1b245f4f
3 changed files with 19 additions and 6 deletions

View File

@@ -22,7 +22,11 @@
#if defined(ENABLE_EMULATION) || defined(ESP_PLATFORM)
#define XIP_BASE 0
#define FLASH_SECTOR_SIZE 4096
#ifdef ESP_PLATFORM
#define PICO_FLASH_SIZE_BYTES (1 * 1024 * 1024)
#else
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
#endif
#else
#include "pico/stdlib.h"
#include "hardware/flash.h"
@@ -38,7 +42,11 @@
* | |
* ------------------------------------------------------
*/
#ifdef ESP_PLATFORM
#define FLASH_TARGET_OFFSET 0
#else
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES >> 1) // DATA starts at the mid of flash
#endif
#define FLASH_DATA_HEADER_SIZE (sizeof(uintptr_t) + sizeof(uint32_t))
#define FLASH_PERMANENT_REGION (4 * FLASH_SECTOR_SIZE) // 4 sectors (16kb) of permanent memory