mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
support esp32 eco revision 2 and 3
This commit is contained in:
parent
d6e333f014
commit
c0a5cb07cd
10
Kconfig
10
Kconfig
@ -8,6 +8,10 @@ config IDF_CMAKE
|
|||||||
bool
|
bool
|
||||||
option env="IDF_CMAKE"
|
option env="IDF_CMAKE"
|
||||||
|
|
||||||
|
config IDF_FIRMWARE_CHIP_ID
|
||||||
|
hex
|
||||||
|
default 0x0000
|
||||||
|
|
||||||
menu "SDK tool configuration"
|
menu "SDK tool configuration"
|
||||||
config TOOLPREFIX
|
config TOOLPREFIX
|
||||||
string "Compiler toolchain path/prefix"
|
string "Compiler toolchain path/prefix"
|
||||||
@ -132,17 +136,17 @@ choice STACK_CHECK_MODE
|
|||||||
|
|
||||||
- In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
|
- In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
|
||||||
and functions with buffers larger than 8 bytes are protected.
|
and functions with buffers larger than 8 bytes are protected.
|
||||||
|
|
||||||
- STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes
|
- STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes
|
||||||
additional functions to be protected -- those that have local array definitions,
|
additional functions to be protected -- those that have local array definitions,
|
||||||
or have references to local frame addresses.
|
or have references to local frame addresses.
|
||||||
|
|
||||||
- In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
|
- In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
|
||||||
|
|
||||||
Modes have the following impact on code performance and coverage:
|
Modes have the following impact on code performance and coverage:
|
||||||
|
|
||||||
- performance: NORMAL > STRONG > OVERALL
|
- performance: NORMAL > STRONG > OVERALL
|
||||||
|
|
||||||
- coverage: NORMAL < STRONG < OVERALL
|
- coverage: NORMAL < STRONG < OVERALL
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
|
||||||
#define OTA_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
#define OTA_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
||||||
#define OTA_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
#define OTA_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
||||||
#define SUB_TYPE_ID(i) (i & 0x0F)
|
#define SUB_TYPE_ID(i) (i & 0x0F)
|
||||||
|
|
||||||
typedef struct ota_ops_entry_ {
|
typedef struct ota_ops_entry_ {
|
||||||
uint32_t handle;
|
uint32_t handle;
|
||||||
@ -146,7 +146,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
|||||||
// must erase the partition before writing to it
|
// must erase the partition before writing to it
|
||||||
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
||||||
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
|
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x)", data_bytes[0]);
|
||||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,10 +302,10 @@ static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
|
|||||||
//named data in first sector as s_ota_select[0], second sector data as s_ota_select[1]
|
//named data in first sector as s_ota_select[0], second sector data as s_ota_select[1]
|
||||||
//e.g.
|
//e.g.
|
||||||
//if s_ota_select[0].ota_seq == s_ota_select[1].ota_seq == 0xFFFFFFFF,means ota info partition is in init status
|
//if s_ota_select[0].ota_seq == s_ota_select[1].ota_seq == 0xFFFFFFFF,means ota info partition is in init status
|
||||||
//so it will boot factory application(if there is),if there's no factory application,it will boot ota[0] application
|
//so it will boot factory application(if there is),if there's no factory application,it will boot ota[0] application
|
||||||
//if s_ota_select[0].ota_seq != 0 and s_ota_select[1].ota_seq != 0,it will choose a max seq ,and get value of max_seq%max_ota_app_number
|
//if s_ota_select[0].ota_seq != 0 and s_ota_select[1].ota_seq != 0,it will choose a max seq ,and get value of max_seq%max_ota_app_number
|
||||||
//and boot a subtype (mask 0x0F) value is (max_seq - 1)%max_ota_app_number,so if want switch to run ota[x],can use next formulas.
|
//and boot a subtype (mask 0x0F) value is (max_seq - 1)%max_ota_app_number,so if want switch to run ota[x],can use next formulas.
|
||||||
//for example, if s_ota_select[0].ota_seq = 4, s_ota_select[1].ota_seq = 5, and there are 8 ota application,
|
//for example, if s_ota_select[0].ota_seq = 4, s_ota_select[1].ota_seq = 5, and there are 8 ota application,
|
||||||
//current running is (5-1)%8 = 4,running ota[4],so if we want to switch to run ota[7],
|
//current running is (5-1)%8 = 4,running ota[4],so if we want to switch to run ota[7],
|
||||||
//we should add s_ota_select[0].ota_seq (is 4) to 4 ,(8-1)%8=7,then it will boot ota[7]
|
//we should add s_ota_select[0].ota_seq (is 4) to 4 ,(8-1)%8=7,then it will boot ota[7]
|
||||||
//if A=(B - C)%D
|
//if A=(B - C)%D
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "esp_flash_data_types.h"
|
#include "esp_flash_data_types.h"
|
||||||
|
#include "esp_image_format.h"
|
||||||
|
|
||||||
/// Type of hold a GPIO in low state
|
/// Type of hold a GPIO in low state
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -68,3 +69,13 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat
|
|||||||
* @return Returns true if the list contains the label, false otherwise.
|
* @return Returns true if the list contains the label, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool bootloader_common_label_search(const char *list, char *label);
|
bool bootloader_common_label_search(const char *list, char *label);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if the image (bootloader and application) has valid chip ID and revision
|
||||||
|
*
|
||||||
|
* @param img_hdr: image header
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: image and chip are matched well
|
||||||
|
* - ESP_FAIL: image doesn't match to the chip
|
||||||
|
*/
|
||||||
|
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr);
|
||||||
|
@ -91,6 +91,13 @@ esp_err_t esp_efuse_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_wor
|
|||||||
*/
|
*/
|
||||||
void esp_efuse_write_random_key(uint32_t blk_wdata0_reg);
|
void esp_efuse_write_random_key(uint32_t blk_wdata0_reg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns chip version from efuse
|
||||||
|
*
|
||||||
|
* @return chip version
|
||||||
|
*/
|
||||||
|
uint8_t esp_efuse_get_chip_ver(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,6 +55,19 @@ typedef enum {
|
|||||||
|
|
||||||
#define ESP_IMAGE_HEADER_MAGIC 0xE9
|
#define ESP_IMAGE_HEADER_MAGIC 0xE9
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ESP chip ID
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */
|
||||||
|
ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */
|
||||||
|
} __attribute__((packed)) esp_chip_id_t;
|
||||||
|
|
||||||
|
/** @cond */
|
||||||
|
_Static_assert(sizeof(esp_chip_id_t) == 2, "esp_chip_id_t should be 16 bit");
|
||||||
|
|
||||||
|
|
||||||
/* Main header of binary image */
|
/* Main header of binary image */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t magic;
|
uint8_t magic;
|
||||||
@ -71,8 +84,12 @@ typedef struct {
|
|||||||
uint8_t wp_pin;
|
uint8_t wp_pin;
|
||||||
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
|
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
|
||||||
uint8_t spi_pin_drv[3];
|
uint8_t spi_pin_drv[3];
|
||||||
/* Reserved bytes in ESP32 additional header space, currently unused */
|
/*!< Chip identification number */
|
||||||
uint8_t reserved[11];
|
esp_chip_id_t chip_id;
|
||||||
|
/*!< Minimum chip revision supported by image */
|
||||||
|
uint8_t min_chip_rev;
|
||||||
|
/*!< Reserved bytes in additional header space, currently unused */
|
||||||
|
uint8_t reserved[8];
|
||||||
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
|
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
|
||||||
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
|
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
|
||||||
* is appended after this (and the simple hash is included in the signed data). */
|
* is appended after this (and the simple hash is included in the signed data). */
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include "bootloader_common.h"
|
#include "bootloader_common.h"
|
||||||
#include "soc/gpio_periph.h"
|
#include "soc/gpio_periph.h"
|
||||||
#include "soc/spi_reg.h"
|
#include "soc/spi_reg.h"
|
||||||
|
#include "esp_image_format.h"
|
||||||
|
#include "esp_efuse.h"
|
||||||
|
|
||||||
static const char* TAG = "boot_comm";
|
static const char* TAG = "boot_comm";
|
||||||
|
|
||||||
@ -146,3 +148,23 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr)
|
||||||
|
{
|
||||||
|
esp_err_t err = ESP_OK;
|
||||||
|
esp_chip_id_t chip_id = CONFIG_IDF_FIRMWARE_CHIP_ID;
|
||||||
|
if (chip_id != img_hdr->chip_id) {
|
||||||
|
ESP_LOGE(TAG, "image has invalid chip ID, expected at least %d, found %d", chip_id, img_hdr->chip_id);
|
||||||
|
err = ESP_FAIL;
|
||||||
|
}
|
||||||
|
uint8_t revision = esp_efuse_get_chip_ver();
|
||||||
|
if (revision < img_hdr->min_chip_rev) {
|
||||||
|
ESP_LOGE(TAG, "image has invalid chip revision, expected at least %d, found %d", revision, img_hdr->min_chip_rev);
|
||||||
|
err = ESP_FAIL;
|
||||||
|
} else if (revision != img_hdr->min_chip_rev) {
|
||||||
|
ESP_LOGI(TAG, "This chip is revision %d but project was configured for minimum revision %d. "\
|
||||||
|
"Suggest setting project minimum revision to %d if safe to do so.",
|
||||||
|
revision, img_hdr->min_chip_rev, revision);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
#include "esp_efuse.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
#include "rom/cache.h"
|
#include "rom/cache.h"
|
||||||
@ -126,6 +127,12 @@ static esp_err_t bootloader_main()
|
|||||||
ESP_LOGE(TAG, "failed to load bootloader header!");
|
ESP_LOGE(TAG, "failed to load bootloader header!");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
/* Check chip ID and minimum chip revision that supported by this image */
|
||||||
|
uint8_t revision = esp_efuse_get_chip_ver();
|
||||||
|
ESP_LOGI(TAG, "Chip Revision: %d", revision);
|
||||||
|
if (bootloader_common_check_chip_validity(&fhdr) != ESP_OK) {
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
bootloader_init_flash_configure(&fhdr);
|
bootloader_init_flash_configure(&fhdr);
|
||||||
#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240)
|
#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240)
|
||||||
//Check if ESP32 is rated for a CPU frequency of 160MHz only
|
//Check if ESP32 is rated for a CPU frequency of 160MHz only
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "bootloader_random.h"
|
#include "bootloader_random.h"
|
||||||
|
#include "soc/apb_ctrl_reg.h"
|
||||||
|
|
||||||
#define EFUSE_CONF_WRITE 0x5A5A /* efuse_pgm_op_ena, force no rd/wr disable */
|
#define EFUSE_CONF_WRITE 0x5A5A /* efuse_pgm_op_ena, force no rd/wr disable */
|
||||||
#define EFUSE_CONF_READ 0x5AA5 /* efuse_read_op_ena, release force */
|
#define EFUSE_CONF_READ 0x5AA5 /* efuse_read_op_ena, release force */
|
||||||
@ -112,3 +113,32 @@ void esp_efuse_write_random_key(uint32_t blk_wdata0_reg)
|
|||||||
bzero(buf, sizeof(buf));
|
bzero(buf, sizeof(buf));
|
||||||
bzero(raw, sizeof(raw));
|
bzero(raw, sizeof(raw));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns chip version from efuse
|
||||||
|
uint8_t esp_efuse_get_chip_ver(void)
|
||||||
|
{
|
||||||
|
uint8_t eco_bit0, eco_bit1, eco_bit2;
|
||||||
|
eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15;
|
||||||
|
eco_bit1 = (REG_READ(EFUSE_BLK0_RDATA5_REG) & 0x100000) >> 20;
|
||||||
|
eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31;
|
||||||
|
uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0;
|
||||||
|
uint8_t chip_ver = 0;
|
||||||
|
switch (combine_value) {
|
||||||
|
case 0:
|
||||||
|
chip_ver = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
chip_ver = 1;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
chip_ver = 2;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
chip_ver = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
chip_ver = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return chip_ver;
|
||||||
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <bootloader_random.h>
|
#include <bootloader_random.h>
|
||||||
#include <bootloader_sha.h>
|
#include <bootloader_sha.h>
|
||||||
#include "bootloader_util.h"
|
#include "bootloader_util.h"
|
||||||
|
#include "bootloader_common.h"
|
||||||
|
|
||||||
/* Checking signatures as part of verifying images is necessary:
|
/* Checking signatures as part of verifying images is necessary:
|
||||||
- Always if secure boot is enabled
|
- Always if secure boot is enabled
|
||||||
@ -253,6 +254,9 @@ static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t
|
|||||||
}
|
}
|
||||||
err = ESP_ERR_IMAGE_INVALID;
|
err = ESP_ERR_IMAGE_INVALID;
|
||||||
}
|
}
|
||||||
|
if (bootloader_common_check_chip_validity(image) != ESP_OK) {
|
||||||
|
err = ESP_ERR_IMAGE_INVALID;
|
||||||
|
}
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
if (image->spi_mode > ESP_IMAGE_SPI_MODE_SLOW_READ) {
|
if (image->spi_mode > ESP_IMAGE_SPI_MODE_SLOW_READ) {
|
||||||
ESP_LOGW(TAG, "image at 0x%x has invalid SPI mode %d", src_addr, image->spi_mode);
|
ESP_LOGW(TAG, "image at 0x%x has invalid SPI mode %d", src_addr, image->spi_mode);
|
||||||
|
@ -1,5 +1,33 @@
|
|||||||
menu "ESP32-specific"
|
menu "ESP32-specific"
|
||||||
|
|
||||||
|
choice ESP32_REV_MIN
|
||||||
|
prompt "Minimum Supported ESP32 Revision"
|
||||||
|
default ESP32_REV_MIN_0
|
||||||
|
help
|
||||||
|
Minimum revision that ESP-IDF would support.
|
||||||
|
ESP-IDF performs different strategy on different esp32 revision.
|
||||||
|
|
||||||
|
config ESP32_REV_MIN_0
|
||||||
|
bool "Rev 0"
|
||||||
|
config ESP32_REV_MIN_1
|
||||||
|
bool "Rev 1"
|
||||||
|
config ESP32_REV_MIN_2
|
||||||
|
bool "Rev 2"
|
||||||
|
config ESP32_REV_MIN_3
|
||||||
|
bool "Rev 3"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESP32_REV_MIN
|
||||||
|
int
|
||||||
|
default 0 if ESP32_REV_MIN_0
|
||||||
|
default 1 if ESP32_REV_MIN_1
|
||||||
|
default 2 if ESP32_REV_MIN_2
|
||||||
|
default 3 if ESP32_REV_MIN_3
|
||||||
|
|
||||||
|
config ESP32_DPORT_WORKAROUND
|
||||||
|
bool
|
||||||
|
default "y" if !FREERTOS_UNICORE && ESP32_REV_MIN < 2
|
||||||
|
|
||||||
choice ESP32_DEFAULT_CPU_FREQ_MHZ
|
choice ESP32_DEFAULT_CPU_FREQ_MHZ
|
||||||
prompt "CPU frequency"
|
prompt "CPU frequency"
|
||||||
default ESP32_DEFAULT_CPU_FREQ_160
|
default ESP32_DEFAULT_CPU_FREQ_160
|
||||||
@ -24,7 +52,7 @@ config SPIRAM_SUPPORT
|
|||||||
bool "Support for external, SPI-connected RAM"
|
bool "Support for external, SPI-connected RAM"
|
||||||
default "n"
|
default "n"
|
||||||
help
|
help
|
||||||
This enables support for an external SPI RAM chip, connected in parallel with the
|
This enables support for an external SPI RAM chip, connected in parallel with the
|
||||||
main SPI flash chip.
|
main SPI flash chip.
|
||||||
|
|
||||||
menu "SPI RAM config"
|
menu "SPI RAM config"
|
||||||
@ -117,11 +145,10 @@ config SPIRAM_CACHE_WORKAROUND
|
|||||||
when the cache line needs to be fetched from external RAM and an interrupt occurs. This enables a
|
when the cache line needs to be fetched from external RAM and an interrupt occurs. This enables a
|
||||||
fix in the compiler (-mfix-esp32-psram-cache-issue) that makes sure the specific code that is vulnerable
|
fix in the compiler (-mfix-esp32-psram-cache-issue) that makes sure the specific code that is vulnerable
|
||||||
to this will not be emitted.
|
to this will not be emitted.
|
||||||
|
|
||||||
This will also not use any bits of newlib that are located in ROM, opting for a version that is compiled
|
This will also not use any bits of newlib that are located in ROM, opting for a version that is compiled
|
||||||
with the workaround and located in flash instead.
|
with the workaround and located in flash instead.
|
||||||
|
|
||||||
|
|
||||||
config SPIRAM_MALLOC_ALWAYSINTERNAL
|
config SPIRAM_MALLOC_ALWAYSINTERNAL
|
||||||
int "Maximum malloc() size, in bytes, to always put in internal memory"
|
int "Maximum malloc() size, in bytes, to always put in internal memory"
|
||||||
depends on SPIRAM_USE_MALLOC
|
depends on SPIRAM_USE_MALLOC
|
||||||
@ -132,7 +159,7 @@ config SPIRAM_MALLOC_ALWAYSINTERNAL
|
|||||||
than this size in internal memory, while allocations larger than this will be done from external RAM.
|
than this size in internal memory, while allocations larger than this will be done from external RAM.
|
||||||
If allocation from the preferred region fails, an attempt is made to allocate from the non-preferred
|
If allocation from the preferred region fails, an attempt is made to allocate from the non-preferred
|
||||||
region instead, so malloc() will not suddenly fail when either internal or external memory is full.
|
region instead, so malloc() will not suddenly fail when either internal or external memory is full.
|
||||||
|
|
||||||
config WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
config WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
||||||
bool "Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory"
|
bool "Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory"
|
||||||
depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
|
depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
|
||||||
@ -148,12 +175,12 @@ config SPIRAM_MALLOC_RESERVE_INTERNAL
|
|||||||
help
|
help
|
||||||
Because the external/internal RAM allocation strategy is not always perfect, it sometimes may happen
|
Because the external/internal RAM allocation strategy is not always perfect, it sometimes may happen
|
||||||
that the internal memory is entirely filled up. This causes allocations that are specifically done in
|
that the internal memory is entirely filled up. This causes allocations that are specifically done in
|
||||||
internal memory, for example the stack for new tasks or memory to service DMA or have memory that's
|
internal memory, for example the stack for new tasks or memory to service DMA or have memory that's
|
||||||
also available when SPI cache is down, to fail. This option reserves a pool specifically for requests
|
also available when SPI cache is down, to fail. This option reserves a pool specifically for requests
|
||||||
like that; the memory in this pool is not given out when a normal malloc() is called.
|
like that; the memory in this pool is not given out when a normal malloc() is called.
|
||||||
|
|
||||||
Set this to 0 to disable this feature.
|
Set this to 0 to disable this feature.
|
||||||
|
|
||||||
Note that because FreeRTOS stacks are forced to internal memory, they will also use this memory pool;
|
Note that because FreeRTOS stacks are forced to internal memory, they will also use this memory pool;
|
||||||
be sure to keep this in mind when adjusting this value.
|
be sure to keep this in mind when adjusting this value.
|
||||||
|
|
||||||
@ -213,8 +240,8 @@ choice ESP32_COREDUMP_TO_FLASH_OR_UART
|
|||||||
help
|
help
|
||||||
Select place to store core dump: flash, uart or none (to disable core dumps generation).
|
Select place to store core dump: flash, uart or none (to disable core dumps generation).
|
||||||
|
|
||||||
If core dump is configured to be stored in flash and custom partition table is used add
|
If core dump is configured to be stored in flash and custom partition table is used add
|
||||||
corresponding entry to your CSV. For examples, please see predefined partition table CSV descriptions
|
corresponding entry to your CSV. For examples, please see predefined partition table CSV descriptions
|
||||||
in the components/partition_table directory.
|
in the components/partition_table directory.
|
||||||
|
|
||||||
config ESP32_ENABLE_COREDUMP_TO_FLASH
|
config ESP32_ENABLE_COREDUMP_TO_FLASH
|
||||||
@ -253,18 +280,18 @@ choice NUMBER_OF_UNIVERSAL_MAC_ADDRESS
|
|||||||
default FOUR_UNIVERSAL_MAC_ADDRESS
|
default FOUR_UNIVERSAL_MAC_ADDRESS
|
||||||
help
|
help
|
||||||
Configure the number of universally administered (by IEEE) MAC addresses.
|
Configure the number of universally administered (by IEEE) MAC addresses.
|
||||||
During initialisation, MAC addresses for each network interface are generated or derived from a
|
During initialisation, MAC addresses for each network interface are generated or derived from a
|
||||||
single base MAC address.
|
single base MAC address.
|
||||||
If the number of universal MAC addresses is four, all four interfaces (WiFi station, WiFi softap,
|
If the number of universal MAC addresses is four, all four interfaces (WiFi station, WiFi softap,
|
||||||
Bluetooth and Ethernet) receive a universally administered MAC address. These are generated
|
Bluetooth and Ethernet) receive a universally administered MAC address. These are generated
|
||||||
sequentially by adding 0, 1, 2 and 3 (respectively) to the final octet of the base MAC address.
|
sequentially by adding 0, 1, 2 and 3 (respectively) to the final octet of the base MAC address.
|
||||||
If the number of universal MAC addresses is two, only two interfaces (WiFi station and Bluetooth)
|
If the number of universal MAC addresses is two, only two interfaces (WiFi station and Bluetooth)
|
||||||
receive a universally administered MAC address. These are generated sequentially by adding 0
|
receive a universally administered MAC address. These are generated sequentially by adding 0
|
||||||
and 1 (respectively) to the base MAC address. The remaining two interfaces (WiFi softap and Ethernet)
|
and 1 (respectively) to the base MAC address. The remaining two interfaces (WiFi softap and Ethernet)
|
||||||
receive local MAC addresses. These are derived from the universal WiFi station and Bluetooth MAC
|
receive local MAC addresses. These are derived from the universal WiFi station and Bluetooth MAC
|
||||||
addresses, respectively.
|
addresses, respectively.
|
||||||
When using the default (Espressif-assigned) base MAC address, either setting can be used. When using
|
When using the default (Espressif-assigned) base MAC address, either setting can be used. When using
|
||||||
a custom universal MAC address range, the correct setting will depend on the allocation of MAC
|
a custom universal MAC address range, the correct setting will depend on the allocation of MAC
|
||||||
addresses in this range (either 2 or 4 per device.)
|
addresses in this range (either 2 or 4 per device.)
|
||||||
|
|
||||||
config TWO_UNIVERSAL_MAC_ADDRESS
|
config TWO_UNIVERSAL_MAC_ADDRESS
|
||||||
@ -274,7 +301,7 @@ config FOUR_UNIVERSAL_MAC_ADDRESS
|
|||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config NUMBER_OF_UNIVERSAL_MAC_ADDRESS
|
config NUMBER_OF_UNIVERSAL_MAC_ADDRESS
|
||||||
int
|
int
|
||||||
default 2 if TWO_UNIVERSAL_MAC_ADDRESS
|
default 2 if TWO_UNIVERSAL_MAC_ADDRESS
|
||||||
default 4 if FOUR_UNIVERSAL_MAC_ADDRESS
|
default 4 if FOUR_UNIVERSAL_MAC_ADDRESS
|
||||||
|
|
||||||
@ -322,10 +349,10 @@ config TIMER_TASK_STACK_SIZE
|
|||||||
to dispatch callbacks of timers created using ets_timer and esp_timer
|
to dispatch callbacks of timers created using ets_timer and esp_timer
|
||||||
APIs. If you are seing stack overflow errors in timer task, increase
|
APIs. If you are seing stack overflow errors in timer task, increase
|
||||||
this value.
|
this value.
|
||||||
|
|
||||||
Note that this is not the same as FreeRTOS timer task. To configure
|
Note that this is not the same as FreeRTOS timer task. To configure
|
||||||
FreeRTOS timer task size, see "FreeRTOS timer task stack size" option
|
FreeRTOS timer task size, see "FreeRTOS timer task stack size" option
|
||||||
in "FreeRTOS" menu.
|
in "FreeRTOS" menu.
|
||||||
|
|
||||||
choice NEWLIB_STDOUT_LINE_ENDING
|
choice NEWLIB_STDOUT_LINE_ENDING
|
||||||
prompt "Line ending for UART output"
|
prompt "Line ending for UART output"
|
||||||
@ -334,15 +361,15 @@ choice NEWLIB_STDOUT_LINE_ENDING
|
|||||||
This option allows configuring the desired line endings sent to UART
|
This option allows configuring the desired line endings sent to UART
|
||||||
when a newline ('\n', LF) appears on stdout.
|
when a newline ('\n', LF) appears on stdout.
|
||||||
Three options are possible:
|
Three options are possible:
|
||||||
|
|
||||||
CRLF: whenever LF is encountered, prepend it with CR
|
CRLF: whenever LF is encountered, prepend it with CR
|
||||||
|
|
||||||
LF: no modification is applied, stdout is sent as is
|
LF: no modification is applied, stdout is sent as is
|
||||||
|
|
||||||
CR: each occurence of LF is replaced with CR
|
CR: each occurence of LF is replaced with CR
|
||||||
|
|
||||||
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
||||||
|
|
||||||
config NEWLIB_STDOUT_LINE_ENDING_CRLF
|
config NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||||
bool "CRLF"
|
bool "CRLF"
|
||||||
config NEWLIB_STDOUT_LINE_ENDING_LF
|
config NEWLIB_STDOUT_LINE_ENDING_LF
|
||||||
@ -358,15 +385,15 @@ choice NEWLIB_STDIN_LINE_ENDING
|
|||||||
This option allows configuring which input sequence on UART produces
|
This option allows configuring which input sequence on UART produces
|
||||||
a newline ('\n', LF) on stdin.
|
a newline ('\n', LF) on stdin.
|
||||||
Three options are possible:
|
Three options are possible:
|
||||||
|
|
||||||
CRLF: CRLF is converted to LF
|
CRLF: CRLF is converted to LF
|
||||||
|
|
||||||
LF: no modification is applied, input is sent to stdin as is
|
LF: no modification is applied, input is sent to stdin as is
|
||||||
|
|
||||||
CR: each occurence of CR is replaced with LF
|
CR: each occurence of CR is replaced with LF
|
||||||
|
|
||||||
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
||||||
|
|
||||||
config NEWLIB_STDIN_LINE_ENDING_CRLF
|
config NEWLIB_STDIN_LINE_ENDING_CRLF
|
||||||
bool "CRLF"
|
bool "CRLF"
|
||||||
config NEWLIB_STDIN_LINE_ENDING_LF
|
config NEWLIB_STDIN_LINE_ENDING_LF
|
||||||
@ -401,7 +428,7 @@ choice CONSOLE_UART
|
|||||||
default CONSOLE_UART_DEFAULT
|
default CONSOLE_UART_DEFAULT
|
||||||
help
|
help
|
||||||
Select whether to use UART for console output (through stdout and stderr).
|
Select whether to use UART for console output (through stdout and stderr).
|
||||||
|
|
||||||
- Default is to use UART0 on pins GPIO1(TX) and GPIO3(RX).
|
- Default is to use UART0 on pins GPIO1(TX) and GPIO3(RX).
|
||||||
- If "Custom" is selected, UART0 or UART1 can be chosen,
|
- If "Custom" is selected, UART0 or UART1 can be chosen,
|
||||||
and any pins can be selected.
|
and any pins can be selected.
|
||||||
@ -515,10 +542,10 @@ config ESP32_DEBUG_OCDAWARE
|
|||||||
|
|
||||||
config ESP32_DEBUG_STUBS_ENABLE
|
config ESP32_DEBUG_STUBS_ENABLE
|
||||||
bool "OpenOCD debug stubs"
|
bool "OpenOCD debug stubs"
|
||||||
default OPTIMIZATION_LEVEL_DEBUG
|
default OPTIMIZATION_LEVEL_DEBUG
|
||||||
depends on !ESP32_TRAX
|
depends on !ESP32_TRAX
|
||||||
help
|
help
|
||||||
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
|
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
|
||||||
e.g. GCOV data dump.
|
e.g. GCOV data dump.
|
||||||
|
|
||||||
config INT_WDT
|
config INT_WDT
|
||||||
@ -552,7 +579,7 @@ config TASK_WDT
|
|||||||
help
|
help
|
||||||
The Task Watchdog Timer can be used to make sure individual tasks are still
|
The Task Watchdog Timer can be used to make sure individual tasks are still
|
||||||
running. Enabling this option will cause the Task Watchdog Timer to be
|
running. Enabling this option will cause the Task Watchdog Timer to be
|
||||||
initialized automatically at startup. The Task Watchdog timer can be
|
initialized automatically at startup. The Task Watchdog timer can be
|
||||||
initialized after startup as well (see Task Watchdog Timer API Reference)
|
initialized after startup as well (see Task Watchdog Timer API Reference)
|
||||||
|
|
||||||
config TASK_WDT_PANIC
|
config TASK_WDT_PANIC
|
||||||
@ -658,7 +685,7 @@ choice ESP32_TIME_SYSCALL
|
|||||||
continue in deep sleep. Time will be reported at 1 microsecond
|
continue in deep sleep. Time will be reported at 1 microsecond
|
||||||
resolution. This is the default, and the recommended option.
|
resolution. This is the default, and the recommended option.
|
||||||
- If only high-resolution timer is used, gettimeofday will
|
- If only high-resolution timer is used, gettimeofday will
|
||||||
provide time at microsecond resolution.
|
provide time at microsecond resolution.
|
||||||
Time will not be preserved when going into deep sleep mode.
|
Time will not be preserved when going into deep sleep mode.
|
||||||
- If only RTC timer is used, timekeeping will continue in
|
- If only RTC timer is used, timekeeping will continue in
|
||||||
deep sleep, but time will be measured at 6.(6) microsecond
|
deep sleep, but time will be measured at 6.(6) microsecond
|
||||||
@ -717,7 +744,7 @@ config ESP32_RTC_CLK_CAL_CYCLES
|
|||||||
by the calibration routine. Higher numbers increase calibration
|
by the calibration routine. Higher numbers increase calibration
|
||||||
precision, which may be important for applications which spend a lot of
|
precision, which may be important for applications which spend a lot of
|
||||||
time in deep sleep. Lower numbers reduce startup time.
|
time in deep sleep. Lower numbers reduce startup time.
|
||||||
|
|
||||||
When this option is set to 0, clock calibration will not be performed at
|
When this option is set to 0, clock calibration will not be performed at
|
||||||
startup, and approximate clock frequencies will be assumed:
|
startup, and approximate clock frequencies will be assumed:
|
||||||
|
|
||||||
@ -732,15 +759,15 @@ config ESP32_RTC_XTAL_BOOTSTRAP_CYCLES
|
|||||||
default 5
|
default 5
|
||||||
range 0 32768
|
range 0 32768
|
||||||
help
|
help
|
||||||
To reduce the startup time of an external RTC crystal,
|
To reduce the startup time of an external RTC crystal,
|
||||||
we bootstrap it with a 32kHz square wave for a fixed number of cycles.
|
we bootstrap it with a 32kHz square wave for a fixed number of cycles.
|
||||||
Setting 0 will disable bootstrapping (if disabled, the crystal may take
|
Setting 0 will disable bootstrapping (if disabled, the crystal may take
|
||||||
longer to start up or fail to oscillate under some conditions).
|
longer to start up or fail to oscillate under some conditions).
|
||||||
|
|
||||||
If this value is too high, a faulty crystal may initially start and then fail.
|
If this value is too high, a faulty crystal may initially start and then fail.
|
||||||
If this value is too low, an otherwise good crystal may not start.
|
If this value is too low, an otherwise good crystal may not start.
|
||||||
|
|
||||||
To accurately determine if the crystal has started,
|
To accurately determine if the crystal has started,
|
||||||
set a larger "Number of cycles for RTC_SLOW_CLK calibration" (about 3000).
|
set a larger "Number of cycles for RTC_SLOW_CLK calibration" (about 3000).
|
||||||
|
|
||||||
config ESP32_DEEP_SLEEP_WAKEUP_DELAY
|
config ESP32_DEEP_SLEEP_WAKEUP_DELAY
|
||||||
@ -754,9 +781,9 @@ config ESP32_DEEP_SLEEP_WAKEUP_DELAY
|
|||||||
time to pass between power on and first read operation. By default,
|
time to pass between power on and first read operation. By default,
|
||||||
without any extra delay, this time is approximately 900us, although
|
without any extra delay, this time is approximately 900us, although
|
||||||
some flash chip types need more than that.
|
some flash chip types need more than that.
|
||||||
|
|
||||||
By default extra delay is set to 2000us. When optimizing startup time
|
By default extra delay is set to 2000us. When optimizing startup time
|
||||||
for applications which require it, this value may be reduced.
|
for applications which require it, this value may be reduced.
|
||||||
|
|
||||||
If you are seeing "flash read err, 1000" message printed to the
|
If you are seeing "flash read err, 1000" message printed to the
|
||||||
console after deep sleep reset, try increasing this value.
|
console after deep sleep reset, try increasing this value.
|
||||||
@ -902,8 +929,8 @@ config ESP32_WIFI_STATIC_RX_BUFFER_NUM
|
|||||||
until esp_wifi_deinit is called.
|
until esp_wifi_deinit is called.
|
||||||
|
|
||||||
WiFi hardware use these buffers to receive all 802.11 frames.
|
WiFi hardware use these buffers to receive all 802.11 frames.
|
||||||
A higher number may allow higher throughput but increases memory use. If ESP32_WIFI_AMPDU_RX_ENABLED
|
A higher number may allow higher throughput but increases memory use. If ESP32_WIFI_AMPDU_RX_ENABLED
|
||||||
is enabled, this value is recommended to set equal or bigger than ESP32_WIFI_RX_BA_WIN in order to
|
is enabled, this value is recommended to set equal or bigger than ESP32_WIFI_RX_BA_WIN in order to
|
||||||
achieve better throughput and compatibility with both stations and APs.
|
achieve better throughput and compatibility with both stations and APs.
|
||||||
|
|
||||||
config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
|
config ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM
|
||||||
@ -987,8 +1014,8 @@ config ESP32_WIFI_CSI_ENABLED
|
|||||||
bool "WiFi CSI(Channel State Information)"
|
bool "WiFi CSI(Channel State Information)"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Select this option to enable CSI(Channel State Information) feature. CSI takes about
|
Select this option to enable CSI(Channel State Information) feature. CSI takes about
|
||||||
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable
|
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable
|
||||||
this feature in order to save memory.
|
this feature in order to save memory.
|
||||||
|
|
||||||
config ESP32_WIFI_AMPDU_TX_ENABLED
|
config ESP32_WIFI_AMPDU_TX_ENABLED
|
||||||
@ -1005,7 +1032,7 @@ config ESP32_WIFI_TX_BA_WIN
|
|||||||
default 6
|
default 6
|
||||||
help
|
help
|
||||||
Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but
|
Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but
|
||||||
more memory. Most of time we should NOT change the default value unless special reason, e.g.
|
more memory. Most of time we should NOT change the default value unless special reason, e.g.
|
||||||
test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended
|
test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended
|
||||||
value is 9~12.
|
value is 9~12.
|
||||||
|
|
||||||
@ -1023,10 +1050,10 @@ config ESP32_WIFI_RX_BA_WIN
|
|||||||
default 6 if !WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
default 6 if !WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
||||||
default 16 if WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
default 16 if WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
|
||||||
help
|
help
|
||||||
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
|
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
|
||||||
compatibility but more memory. Most of time we should NOT change the default value unless special reason, e.g.
|
compatibility but more memory. Most of time we should NOT change the default value unless special reason, e.g.
|
||||||
test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the recommended
|
test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the recommended
|
||||||
value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first, the default
|
value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first, the default
|
||||||
and minimum value should be 16 to achieve better throughput and compatibility with both stations and APs.
|
and minimum value should be 16 to achieve better throughput and compatibility with both stations and APs.
|
||||||
|
|
||||||
config ESP32_WIFI_NVS_ENABLED
|
config ESP32_WIFI_NVS_ENABLED
|
||||||
@ -1091,7 +1118,7 @@ config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
|
|||||||
help
|
help
|
||||||
If this option is enabled, NVS will be initialized and calibration data will be loaded from there.
|
If this option is enabled, NVS will be initialized and calibration data will be loaded from there.
|
||||||
PHY calibration will be skipped on deep sleep wakeup. If calibration data is not found, full calibration
|
PHY calibration will be skipped on deep sleep wakeup. If calibration data is not found, full calibration
|
||||||
will be performed and stored in NVS. Normally, only partial calibration will be performed.
|
will be performed and stored in NVS. Normally, only partial calibration will be performed.
|
||||||
If this option is disabled, full calibration will be performed.
|
If this option is disabled, full calibration will be performed.
|
||||||
|
|
||||||
If it's easy that your board calibrate bad data, choose 'n'.
|
If it's easy that your board calibrate bad data, choose 'n'.
|
||||||
@ -1115,7 +1142,7 @@ config ESP32_PHY_INIT_DATA_IN_PARTITION
|
|||||||
into the application binary.
|
into the application binary.
|
||||||
|
|
||||||
If unsure, choose 'n'.
|
If unsure, choose 'n'.
|
||||||
|
|
||||||
config ESP32_PHY_MAX_WIFI_TX_POWER
|
config ESP32_PHY_MAX_WIFI_TX_POWER
|
||||||
int "Max WiFi TX power (dBm)"
|
int "Max WiFi TX power (dBm)"
|
||||||
range 0 20
|
range 0 20
|
||||||
@ -1148,7 +1175,7 @@ config PM_ENABLE
|
|||||||
This option has run-time overhead (increased interrupt latency,
|
This option has run-time overhead (increased interrupt latency,
|
||||||
longer time to enter idle state), and it also reduces accuracy of
|
longer time to enter idle state), and it also reduces accuracy of
|
||||||
RTOS ticks and timers used for timekeeping.
|
RTOS ticks and timers used for timekeeping.
|
||||||
Enable this option if application uses power management APIs.
|
Enable this option if application uses power management APIs.
|
||||||
|
|
||||||
config PM_DFS_INIT_AUTO
|
config PM_DFS_INIT_AUTO
|
||||||
bool "Enable dynamic frequency scaling (DFS) at startup"
|
bool "Enable dynamic frequency scaling (DFS) at startup"
|
||||||
@ -1185,7 +1212,7 @@ config PM_PROFILING
|
|||||||
This feature can be used to analyze which locks are preventing the chip
|
This feature can be used to analyze which locks are preventing the chip
|
||||||
from going into a lower power state, and see what time the chip spends
|
from going into a lower power state, and see what time the chip spends
|
||||||
in each power saving mode. This feature does incur some run-time
|
in each power saving mode. This feature does incur some run-time
|
||||||
overhead, so should typically be disabled in production builds.
|
overhead, so should typically be disabled in production builds.
|
||||||
|
|
||||||
config PM_TRACE
|
config PM_TRACE
|
||||||
bool "Enable debug tracing of PM using GPIOs"
|
bool "Enable debug tracing of PM using GPIOs"
|
||||||
@ -1198,6 +1225,6 @@ config PM_TRACE
|
|||||||
This feature is intended to be used when analyzing/debugging behavior
|
This feature is intended to be used when analyzing/debugging behavior
|
||||||
of power management implementation, and should be kept disabled in
|
of power management implementation, and should be kept disabled in
|
||||||
applications.
|
applications.
|
||||||
|
|
||||||
|
|
||||||
endmenu # "Power Management"
|
endmenu # "Power Management"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* DPORT access is used for do protection when dual core access DPORT internal register and APB register via DPORT simultaneously
|
* DPORT access is used for do protection when dual core access DPORT internal register and APB register via DPORT simultaneously
|
||||||
* This function will be initialize after FreeRTOS startup.
|
* This function will be initialize after FreeRTOS startup.
|
||||||
* When cpu0 want to access DPORT register, it should notify cpu1 enter in high-priority interrupt for be mute. When cpu1 already in high-priority interrupt,
|
* When cpu0 want to access DPORT register, it should notify cpu1 enter in high-priority interrupt for be mute. When cpu1 already in high-priority interrupt,
|
||||||
* cpu0 can access DPORT register. Currently, cpu1 will wait for cpu0 finish access and exit high-priority interrupt.
|
* cpu0 can access DPORT register. Currently, cpu1 will wait for cpu0 finish access and exit high-priority interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -116,7 +116,7 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
|
|||||||
{
|
{
|
||||||
#ifndef CONFIG_FREERTOS_UNICORE
|
#ifndef CONFIG_FREERTOS_UNICORE
|
||||||
int cpu_id = xPortGetCoreID();
|
int cpu_id = xPortGetCoreID();
|
||||||
|
|
||||||
if (dport_core_state[0] == DPORT_CORE_STATE_IDLE
|
if (dport_core_state[0] == DPORT_CORE_STATE_IDLE
|
||||||
|| dport_core_state[1] == DPORT_CORE_STATE_IDLE) {
|
|| dport_core_state[1] == DPORT_CORE_STATE_IDLE) {
|
||||||
return;
|
return;
|
||||||
@ -249,7 +249,7 @@ void IRAM_ATTR esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address
|
|||||||
*/
|
*/
|
||||||
uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg)
|
uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg)
|
||||||
{
|
{
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
return _DPORT_REG_READ(reg);
|
return _DPORT_REG_READ(reg);
|
||||||
#else
|
#else
|
||||||
uint32_t apb;
|
uint32_t apb;
|
||||||
@ -295,7 +295,7 @@ uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg)
|
|||||||
*/
|
*/
|
||||||
uint32_t IRAM_ATTR esp_dport_access_sequence_reg_read(uint32_t reg)
|
uint32_t IRAM_ATTR esp_dport_access_sequence_reg_read(uint32_t reg)
|
||||||
{
|
{
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
return _DPORT_REG_READ(reg);
|
return _DPORT_REG_READ(reg);
|
||||||
#else
|
#else
|
||||||
uint32_t apb;
|
uint32_t apb;
|
||||||
|
@ -33,7 +33,7 @@ uint32_t esp_dport_access_sequence_reg_read(uint32_t reg);
|
|||||||
//only call in case of panic().
|
//only call in case of panic().
|
||||||
void esp_dport_access_int_abort(void);
|
void esp_dport_access_int_abort(void);
|
||||||
|
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
#define DPORT_STALL_OTHER_CPU_START()
|
#define DPORT_STALL_OTHER_CPU_START()
|
||||||
#define DPORT_STALL_OTHER_CPU_END()
|
#define DPORT_STALL_OTHER_CPU_END()
|
||||||
#define DPORT_INTERRUPT_DISABLE()
|
#define DPORT_INTERRUPT_DISABLE()
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
#include "esp_efuse.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#include "esp_wifi_internal.h"
|
#include "esp_wifi_internal.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@ -227,7 +228,7 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type)
|
|||||||
ESP_LOGW(TAG, "incorrect mac type");
|
ESP_LOGW(TAG, "incorrect mac type");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,10 +319,10 @@ void IRAM_ATTR esp_restart_noos()
|
|||||||
WRITE_PERI_REG(GPIO_FUNC5_IN_SEL_CFG_REG, 0x30);
|
WRITE_PERI_REG(GPIO_FUNC5_IN_SEL_CFG_REG, 0x30);
|
||||||
|
|
||||||
// Reset wifi/bluetooth/ethernet/sdio (bb/mac)
|
// Reset wifi/bluetooth/ethernet/sdio (bb/mac)
|
||||||
DPORT_SET_PERI_REG_MASK(DPORT_CORE_RST_EN_REG,
|
DPORT_SET_PERI_REG_MASK(DPORT_CORE_RST_EN_REG,
|
||||||
DPORT_BB_RST | DPORT_FE_RST | DPORT_MAC_RST |
|
DPORT_BB_RST | DPORT_FE_RST | DPORT_MAC_RST |
|
||||||
DPORT_BT_RST | DPORT_BTMAC_RST | DPORT_SDIO_RST |
|
DPORT_BT_RST | DPORT_BTMAC_RST | DPORT_SDIO_RST |
|
||||||
DPORT_SDIO_HOST_RST | DPORT_EMAC_RST | DPORT_MACPWR_RST |
|
DPORT_SDIO_HOST_RST | DPORT_EMAC_RST | DPORT_MACPWR_RST |
|
||||||
DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST);
|
DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST);
|
||||||
DPORT_REG_WRITE(DPORT_CORE_RST_EN_REG, 0);
|
DPORT_REG_WRITE(DPORT_CORE_RST_EN_REG, 0);
|
||||||
|
|
||||||
@ -377,35 +378,27 @@ const char* esp_get_idf_version(void)
|
|||||||
return IDF_VER;
|
return IDF_VER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_chip_info_esp32(esp_chip_info_t* out_info)
|
void esp_chip_info(esp_chip_info_t* out_info)
|
||||||
{
|
{
|
||||||
uint32_t reg = REG_READ(EFUSE_BLK0_RDATA3_REG);
|
uint32_t efuse_rd3 = REG_READ(EFUSE_BLK0_RDATA3_REG);
|
||||||
memset(out_info, 0, sizeof(*out_info));
|
memset(out_info, 0, sizeof(*out_info));
|
||||||
|
|
||||||
out_info->model = CHIP_ESP32;
|
out_info->model = CHIP_ESP32;
|
||||||
if ((reg & EFUSE_RD_CHIP_VER_REV1_M) != 0) {
|
out_info->revision = esp_efuse_get_chip_ver();
|
||||||
out_info->revision = 1;
|
|
||||||
}
|
if ((efuse_rd3 & EFUSE_RD_CHIP_VER_DIS_APP_CPU_M) == 0) {
|
||||||
if ((reg & EFUSE_RD_CHIP_VER_DIS_APP_CPU_M) == 0) {
|
|
||||||
out_info->cores = 2;
|
out_info->cores = 2;
|
||||||
} else {
|
} else {
|
||||||
out_info->cores = 1;
|
out_info->cores = 1;
|
||||||
}
|
}
|
||||||
out_info->features = CHIP_FEATURE_WIFI_BGN;
|
out_info->features = CHIP_FEATURE_WIFI_BGN;
|
||||||
if ((reg & EFUSE_RD_CHIP_VER_DIS_BT_M) == 0) {
|
if ((efuse_rd3 & EFUSE_RD_CHIP_VER_DIS_BT_M) == 0) {
|
||||||
out_info->features |= CHIP_FEATURE_BT | CHIP_FEATURE_BLE;
|
out_info->features |= CHIP_FEATURE_BT | CHIP_FEATURE_BLE;
|
||||||
}
|
}
|
||||||
int package = (reg & EFUSE_RD_CHIP_VER_PKG_M) >> EFUSE_RD_CHIP_VER_PKG_S;
|
int package = (efuse_rd3 & EFUSE_RD_CHIP_VER_PKG_M) >> EFUSE_RD_CHIP_VER_PKG_S;
|
||||||
if (package == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 ||
|
if (package == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 ||
|
||||||
package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 ||
|
package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 ||
|
||||||
package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
|
package == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
|
||||||
out_info->features |= CHIP_FEATURE_EMB_FLASH;
|
out_info->features |= CHIP_FEATURE_EMB_FLASH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp_chip_info(esp_chip_info_t* out_info)
|
|
||||||
{
|
|
||||||
// Only ESP32 is supported now, in the future call one of the
|
|
||||||
// chip-specific functions based on sdkconfig choice
|
|
||||||
return get_chip_info_esp32(out_info);
|
|
||||||
}
|
|
||||||
|
@ -31,6 +31,10 @@ endif
|
|||||||
|
|
||||||
ESPTOOL_ELF2IMAGE_OPTIONS :=
|
ESPTOOL_ELF2IMAGE_OPTIONS :=
|
||||||
|
|
||||||
|
ifdef CONFIG_ESP32_REV_MIN
|
||||||
|
ESPTOOL_ELF2IMAGE_OPTIONS += --min-rev $(CONFIG_ESP32_REV_MIN)
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_SECURE_BOOT_ENABLED
|
ifdef CONFIG_SECURE_BOOT_ENABLED
|
||||||
ifndef CONFIG_SECURE_BOOT_ALLOW_SHORT_APP_PARTITION
|
ifndef CONFIG_SECURE_BOOT_ALLOW_SHORT_APP_PARTITION
|
||||||
ifndef IS_BOOTLOADER_BUILD
|
ifndef IS_BOOTLOADER_BUILD
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 9ad444a6e06e58833d5e6044c1d5f3eb3dd56023
|
Subproject commit 4f1e825d2d1ee33b896b3977905fb29ac6cc0794
|
@ -16,6 +16,10 @@ set(ESPTOOLPY_ELF2IMAGE_FLASH_OPTIONS
|
|||||||
--flash_size ${ESPFLASHSIZE}
|
--flash_size ${ESPFLASHSIZE}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CONFIG_ESP32_REV_MIN)
|
||||||
|
set(ESPTOOLPY_ELF2IMAGE_OPTIONS ${ESPTOOLPY_ELF2IMAGE_OPTIONS} --min-rev ${CONFIG_ESP32_REV_MIN})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ESPTOOLPY_FLASHSIZE_DETECT)
|
if(CONFIG_ESPTOOLPY_FLASHSIZE_DETECT)
|
||||||
# Set ESPFLASHSIZE to 'detect' *after* elf2image options are generated,
|
# Set ESPFLASHSIZE to 'detect' *after* elf2image options are generated,
|
||||||
# as elf2image can't have 'detect' as an option...
|
# as elf2image can't have 'detect' as an option...
|
||||||
|
@ -48,7 +48,7 @@ extern "C" {
|
|||||||
// After completing read operations, use DPORT_STALL_OTHER_CPU_END().
|
// After completing read operations, use DPORT_STALL_OTHER_CPU_END().
|
||||||
// This method uses stall other CPU while reading DPORT registers.
|
// This method uses stall other CPU while reading DPORT registers.
|
||||||
// Useful for compatibility, as well as for large consecutive readings.
|
// Useful for compatibility, as well as for large consecutive readings.
|
||||||
// This method is slower, but must be used if ROM functions or
|
// This method is slower, but must be used if ROM functions or
|
||||||
// other code is called which accesses DPORT without any other workaround.
|
// other code is called which accesses DPORT without any other workaround.
|
||||||
// *) The pre-readable APB register before reading the DPORT register
|
// *) The pre-readable APB register before reading the DPORT register
|
||||||
// helps synchronize the operation of the two CPUs,
|
// helps synchronize the operation of the two CPUs,
|
||||||
@ -73,7 +73,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
|
static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
|
||||||
{
|
{
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
return _DPORT_REG_READ(reg);
|
return _DPORT_REG_READ(reg);
|
||||||
#else
|
#else
|
||||||
return esp_dport_access_reg_read(reg);
|
return esp_dport_access_reg_read(reg);
|
||||||
@ -106,7 +106,7 @@ static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t IRAM_ATTR DPORT_SEQUENCE_REG_READ(uint32_t reg)
|
static inline uint32_t IRAM_ATTR DPORT_SEQUENCE_REG_READ(uint32_t reg)
|
||||||
{
|
{
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
return _DPORT_REG_READ(reg);
|
return _DPORT_REG_READ(reg);
|
||||||
#else
|
#else
|
||||||
return esp_dport_access_sequence_reg_read(reg);
|
return esp_dport_access_sequence_reg_read(reg);
|
||||||
@ -166,7 +166,7 @@ static inline uint32_t IRAM_ATTR DPORT_SEQUENCE_REG_READ(uint32_t reg)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t reg)
|
static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t reg)
|
||||||
{
|
{
|
||||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||||
return _DPORT_REG_READ(reg);
|
return _DPORT_REG_READ(reg);
|
||||||
#else
|
#else
|
||||||
return esp_dport_access_reg_read(reg);
|
return esp_dport_access_reg_read(reg);
|
||||||
|
@ -150,7 +150,7 @@
|
|||||||
|
|
||||||
#define IS_DPORT_REG(_r) (((_r) >= DR_REG_DPORT_BASE) && (_r) <= DR_REG_DPORT_END)
|
#define IS_DPORT_REG(_r) (((_r) >= DR_REG_DPORT_BASE) && (_r) <= DR_REG_DPORT_END)
|
||||||
|
|
||||||
#if !defined( BOOTLOADER_BUILD ) && !defined( CONFIG_FREERTOS_UNICORE ) && defined( ESP_PLATFORM )
|
#if !defined( BOOTLOADER_BUILD ) && defined( CONFIG_ESP32_DPORT_WORKAROUND ) && defined( ESP_PLATFORM )
|
||||||
#define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
|
#define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
|
||||||
#else
|
#else
|
||||||
#define ASSERT_IF_DPORT_REG(_r, OP)
|
#define ASSERT_IF_DPORT_REG(_r, OP)
|
||||||
|
Loading…
Reference in New Issue
Block a user