Skip to content

Commit

Permalink
Merge branch 'espressif:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ariken74 authored Feb 14, 2025
2 parents c3f63d1 + 0d6099e commit a21216a
Show file tree
Hide file tree
Showing 715 changed files with 14,588 additions and 16,613 deletions.
1 change: 1 addition & 0 deletions .gitlab/ci/default-build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
extra_default_build_targets:
- esp32c5
- esp32c61
- esp32h21

bypass_check_test_targets:
- esp32h21
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/ci/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ check_docs_lang_sync:
parallel:
matrix:
- DOCLANG: ["en", "zh_CN"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5","esp32h2", "esp32p4"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5","esp32h2", "esp32h21", "esp32p4"]

check_docs_gh_links:
image: $ESP_IDF_DOC_ENV_IMAGE
Expand Down
8 changes: 8 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ mainmenu "Espressif IoT Development Framework Configuration"
select IDF_ENV_FPGA
select IDF_ENV_BRINGUP

config IDF_TARGET_ESP32H4
bool
default "y" if IDF_TARGET="esp32h4"
select IDF_TARGET_ARCH_RISCV
select IDF_ENV_FPGA
select IDF_ENV_BRINGUP

config IDF_TARGET_LINUX
bool
default "y" if IDF_TARGET="linux"
Expand All @@ -161,6 +168,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
default 0x0017 if IDF_TARGET_ESP32C5
default 0x0014 if IDF_TARGET_ESP32C61
default 0x0019 if IDF_TARGET_ESP32H21
default 0x001C if IDF_TARGET_ESP32H4
default 0xFFFF


Expand Down
4 changes: 2 additions & 2 deletions components/app_trace/test_apps/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ components/app_trace/test_apps:
- driver
- esp_hw_support
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c5", "esp32c61", "esp32h21"]
temporary: true
reason: not support yet # TODO: [ESP32C5] IDF-8705, [ESP32C61] IDF-9306
reason: not support yet # TODO: [ESP32C5] IDF-8705, [ESP32C61] IDF-9306, [ESP32H21] IDF-11539
85 changes: 75 additions & 10 deletions components/app_update/esp_ota_ops.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -47,6 +47,7 @@ typedef struct ota_ops_entry_ {
bool need_erase;
uint32_t wrote_size;
uint8_t partial_bytes;
bool ota_resumption;
WORD_ALIGNED_ATTR uint8_t partial_data[16];
LIST_ENTRY(ota_ops_entry_) entries;
} ota_ops_entry_t;
Expand Down Expand Up @@ -119,6 +120,24 @@ static esp_ota_img_states_t set_new_state_otadata(void)
#endif
}

static ota_ops_entry_t* esp_ota_init_entry(const esp_partition_t *partition)
{
ota_ops_entry_t *new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
if (new_entry == NULL) {
return NULL;
}

LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);

new_entry->partition.staging = partition;
new_entry->partition.final = partition;
new_entry->partition.finalize_with_copy = false;
new_entry->handle = ++s_ota_ops_last_handle;

return new_entry;
}


esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp_ota_handle_t *out_handle)
{
ota_ops_entry_t *new_entry;
Expand Down Expand Up @@ -153,17 +172,10 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
#endif
}

new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
new_entry = esp_ota_init_entry(partition);
if (new_entry == NULL) {
return ESP_ERR_NO_MEM;
}

LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);

new_entry->partition.staging = partition;
new_entry->partition.final = partition;
new_entry->partition.finalize_with_copy = false;
new_entry->handle = ++s_ota_ops_last_handle;
new_entry->need_erase = (image_size == OTA_WITH_SEQUENTIAL_WRITES);
*out_handle = new_entry->handle;

Expand Down Expand Up @@ -197,6 +209,54 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
return ESP_OK;
}

esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle)
{
ota_ops_entry_t *new_entry;

if ((partition == NULL) || (out_handle == NULL)) {
return ESP_ERR_INVALID_ARG;
}

if (image_offset > partition->size) {
return ESP_ERR_INVALID_ARG;
}

partition = esp_partition_verify(partition);
if (partition == NULL) {
return ESP_ERR_NOT_FOUND;
}

if (partition->type == ESP_PARTITION_TYPE_APP) {
// The staging partition cannot be of type Factory, but the final partition can be.
if (!is_ota_partition(partition)) {
return ESP_ERR_INVALID_ARG;
}
}

const esp_partition_t* running_partition = esp_ota_get_running_partition();
if (partition == running_partition) {
return ESP_ERR_OTA_PARTITION_CONFLICT;
}

new_entry = esp_ota_init_entry(partition);
if (new_entry == NULL) {
return ESP_ERR_NO_MEM;
}

if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER) {
esp_image_bootloader_offset_set(partition->address);
}
if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER || partition->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
esp_flash_set_dangerous_write_protection(esp_flash_default_chip, false);
}

new_entry->ota_resumption = true;
new_entry->wrote_size = image_offset;
new_entry->need_erase = (erase_size == OTA_WITH_SEQUENTIAL_WRITES);
*out_handle = new_entry->handle;
return ESP_OK;
}

esp_err_t esp_ota_set_final_partition(esp_ota_handle_t handle, const esp_partition_t *final, bool finalize_with_copy)
{
ota_ops_entry_t *it = get_ota_ops_entry(handle);
Expand All @@ -206,9 +266,14 @@ esp_err_t esp_ota_set_final_partition(esp_ota_handle_t handle, const esp_partiti
if (it == NULL) {
return ESP_ERR_NOT_FOUND;
}
if (it->wrote_size != 0) {

// If OTA resumption is enabled, it->wrote_size may already contain the size of previously written data.
// Ensure that wrote_size is zero only when OTA resumption is disabled, as any non-zero value in this case
// indicates an invalid state.
if (!it->ota_resumption && it->wrote_size != 0) {
return ESP_ERR_INVALID_STATE;
}

if (it->partition.staging != final) {
const esp_partition_t* final_partition = esp_partition_verify(final);
if (final_partition == NULL) {
Expand Down
26 changes: 26 additions & 0 deletions components/app_update/include/esp_ota_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@ int esp_ota_get_app_elf_sha256(char* dst, size_t size) __attribute__((deprecated
*/
esp_err_t esp_ota_begin(const esp_partition_t* partition, size_t image_size, esp_ota_handle_t* out_handle);

/**
* @brief Resume an interrupted OTA update by continuing to write to the specified partition.
*
* This function is used when an OTA update was previously started and needs to be resumed after an interruption.
* It continues the OTA process from the specified offset within the partition.
*
* Unlike esp_ota_begin(), this function does not erase the partition which receives the OTA update, but rather expects that part of the image
* has already been written correctly, and it resumes writing from the given offset.
*
* @param partition Pointer to info for the partition which is receiving the OTA update. Required.
* @param erase_size Specifies how much flash memory to erase before resuming OTA, depending on whether a sequential write or a bulk erase is being used.
* @param image_offset Offset from where to resume the OTA process. Should be set to the number of bytes already written.
* @param out_handle On success, returns a handle that should be used for subsequent esp_ota_write() and esp_ota_end() calls.
*
* @return
* - ESP_OK: OTA operation resumed successfully.
* - ESP_ERR_INVALID_ARG: partition, out_handle were NULL or image_offset arguments is negative, or partition doesn't point to an OTA app partition.
* - ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
* - ESP_ERR_OTA_PARTITION_CONFLICT: Partition holds the currently running firmware, cannot update in place.
* - ESP_ERR_NOT_FOUND: Partition argument not found in partition table.
* - ESP_ERR_OTA_SELECT_INFO_INVALID: The OTA data partition contains invalid data.
* - ESP_ERR_INVALID_SIZE: Partition doesn't fit in configured flash size.
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
*/
esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle);

/**
* @brief Set the final destination partition for OTA update
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ components/app_update/test_apps:
# S2 doesn't have ROM for flash
- if: CONFIG_NAME == "xip_psram_with_rom_impl" and IDF_TARGET in ["esp32s3", "esp32p4"]
disable:
- if: IDF_TARGET in ["esp32c61"]
- if: IDF_TARGET in ["esp32c61", "esp32h21"]
temporary: true
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245
reason: not supported yet # TODO: [ESP32C61] IDF-9245, [ESP32H21] IDF-11515
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bootloader_usable_dram_end = 0x3fcdcb70;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2000;
bootloader_iram_seg_len = 0x2800;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bootloader_usable_dram_end = 0x3fcdc710;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2000;
bootloader_iram_seg_len = 0x2800;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bootloader_usable_dram_end = 0x4085c9a0;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2200;
bootloader_iram_seg_len = 0x2A00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bootloader_usable_dram_end = 0x4087c610;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2500;
bootloader_iram_seg_len = 0x2D00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bootloader_usable_dram_end = 0x4084ca70;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2500;
bootloader_iram_seg_len = 0x2D00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bootloader_usable_dram_end = 0x4084cfd0;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2500;
bootloader_iram_seg_len = 0x2D00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bootloader_usable_dram_end = 0x40849a78;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2500;
bootloader_iram_seg_len = 0x2D00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bootloader_usable_dram_end = 0x4ff3abd0;
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
bootloader_dram_seg_len = 0x5000;
bootloader_iram_loader_seg_len = 0x7000;
bootloader_iram_seg_len = 0x2000;
bootloader_iram_seg_len = 0x2D00;

/* Start of the lower region is determined by region size and the end of the higher region */
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -752,6 +752,15 @@ esp_err_t IRAM_ATTR bootloader_flash_unlock_default(void)

esp_err_t __attribute__((weak, alias("bootloader_flash_unlock_default"))) bootloader_flash_unlock(void);


#if CONFIG_SECURE_TEE_EXT_FLASH_MEMPROT_SPI1 && !NON_OS_BUILD
extern uint32_t bootloader_flash_execute_command_common(
uint8_t command,
uint32_t addr_len, uint32_t address,
uint8_t dummy_len,
uint8_t mosi_len, uint32_t mosi_data,
uint8_t miso_len);
#else
IRAM_ATTR uint32_t bootloader_flash_execute_command_common(
uint8_t command,
uint32_t addr_len, uint32_t address,
Expand Down Expand Up @@ -804,6 +813,7 @@ IRAM_ATTR uint32_t bootloader_flash_execute_command_common(
}
return ret;
}
#endif

uint32_t IRAM_ATTR bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
{
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ static esp_err_t check_and_generate_encryption_keys(void)
if (tmp_has_key) { // For ESP32: esp_efuse_find_purpose() always returns True, need to check whether the key block is used or not.
tmp_has_key &= !esp_efuse_key_block_unused(blocks[i]);
}
#if CONFIG_SECURE_FLASH_ENCRYPTION_AES256
if (i == 1 && tmp_has_key != has_key) {
ESP_LOGE(TAG, "Invalid efuse key blocks: Both AES-256 key blocks must be set.");
return ESP_ERR_INVALID_STATE;
}
#endif
has_key &= tmp_has_key;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- |
6 changes: 6 additions & 0 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set(common_include_dirs
common/btc/profile/esp/blufi/include
common/btc/profile/esp/include
common/hci_log/include
common/ble_log/include
)

set(ble_mesh_include_dirs
Expand Down Expand Up @@ -132,6 +133,10 @@ if(CONFIG_BT_ENABLED)
"porting/mem/bt_osi_mem.c"
)

if(CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED)
list(APPEND srcs "common/ble_log/ble_log_spi_out.c")
endif()

# Host Bluedroid
if(CONFIG_BT_BLUEDROID_ENABLED)

Expand Down Expand Up @@ -872,6 +877,7 @@ idf_component_register(SRCS "${srcs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls esp_driver_uart vfs esp_ringbuf
esp_driver_spi
LDFRAGMENTS "${ldscripts}")

if(CONFIG_BT_ENABLED)
Expand Down
Loading

0 comments on commit a21216a

Please sign in to comment.