diff --git a/components/modules/wifi_sta.c b/components/modules/wifi_sta.c index 4c675b0a..29504a76 100644 --- a/components/modules/wifi_sta.c +++ b/components/modules/wifi_sta.c @@ -179,10 +179,10 @@ static void on_scan_done (const system_event_t *evt) if (!lua_isnoneornil (L, -1)) { uint16_t num_ap = 0; - esp_err_t err = esp_wifi_get_ap_num (&num_ap); - wifi_ap_list_t *aps = luaM_malloc (L, num_ap * sizeof (wifi_ap_list_t)); + esp_err_t err = esp_wifi_scan_get_ap_num (&num_ap); + wifi_ap_record_t *aps = luaM_malloc (L, num_ap * sizeof (wifi_ap_record_t)); if ((err == ESP_OK) && (aps) && - (err = esp_wifi_get_ap_list (&num_ap, aps)) == ESP_OK) + (err = esp_wifi_scan_get_ap_records (&num_ap, aps)) == ESP_OK) { lua_pushnil (L); // no error diff --git a/components/platform/flash_api.c b/components/platform/flash_api.c index 94ae68d6..c9814308 100644 --- a/components/platform/flash_api.c +++ b/components/platform/flash_api.c @@ -9,13 +9,13 @@ #include #include "rom/spi_flash.h" -#include "../../bootloader/src/main/bootloader_config.h" +#include "esp_flash_data_types.h" #define FLASH_HDR_ADDR 0x1000 -static inline struct flash_hdr flash_load_rom_header (void) +static inline esp_image_header_t flash_load_rom_header (void) { - struct flash_hdr hdr; + esp_image_header_t hdr; if (ESP_OK != spi_flash_read (FLASH_HDR_ADDR, (uint32_t *)&hdr, sizeof (hdr))) { @@ -79,11 +79,11 @@ uint32_t flash_rom_get_size_byte(void) switch (flash_load_rom_header ().spi_size) { default: // Unknown flash size, fall back mode. - case SPI_SIZE_1MB: flash_size = FLASH_SIZE_1MBYTE; break; - case SPI_SIZE_2MB: flash_size = FLASH_SIZE_2MBYTE; break; - case SPI_SIZE_4MB: flash_size = FLASH_SIZE_4MBYTE; break; - case SPI_SIZE_8MB: flash_size = FLASH_SIZE_8MBYTE; break; - case SPI_SIZE_16MB: flash_size = FLASH_SIZE_16MBYTE; break; + case ESP_IMAGE_FLASH_SIZE_1MB: flash_size = FLASH_SIZE_1MBYTE; break; + case ESP_IMAGE_FLASH_SIZE_2MB: flash_size = FLASH_SIZE_2MBYTE; break; + case ESP_IMAGE_FLASH_SIZE_4MB: flash_size = FLASH_SIZE_4MBYTE; break; + case ESP_IMAGE_FLASH_SIZE_8MB: flash_size = FLASH_SIZE_8MBYTE; break; + case ESP_IMAGE_FLASH_SIZE_16MB: flash_size = FLASH_SIZE_16MBYTE; break; } } return flash_size; @@ -95,7 +95,7 @@ static bool flash_rom_set_size_type(uint8_t size_code) // Reboot required!!! // If you don't know what you're doing, your nodemcu may turn into stone ... NODE_DBG("\nBEGIN SET FLASH HEADER\n"); - struct flash_hdr *hdr = (struct flash_hdr *)malloc (SPI_FLASH_SEC_SIZE); + esp_image_header_t *hdr = (esp_image_header_t *)malloc (SPI_FLASH_SEC_SIZE); if (!hdr) return false; @@ -125,11 +125,11 @@ bool flash_rom_set_size_byte(uint32_t size) uint8_t size_code = 0; switch (size) { - case FLASH_SIZE_1MBYTE: size_code = SPI_SIZE_1MB; break; - case FLASH_SIZE_2MBYTE: size_code = SPI_SIZE_2MB; break; - case FLASH_SIZE_4MBYTE: size_code = SPI_SIZE_4MB; break; - case FLASH_SIZE_8MBYTE: size_code = SPI_SIZE_8MB; break; - case FLASH_SIZE_16MBYTE: size_code = SPI_SIZE_16MB; break; + case FLASH_SIZE_1MBYTE: size_code = ESP_IMAGE_FLASH_SIZE_1MB; break; + case FLASH_SIZE_2MBYTE: size_code = ESP_IMAGE_FLASH_SIZE_2MB; break; + case FLASH_SIZE_4MBYTE: size_code = ESP_IMAGE_FLASH_SIZE_4MB; break; + case FLASH_SIZE_8MBYTE: size_code = ESP_IMAGE_FLASH_SIZE_8MB; break; + case FLASH_SIZE_16MBYTE: size_code = ESP_IMAGE_FLASH_SIZE_16MB; break; default: ok = false; break; } if (ok) @@ -154,10 +154,10 @@ uint32_t flash_rom_get_speed(void) { switch (flash_load_rom_header ().spi_speed) { - case SPI_SPEED_40M: return 40000000; - case SPI_SPEED_26M: return 26700000; // TODO: verify 26.7MHz - case SPI_SPEED_20M: return 20000000; - case SPI_SPEED_80M: return 80000000; + case ESP_IMAGE_SPI_SPEED_40M: return 40000000; + case ESP_IMAGE_SPI_SPEED_26M: return 26700000; // TODO: verify 26.7MHz + case ESP_IMAGE_SPI_SPEED_20M: return 20000000; + case ESP_IMAGE_SPI_SPEED_80M: return 80000000; default: break; } return 0; diff --git a/components/platform/platform_partition.c b/components/platform/platform_partition.c index 523df7e9..e3445f0c 100644 --- a/components/platform/platform_partition.c +++ b/components/platform/platform_partition.c @@ -35,12 +35,12 @@ #include #include -#include "../../bootloader/src/main/bootloader_config.h" +#include "esp_flash_data_types.h" #include "esp_spi_flash.h" static inline bool possible_idx (uint8_t idx) { - return ((idx +1) * sizeof (partition_info_t)) < SPI_FLASH_SEC_SIZE; + return ((idx +1) * sizeof (esp_partition_info_t)) < SPI_FLASH_SEC_SIZE; } @@ -49,13 +49,13 @@ bool platform_partition_info (uint8_t idx, platform_partition_t *info) if (!possible_idx (idx)) return false; - partition_info_t pi; + esp_partition_info_t pi; esp_err_t err = spi_flash_read ( - PARTITION_ADD + idx * sizeof(pi), (uint32_t *)&pi, sizeof (pi)); + ESP_PARTITION_TABLE_ADDR + idx * sizeof(pi), (uint32_t *)&pi, sizeof (pi)); if (err != ESP_OK) return false; - if (pi.magic != PARTITION_MAGIC) + if (pi.magic != ESP_PARTITION_MAGIC) return false; memcpy (info->label, pi.label, sizeof (info->label)); @@ -70,33 +70,35 @@ bool platform_partition_info (uint8_t idx, platform_partition_t *info) bool platform_partition_add (const platform_partition_t *info) { - partition_info_t *part_table = (partition_info_t *)malloc(SPI_FLASH_SEC_SIZE); + esp_partition_info_t *part_table = + (esp_partition_info_t *)malloc(SPI_FLASH_SEC_SIZE); if (!part_table) return false; - esp_err_t err = - spi_flash_read (PARTITION_ADD, (uint32_t *)part_table, SPI_FLASH_SEC_SIZE); + esp_err_t err = spi_flash_read ( + ESP_PARTITION_TABLE_ADDR, (uint32_t *)part_table, SPI_FLASH_SEC_SIZE); if (err != ESP_OK) goto out; uint8_t idx = 0; for (; possible_idx (idx); ++idx) - if (part_table[idx].magic != PARTITION_MAGIC) + if (part_table[idx].magic != ESP_PARTITION_MAGIC) break; if (possible_idx (idx)) { - partition_info_t *slot = &part_table[idx]; - slot->magic = PARTITION_MAGIC; + esp_partition_info_t *slot = &part_table[idx]; + slot->magic = ESP_PARTITION_MAGIC; slot->type = info->type; slot->subtype = info->subtype; slot->pos.offset = info->offs; slot->pos.size = info->size; memcpy (slot->label, info->label, sizeof (slot->label)); memset (slot->reserved, 0xff, sizeof (slot->reserved)); - err = spi_flash_erase_sector (PARTITION_ADD / SPI_FLASH_SEC_SIZE); + err = spi_flash_erase_sector ( + ESP_PARTITION_TABLE_ADDR / SPI_FLASH_SEC_SIZE); if (err == ESP_OK) err = spi_flash_write ( - PARTITION_ADD, (uint32_t *)part_table, SPI_FLASH_SEC_SIZE); + ESP_PARTITION_TABLE_ADDR, (uint32_t *)part_table, SPI_FLASH_SEC_SIZE); } out: diff --git a/sdk/esp32-esp-idf b/sdk/esp32-esp-idf index 12caaed2..eb067ce9 160000 --- a/sdk/esp32-esp-idf +++ b/sdk/esp32-esp-idf @@ -1 +1 @@ -Subproject commit 12caaed28063e32d8b1fb13e13548b6fa52f87b3 +Subproject commit eb067ce90827a31a1b01eac531767a17c55048c1