5 #define ESP_PARTITION_MAGIC 0x50AA
6 #define PARTITION_TYPE_APP 0x00
7 #define PARTITION_APP_SUBTYPE_FACTORY 0x00
8 #define PARTITION_APP_SUBTYPE_OTA0 0x10
9 #define PARTITION_TYPE_DATA 0x01
10 #define PARTITION_DATA_SUBTYPE_SYSPARAM 0x40
11 #define ESP_PARTITION_TABLE_MAX_LEN 0x0C00
29 bool config_changed =
false;
30 uint8_t rom_count = 0;
35 SPIRead(PARTITION_TABLE_OFFSET +
offset, &info,
sizeof(info));
51 echof(
"Found '%s' @ 0x%08x, size 0x%08x, subtype 0x%02X\r\n", info.
name, info.
offset, info.
size, info.
subtype);
54 config_changed =
true;
56 if(index >= rom_count) {
57 rom_count = index + 1;
60 if(romconf->
count != rom_count) {
61 config_changed =
true;
62 romconf->
count = rom_count;
64 return config_changed;
67 #if defined(BOOT_GPIO_ENABLED) || defined(BOOT_GPIO_SKIP_ENABLED)
70 static void erase_sdk_config()
72 echof(
"Erasing SDK config partition.\r\n");
74 bool config_changed =
false;
75 uint8_t rom_count = 0;
80 if(
SPIRead(PARTITION_TABLE_OFFSET +
offset, &info,
sizeof(info)) != 0) {
91 while(sector_count-- != 0) {
static bool scan_partitions(rboot_config *romconf)
Definition: partition.h:27
#define PARTITION_TYPE_DATA
Definition: partition.h:9
#define PARTITION_DATA_SUBTYPE_SYSPARAM
Definition: partition.h:10
#define PARTITION_TYPE_APP
Definition: partition.h:6
#define PARTITION_APP_SUBTYPE_OTA0
Definition: partition.h:8
#define ESP_PARTITION_TABLE_MAX_LEN
Definition: partition.h:11
#define ESP_PARTITION_MAGIC
Definition: partition.h:5
#define PARTITION_APP_SUBTYPE_FACTORY
Definition: partition.h:7
uint32_t SPIRead(uint32_t addr, void *outptr, uint32_t len)
uint32_t SPIEraseSector(int)
#define MAX_ROMS
Definition: rboot.h:88
#define SECTOR_SIZE
Definition: rboot.h:65
Internal structure describing the binary layout of a partition table entry.
Definition: partition.h:16
uint16_t magic
Fixed value to identify valid entry, appears as 0xFFFF at end of table.
Definition: partition.h:17
char name[16]
Unique identifier for entry.
Definition: partition.h:22
uint32_t offset
Start offset.
Definition: partition.h:20
uint32_t size
Size of partition in bytes.
Definition: partition.h:21
uint32_t flags
Various option flags.
Definition: partition.h:23
uint8_t subtype
Sub-type for partition (interpretation dependent upon type)
Definition: partition.h:19
uint8_t type
Main type of partition.
Definition: partition.h:18
Structure containing rBoot configuration.
Definition: rboot.h:101
uint8_t count
Quantity of ROMs available to boot.
Definition: rboot.h:107
uint32_t roms[MAX_ROMS]
Flash addresses of each ROM.
Definition: rboot.h:109