From 2816ff14e4e0b82c742a5f2b22d86f96893e1d80 Mon Sep 17 00:00:00 2001 From: zhangwenxu Date: Thu, 23 Feb 2023 17:15:36 +0800 Subject: [PATCH 1/3] ieee802154: add support for esp32h2 --- components/esp_phy/CMakeLists.txt | 9 +++----- components/esp_phy/Kconfig | 1 + .../esp_phy/esp32h2/include/phy_init_data.h | 22 +++++++++++++++++++ components/ieee802154/lib | 2 +- .../esp32h2/include/soc/Kconfig.soc_caps.in | 4 ++++ components/soc/esp32h2/include/soc/soc_caps.h | 6 ++--- .../soc/esp32h2/ld/esp32h2.peripherals.ld | 1 + 7 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 components/esp_phy/esp32h2/include/phy_init_data.h diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index 0a74f6f247..5f11862adc 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -1,10 +1,5 @@ idf_build_get_property(idf_target IDF_TARGET) -if(IDF_TARGET STREQUAL "esp32h2") - # TODO : IDF-6337 - return() -endif() - set(srcs "src/phy_override.c" "src/lib_printf.c") if(CONFIG_APP_NO_BLOBS) @@ -21,12 +16,13 @@ else() list(APPEND srcs "src/phy_init.c") endif() -if(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED) +if(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED OR CONFIG_SOC_IEEE802154_BLE_ONLY) list(APPEND srcs "src/btbb_init.c") endif() idf_build_get_property(build_dir BUILD_DIR) +if(CONFIG_SOC_WIFI_SUPPORTED) if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN) if(NOT EXISTS "${build_dir}/phy_multiple_init_data.bin") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin DESTINATION "${build_dir}") @@ -36,6 +32,7 @@ endif() if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED) set(embed_files "${build_dir}/phy_multiple_init_data.bin") endif() +endif() # [refactor-todo]: requires "driver" component for periph_ctrl header file idf_component_register(SRCS "${srcs}" diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index 58a6b2d3d3..d9a5cd2275 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -17,6 +17,7 @@ menu "PHY" menuconfig ESP_PHY_INIT_DATA_IN_PARTITION bool "Use a partition to store PHY init data" + depends on SOC_WIFI_SUPPORTED default n help If enabled, PHY init data will be loaded from a partition. diff --git a/components/esp_phy/esp32h2/include/phy_init_data.h b/components/esp_phy/esp32h2/include/phy_init_data.h new file mode 100644 index 0000000000..f5c2bdc8a2 --- /dev/null +++ b/components/esp_phy/esp32h2/include/phy_init_data.h @@ -0,0 +1,22 @@ +/* + * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef PHY_INIT_DATA_H +#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ +#include "esp_phy_init.h" +#include "sdkconfig.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// There is no init data for ESP32H2 right now, could be added when necessary. + +#ifdef __cplusplus +} +#endif + +#endif /* PHY_INIT_DATA_H */ diff --git a/components/ieee802154/lib b/components/ieee802154/lib index 5d03fb6420..9b0e23edec 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit 5d03fb64207e7769319891fe99292c9c471db7ba +Subproject commit 9b0e23edec879fc3fd46908bc3629dbd2a33359b diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 6af4dc522b..e7958b99e9 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -39,6 +39,10 @@ config SOC_GPTIMER_SUPPORTED bool default y +config SOC_IEEE802154_SUPPORTED + bool + default y + config SOC_IEEE802154_BLE_ONLY bool default y diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index b1302fe576..26eef4a8c6 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -34,9 +34,9 @@ #define SOC_MCPWM_SUPPORTED 1 #define SOC_TWAI_SUPPORTED 1 // #define SOC_BT_SUPPORTED 1 // TODO: IDF-6416 -// #define SOC_IEEE802154_SUPPORTED 1 // TODO: IDF-6577 -#define SOC_GPTIMER_SUPPORTED 1 -#define SOC_IEEE802154_BLE_ONLY 1 +#define SOC_GPTIMER_SUPPORTED 1 +#define SOC_IEEE802154_SUPPORTED 1 +#define SOC_IEEE802154_BLE_ONLY 1 #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 #define SOC_TEMP_SENSOR_SUPPORTED 1 // #define SOC_SUPPORTS_SECURE_DL_MODE 1 // TODO: IDF-6281 diff --git a/components/soc/esp32h2/ld/esp32h2.peripherals.ld b/components/soc/esp32h2/ld/esp32h2.peripherals.ld index 10839b12f9..c6927ba776 100644 --- a/components/soc/esp32h2/ld/esp32h2.peripherals.ld +++ b/components/soc/esp32h2/ld/esp32h2.peripherals.ld @@ -66,3 +66,4 @@ PROVIDE ( LP_PERI = 0x600B2800 ); PROVIDE ( LP_ANA_PERI = 0x600B2C00 ); PROVIDE ( LP_APM = 0x600B3800 ); PROVIDE ( OTP_DEBUG = 0x600B3C00 ); +PROVIDE ( IEEE802154 = 0x600A3000 ); From 4bf62250fb77ee7db744ed10244b55cb7fcac6d1 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Fri, 24 Feb 2023 16:02:12 +0800 Subject: [PATCH 2/3] CI: add openthread build CI for ESP32-H2 --- components/ieee802154/lib | 2 +- examples/openthread/.build-test-rules.yml | 10 +++++++--- examples/openthread/ot_cli/README.md | 4 ++-- examples/openthread/ot_rcp/README.md | 4 ++-- examples/openthread/pytest_otbr.py | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/ieee802154/lib b/components/ieee802154/lib index 9b0e23edec..d9da61a6f6 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit 9b0e23edec879fc3fd46908bc3629dbd2a33359b +Subproject commit d9da61a6f6ee3ebf8176a1467fd32addfc3a0d04 diff --git a/examples/openthread/.build-test-rules.yml b/examples/openthread/.build-test-rules.yml index 96641da7c2..d864f9233b 100644 --- a/examples/openthread/.build-test-rules.yml +++ b/examples/openthread/.build-test-rules.yml @@ -12,12 +12,16 @@ examples/openthread/ot_br: examples/openthread/ot_cli: enable: - - if: IDF_TARGET in ["esp32h4", "esp32c6"] + - if: IDF_TARGET in ["esp32h2", "esp32h4", "esp32c6"] + disable_test: + - if: IDF_TARGET == "esp32h2" + temporary: true + reason: test on esp32h4 and esp32c6 examples/openthread/ot_rcp: enable: - - if: IDF_TARGET in ["esp32h4", "esp32c6"] + - if: IDF_TARGET in ["esp32h2", "esp32h4", "esp32c6"] disable_test: - - if: IDF_TARGET == "esp32c6" + - if: IDF_TARGET in ["esp32h2", "esp32c6"] temporary: true reason: only test on esp32h4 diff --git a/examples/openthread/ot_cli/README.md b/examples/openthread/ot_cli/README.md index 24bf10569f..97839575b1 100644 --- a/examples/openthread/ot_cli/README.md +++ b/examples/openthread/ot_cli/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-C6 | ESP32-H4 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-C6 | ESP32-H2 | ESP32-H4 | +| ----------------- | -------- | -------- | -------- | # OpenThread Command Line Example diff --git a/examples/openthread/ot_rcp/README.md b/examples/openthread/ot_rcp/README.md index 49b76464d8..c8ebe57cd7 100644 --- a/examples/openthread/ot_rcp/README.md +++ b/examples/openthread/ot_rcp/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-C6 | ESP32-H4 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-C6 | ESP32-H2 | ESP32-H4 | +| ----------------- | -------- | -------- | -------- | # OpenThread Radio Co-Processor (RCP) Example diff --git a/examples/openthread/pytest_otbr.py b/examples/openthread/pytest_otbr.py index b4085b0066..223a2be7c4 100644 --- a/examples/openthread/pytest_otbr.py +++ b/examples/openthread/pytest_otbr.py @@ -70,6 +70,7 @@ default_cli_ot_para = ocf.thread_parameter('router', '', '12', '', False) # Case 1: Thread network formation and attaching @pytest.mark.esp32s3 +@pytest.mark.esp32h2 @pytest.mark.esp32h4 @pytest.mark.esp32c6 @pytest.mark.openthread_br From 967bfb603cd1db58f7bcc7208f9ba35784f06199 Mon Sep 17 00:00:00 2001 From: xiaqilin Date: Tue, 28 Feb 2023 19:59:28 +0800 Subject: [PATCH 3/3] ieee802154: update 154 lib for esp32h2 and esp32c6 * Add support esp32h2 * Change esp32c6 using modem clock --- components/ieee802154/lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ieee802154/lib b/components/ieee802154/lib index d9da61a6f6..4f45ad079c 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit d9da61a6f6ee3ebf8176a1467fd32addfc3a0d04 +Subproject commit 4f45ad079c45936bf837f8873736f468cef705d0