Skip to content

Commit

Permalink
Merge branch 'espressif:release/v5.3' into release/v5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Sep 25, 2024
2 parents 71a0700 + 22858c3 commit 6a2a00a
Show file tree
Hide file tree
Showing 221 changed files with 10,885 additions and 2,442 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,ot
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,ot,wel
write-changes = true
1 change: 0 additions & 1 deletion .gitlab/ci/default-build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# This file should ONLY be used during bringup. Should be reset to empty after the bringup process
extra_default_build_targets:
- esp32p4
- esp32c5

bypass_check_test_targets:
- esp32c5
Expand Down
8 changes: 7 additions & 1 deletion components/bootloader/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ menu "Bootloader config"
help
This is a helper config for 32bits address flash. Invisible for users.

config BOOTLOADER_FLASH_NEEDS_32BIT_ADDR_QUAD_FLASH
bool
default y if BOOTLOADER_FLASH_NEEDS_32BIT_FEAT && SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP
help
This is a helper config for 32bits address quad flash. Invisible for users.

config BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
bool "Enable cache access to 32-bit-address (over 16MB) range of SPI Flash (READ DOCS FIRST)"
depends on BOOTLOADER_FLASH_NEEDS_32BIT_FEAT && IDF_TARGET_ESP32S3 && IDF_EXPERIMENTAL_FEATURES
depends on BOOTLOADER_FLASH_NEEDS_32BIT_ADDR_QUAD_FLASH && IDF_EXPERIMENTAL_FEATURES
default n
help
Enabling this option allows the CPU to access 32-bit-address flash beyond 16M range.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)

#if CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/opi_flash.h"
#elif CONFIG_IDF_TARGET_ESP32P4
#include "esp32p4/rom/opi_flash.h"
#endif
static const char *TAG = "bootloader_flash";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ static void update_flash_config(const esp_image_header_t *bootloader_hdr)
case ESP_IMAGE_FLASH_SIZE_16MB:
size = 16;
break;
case ESP_IMAGE_FLASH_SIZE_32MB:
size = 32;
break;
case ESP_IMAGE_FLASH_SIZE_64MB:
size = 64;
break;
case ESP_IMAGE_FLASH_SIZE_128MB:
size = 128;
break;
default:
size = 2;
}
Expand Down Expand Up @@ -175,6 +184,15 @@ static void print_flash_info(const esp_image_header_t *bootloader_hdr)
case ESP_IMAGE_FLASH_SIZE_16MB:
str = "16MB";
break;
case ESP_IMAGE_FLASH_SIZE_32MB:
str = "32MB";
break;
case ESP_IMAGE_FLASH_SIZE_64MB:
str = "64MB";
break;
case ESP_IMAGE_FLASH_SIZE_128MB:
str = "128MB";
break;
default:
str = "2MB";
break;
Expand Down Expand Up @@ -203,6 +221,9 @@ esp_err_t bootloader_init_spi_flash(void)
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
#endif
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
bootloader_flash_32bits_address_map_enable(bootloader_flash_get_spi_mode());
#endif

print_flash_info(&bootloader_image_hdr);

Expand Down Expand Up @@ -271,6 +292,10 @@ void bootloader_flash_hardware_init(void)
bootloader_spi_flash_resume();
bootloader_flash_unlock();

#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
bootloader_flash_32bits_address_map_enable(bootloader_flash_get_spi_mode());
#endif

cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
update_flash_config(&hdr);
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
#include "hal/cache_hal.h"
#include "hal/clk_tree_ll.h"
#include "hal/lpwdt_ll.h"
#include "hal/spimem_flash_ll.h"
#include "soc/lp_wdt_reg.h"
#include "hal/efuse_hal.h"
#include "soc/regi2c_syspll.h"
#include "soc/regi2c_cpll.h"
#include "soc/regi2c_bias.h"
#include "esp_private/periph_ctrl.h"

static const char *TAG = "boot.esp32p4";

Expand Down Expand Up @@ -90,6 +92,7 @@ static void bootloader_super_wdt_auto_feed(void)

static inline void bootloader_hardware_init(void)
{
int __DECLARE_RCC_ATOMIC_ENV __attribute__ ((unused));
// regi2c is enabled by default on ESP32P4, do nothing
unsigned chip_version = efuse_hal_chip_revision();
if (!ESP_CHIP_REV_ABOVE(chip_version, 1)) {
Expand All @@ -101,6 +104,12 @@ static inline void bootloader_hardware_init(void)
}
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1, 10);
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1_PVT, 10);

// IDF-10019 TODO: This is temporarily for ESP32P4-ECO0, please remove it when eco0 is not widly used.
if (likely(ESP_CHIP_REV_ABOVE(chip_version, 1))) {
spimem_flash_ll_select_clk_source(0, FLASH_CLK_SRC_SPLL);
spimem_ctrlr_ll_set_core_clock(0, 6);
}
}

static inline void bootloader_ana_reset_config(void)
Expand Down
4 changes: 2 additions & 2 deletions components/bootloader_support/test_apps/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ components/bootloader_support/test_apps/rtc_custom_section:
- if: SOC_RTC_MEM_SUPPORTED == 1
reason: this feature is supported on chips that have RTC memory
disable:
- if: IDF_TARGET == "esp32c61"
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
temporary: true
reason: IDF-9260
reason: target(s) is not supported yet # IDF-9260
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-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
6 changes: 5 additions & 1 deletion components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,11 @@ if(CONFIG_BT_ENABLED)
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
elseif(CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
if(CONFIG_IDF_TARGET_ESP32C6)
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/esp32c6/libble_app.a")
else()
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
endif()
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
endif()

Expand Down
6 changes: 3 additions & 3 deletions components/bt/common/btc/core/btc_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ static bt_status_t btc_task_post(btc_msg_t *msg, uint32_t timeout)
/**
* transfer an message to another module in the different task.
* @param msg message
* @param arg paramter
* @param arg_len length of paramter
* @param arg parameter
* @param arg_len length of parameter
* @param copy_func deep copy function
* @param free_func deep free function
* @return BT_STATUS_SUCCESS: success
Expand Down Expand Up @@ -342,7 +342,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
}

/**
* transfer an message to another module in tha same task.
* transfer an message to another module in the same task.
* @param msg message
* @return BT_STATUS_SUCCESS: success
* others: fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ uint8_t esp_blufi_init(void)
void esp_blufi_deinit(void)
{
blufi_env.enabled = false;
btc_msg_t msg;
esp_blufi_cb_param_t param;
btc_msg_t msg;
memset (&msg, 0x0, sizeof (msg));
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_BLUFI;
msg.act = ESP_BLUFI_EVENT_DEINIT_FINISH;
param.deinit_finish.state = ESP_BLUFI_DEINIT_OK;
Expand Down
6 changes: 3 additions & 3 deletions components/bt/controller/esp32c3/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
bool "+15dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P18
bool "+18dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P21
bool "+21dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P20
bool "+20dBm"
endchoice

config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
Expand All @@ -221,7 +221,7 @@ config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P21
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P20
default 0

config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c2/esp32c2-bt-lib
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c3_family
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c6/esp32c6-bt-lib
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32h2/esp32h2-bt-lib
12 changes: 4 additions & 8 deletions components/bt/esp_ble_mesh/core/nimble_host/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,20 +1309,18 @@ int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc)
{
int rc;
uint16_t handle;
const ble_uuid_t *uuid;

if (!svc) {
BT_ERR("%s, Invalid parameter", __func__);
return -EINVAL;
}

if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL);
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL), &handle);
} else {
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL);
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL), &handle);
}

rc = ble_gatts_find_svc(uuid, &handle);
assert(rc == 0);
ble_gatts_svc_set_visibility(handle, 0);

Expand All @@ -1336,15 +1334,13 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
{
int rc;
uint16_t handle;
const ble_uuid_t *uuid;

if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL);
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL), &handle);
} else {
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL);
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL), &handle);
}

rc = ble_gatts_find_svc(uuid, &handle);
assert(rc == 0);
ble_gatts_svc_set_visibility(handle, 1);

Expand Down
18 changes: 17 additions & 1 deletion components/bt/esp_ble_mesh/lib/ext.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -8,6 +8,8 @@
#include <string.h>
#include <assert.h>

#include "esp_log.h"

#if CONFIG_BT_BLUEDROID_ENABLED
#include "bta/bta_api.h"
#endif
Expand Down Expand Up @@ -190,6 +192,11 @@ void bt_mesh_ext_mem_swap(void *buf, size_t length)
sys_mem_swap(buf, length);
}

uint32_t bt_mesh_ext_log_timestamp(void)
{
return esp_log_timestamp();
}

/* Net buf */
void bt_mesh_ext_buf_simple_init(struct net_buf_simple *buf, size_t reserve_head)
{
Expand Down Expand Up @@ -498,6 +505,11 @@ float bt_mesh_ext_log2(float num)
return bt_mesh_log2(num);
}

const char *bt_mesh_ext_hex(const void *buf, size_t len)
{
return bt_hex(buf, len);
}

/* Crypto */
bool bt_mesh_ext_s1(const char *m, uint8_t salt[16])
{
Expand Down Expand Up @@ -3954,6 +3966,8 @@ void bt_mesh_ext_mbt_server_cb_evt_to_btc(uint8_t event, void *model, void *ctx)
}

typedef struct {
uint64_t config_ble_mesh_stack_trace_level : 3;

uint64_t config_ble_mesh_use_duplicate_scan : 1;
uint64_t config_ble_mesh_pb_adv : 1;
uint64_t config_ble_mesh_pb_gatt : 1;
Expand Down Expand Up @@ -4116,6 +4130,8 @@ typedef struct {
} bt_mesh_ext_config_t;

static const bt_mesh_ext_config_t bt_mesh_ext_cfg = {
.config_ble_mesh_stack_trace_level = BLE_MESH_LOG_LEVEL,

.config_ble_mesh_use_duplicate_scan = IS_ENABLED(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN),
.config_ble_mesh_pb_adv = IS_ENABLED(CONFIG_BLE_MESH_PB_ADV),
.config_ble_mesh_pb_gatt = IS_ENABLED(CONFIG_BLE_MESH_PB_GATT),
Expand Down
6 changes: 4 additions & 2 deletions components/bt/esp_ble_mesh/models/server/time_scene_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ static void time_get(struct bt_mesh_model *model,
change.time_status.subsecond = srv->state->time.subsecond;
change.time_status.uncertainty = srv->state->time.uncertainty;
change.time_status.time_authority = srv->state->time.time_authority;
change.time_status.tai_utc_delta_curr = srv->state->time.subsecond;
change.time_status.tai_utc_delta_curr = srv->state->time.tai_utc_delta_curr;
change.time_status.time_zone_offset_curr = srv->state->time.time_zone_offset_curr;
bt_mesh_time_scene_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_STATE_CHANGE,
model, ctx, (const uint8_t *)&change, sizeof(change));

Expand Down Expand Up @@ -386,7 +387,8 @@ static void time_set(struct bt_mesh_model *model,
change.time_set.subsecond = srv->state->time.subsecond;
change.time_set.uncertainty = srv->state->time.uncertainty;
change.time_set.time_authority = srv->state->time.time_authority;
change.time_set.tai_utc_delta_curr = srv->state->time.subsecond;
change.time_set.tai_utc_delta_curr = srv->state->time.tai_utc_delta_curr;
change.time_set.time_zone_offset_curr = srv->state->time.time_zone_offset_curr;
break;
case BLE_MESH_MODEL_OP_TIME_ZONE_SET:
change.time_zone_set.time_zone_offset_new = srv->state->time.time_zone_offset_new;
Expand Down
26 changes: 21 additions & 5 deletions components/bt/host/bluedroid/api/esp_sdp_api.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -15,6 +15,24 @@

#if (defined BTC_SDP_INCLUDED && BTC_SDP_INCLUDED == TRUE)

static bool esp_sdp_record_integrity_check(esp_bluetooth_sdp_record_t *record)
{
bool ret = true;

if (record != NULL) {
if (record->hdr.service_name_length > ESP_SDP_SERVER_NAME_MAX ||
strlen(record->hdr.service_name) + 1 != record->hdr.service_name_length) {
LOG_ERROR("Invalid server name!\n");
ret = false;
}
} else {
LOG_ERROR("record is NULL!\n");
ret = false;
}

return ret;
}

esp_err_t esp_sdp_register_callback(esp_sdp_cb_t callback)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
Expand Down Expand Up @@ -85,9 +103,7 @@ esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (record == NULL || record->hdr.service_name_length > ESP_SDP_SERVER_NAME_MAX
|| strlen(record->hdr.service_name)+1 != record->hdr.service_name_length) {
LOG_ERROR("Invalid server name!\n");
if (!esp_sdp_record_integrity_check(record)) {
return ESP_ERR_INVALID_ARG;
}

Expand All @@ -100,7 +116,7 @@ esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record)
msg.act = BTC_SDP_ACT_CREATE_RECORD;

memset(&arg, 0, sizeof(btc_sdp_args_t));
arg.creat_record.record = (bluetooth_sdp_record *)record;
arg.create_record.record = (bluetooth_sdp_record *)record;

/* Switch to BTC context */
stat = btc_transfer_context(&msg, &arg, sizeof(btc_sdp_args_t),
Expand Down
Loading

0 comments on commit 6a2a00a

Please sign in to comment.