From ee02b71f1c1c0eb42667832bbaafa5ffeee85b6e Mon Sep 17 00:00:00 2001 From: wanlei Date: Mon, 26 Feb 2024 11:29:46 +0800 Subject: [PATCH] feat(esp32c61): introduce target esp32c61 --- Kconfig | 8 +++++++ .../src/bootloader_flash_config_esp32c61.c | 0 components/bt/controller/esp32c61/Kconfig.in | 0 components/esp_adc/esp32c61/include/.gitkeep | 0 components/esp_driver_uart/CMakeLists.txt | 23 ++++++++++--------- .../esp_hw_support/include/esp_chip_info.h | 1 + .../include/soc/esp32c61/.gitkeep | 0 .../port/esp32c61/CMakeLists.txt | 0 .../port/esp32c61/cpu_region_protect.c | 0 .../port/esp32c61/esp_clk_tree.c | 0 .../esp_hw_support/port/esp32c61/io_mux.c | 0 .../esp_mm/port/esp32c61/ext_mem_layout.c | 0 components/esp_phy/esp32c61/include/.gitkeep | 0 components/esp_rom/esp32c61/.gitkeep | 0 components/esp_rom/include/esp32c61/.gitkeep | 0 .../esp_system/ld/esp32c61/memory.ld.in | 0 .../esp_system/ld/esp32c61/sections.ld.in | 0 .../port/soc/esp32c61/CMakeLists.txt | 0 .../esp_system/port/soc/esp32c61/Kconfig.cpu | 0 .../port/soc/esp32c61/Kconfig.system | 0 components/hal/esp32c61/include/.gitkeep | 0 components/heap/port/esp32c61/memory_layout.c | 0 components/idf_test/include/esp32c61/.gitkeep | 0 components/soc/esp32c61/gpio_periph.c | 0 components/soc/esp32c61/interrupts.c | 0 components/soc/esp32c61/uart_periph.c | 0 tools/ci/check_build_test_rules.py | 2 ++ tools/cmake/dfu.cmake | 2 ++ tools/cmake/toolchain-esp32c61.cmake | 18 +++++++++++++++ tools/idf_py_actions/constants.py | 7 +++--- tools/tools.json | 9 +++++--- 31 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32c61.c create mode 100644 components/bt/controller/esp32c61/Kconfig.in create mode 100644 components/esp_adc/esp32c61/include/.gitkeep create mode 100644 components/esp_hw_support/include/soc/esp32c61/.gitkeep create mode 100644 components/esp_hw_support/port/esp32c61/CMakeLists.txt create mode 100644 components/esp_hw_support/port/esp32c61/cpu_region_protect.c create mode 100644 components/esp_hw_support/port/esp32c61/esp_clk_tree.c create mode 100644 components/esp_hw_support/port/esp32c61/io_mux.c create mode 100644 components/esp_mm/port/esp32c61/ext_mem_layout.c create mode 100644 components/esp_phy/esp32c61/include/.gitkeep create mode 100644 components/esp_rom/esp32c61/.gitkeep create mode 100644 components/esp_rom/include/esp32c61/.gitkeep create mode 100644 components/esp_system/ld/esp32c61/memory.ld.in create mode 100644 components/esp_system/ld/esp32c61/sections.ld.in create mode 100644 components/esp_system/port/soc/esp32c61/CMakeLists.txt create mode 100644 components/esp_system/port/soc/esp32c61/Kconfig.cpu create mode 100644 components/esp_system/port/soc/esp32c61/Kconfig.system create mode 100644 components/hal/esp32c61/include/.gitkeep create mode 100644 components/heap/port/esp32c61/memory_layout.c create mode 100644 components/idf_test/include/esp32c61/.gitkeep create mode 100644 components/soc/esp32c61/gpio_periph.c create mode 100644 components/soc/esp32c61/interrupts.c create mode 100644 components/soc/esp32c61/uart_periph.c create mode 100644 tools/cmake/toolchain-esp32c61.cmake diff --git a/Kconfig b/Kconfig index 1c6b973c44..fe4e12f863 100644 --- a/Kconfig +++ b/Kconfig @@ -151,6 +151,13 @@ mainmenu "Espressif IoT Development Framework Configuration" select FREERTOS_UNICORE select IDF_TARGET_ARCH_RISCV + config IDF_TARGET_ESP32C61 + bool + default "y" if IDF_TARGET="esp32c61" + select FREERTOS_UNICORE + select IDF_TARGET_ARCH_RISCV + select IDF_ENV_FPGA + config IDF_TARGET_LINUX bool default "y" if IDF_TARGET="linux" @@ -167,6 +174,7 @@ mainmenu "Espressif IoT Development Framework Configuration" default 0x0012 if IDF_TARGET_ESP32P4 default 0x0011 if IDF_TARGET_ESP32C5 && IDF_TARGET_ESP32C5_BETA3_VERSION # TODO: IDF-9197 default 0x0017 if IDF_TARGET_ESP32C5 && IDF_TARGET_ESP32C5_MP_VERSION # TODO: IDF-9197 + default 0x0014 if IDF_TARGET_ESP32C61 default 0xFFFF diff --git a/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32c61.c b/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32c61.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/bt/controller/esp32c61/Kconfig.in b/components/bt/controller/esp32c61/Kconfig.in new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_adc/esp32c61/include/.gitkeep b/components/esp_adc/esp32c61/include/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_driver_uart/CMakeLists.txt b/components/esp_driver_uart/CMakeLists.txt index e6046edd67..c489cab286 100644 --- a/components/esp_driver_uart/CMakeLists.txt +++ b/components/esp_driver_uart/CMakeLists.txt @@ -4,16 +4,17 @@ if(CONFIG_SOC_UART_SUPPORTED) list(APPEND srcs "src/uart.c") endif() -idf_component_register(SRCS ${srcs} - INCLUDE_DIRS ${public_include} - PRIV_REQUIRES esp_pm esp_driver_gpio esp_ringbuf - LDFRAGMENTS "linker.lf" - ) +idf_component_register( + SRCS ${srcs} + INCLUDE_DIRS ${public_include} + PRIV_REQUIRES esp_pm esp_driver_gpio esp_ringbuf + LDFRAGMENTS "linker.lf" +) -if(CONFIG_VFS_SUPPORT_IO) - target_link_libraries(${COMPONENT_LIB} PUBLIC idf::vfs) - target_sources(${COMPONENT_LIB} PRIVATE "src/uart_vfs.c") - if(CONFIG_ESP_CONSOLE_UART) - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u uart_vfs_include_dev_init") - endif() +if(CONFIG_VFS_SUPPORT_IO AND CONFIG_SOC_UART_SUPPORTED) + target_link_libraries(${COMPONENT_LIB} PUBLIC idf::vfs) + target_sources(${COMPONENT_LIB} PRIVATE "src/uart_vfs.c") + if(CONFIG_ESP_CONSOLE_UART) + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u uart_vfs_include_dev_init") + endif() endif() diff --git a/components/esp_hw_support/include/esp_chip_info.h b/components/esp_hw_support/include/esp_chip_info.h index afe1d811e8..ec5cb68d04 100644 --- a/components/esp_hw_support/include/esp_chip_info.h +++ b/components/esp_hw_support/include/esp_chip_info.h @@ -33,6 +33,7 @@ typedef enum { CHIP_ESP32C5 = 23, //!< ESP32-C5 MP #endif CHIP_ESP32P4 = 18, //!< ESP32-P4 + CHIP_ESP32C61= 20, //!< ESP32-C61 CHIP_POSIX_LINUX = 999, //!< The code is running on POSIX/Linux simulator } esp_chip_model_t; diff --git a/components/esp_hw_support/include/soc/esp32c61/.gitkeep b/components/esp_hw_support/include/soc/esp32c61/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_hw_support/port/esp32c61/CMakeLists.txt b/components/esp_hw_support/port/esp32c61/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_hw_support/port/esp32c61/cpu_region_protect.c b/components/esp_hw_support/port/esp32c61/cpu_region_protect.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_hw_support/port/esp32c61/esp_clk_tree.c b/components/esp_hw_support/port/esp32c61/esp_clk_tree.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_hw_support/port/esp32c61/io_mux.c b/components/esp_hw_support/port/esp32c61/io_mux.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_mm/port/esp32c61/ext_mem_layout.c b/components/esp_mm/port/esp32c61/ext_mem_layout.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_phy/esp32c61/include/.gitkeep b/components/esp_phy/esp32c61/include/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_rom/esp32c61/.gitkeep b/components/esp_rom/esp32c61/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_rom/include/esp32c61/.gitkeep b/components/esp_rom/include/esp32c61/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_system/ld/esp32c61/memory.ld.in b/components/esp_system/ld/esp32c61/memory.ld.in new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_system/ld/esp32c61/sections.ld.in b/components/esp_system/ld/esp32c61/sections.ld.in new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_system/port/soc/esp32c61/CMakeLists.txt b/components/esp_system/port/soc/esp32c61/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_system/port/soc/esp32c61/Kconfig.cpu b/components/esp_system/port/soc/esp32c61/Kconfig.cpu new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/esp_system/port/soc/esp32c61/Kconfig.system b/components/esp_system/port/soc/esp32c61/Kconfig.system new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/hal/esp32c61/include/.gitkeep b/components/hal/esp32c61/include/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/heap/port/esp32c61/memory_layout.c b/components/heap/port/esp32c61/memory_layout.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/idf_test/include/esp32c61/.gitkeep b/components/idf_test/include/esp32c61/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/soc/esp32c61/gpio_periph.c b/components/soc/esp32c61/gpio_periph.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/soc/esp32c61/interrupts.c b/components/soc/esp32c61/interrupts.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/soc/esp32c61/uart_periph.c b/components/soc/esp32c61/uart_periph.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/ci/check_build_test_rules.py b/tools/ci/check_build_test_rules.py index 4c3b6b4ae5..e2fff3bcda 100755 --- a/tools/ci/check_build_test_rules.py +++ b/tools/ci/check_build_test_rules.py @@ -35,6 +35,7 @@ USUAL_TO_FORMAL = { 'esp32c5': 'ESP32-C5', 'esp32h2': 'ESP32-H2', 'esp32p4': 'ESP32-P4', + 'esp32c61': 'ESP32-C61', 'linux': 'Linux', } @@ -48,6 +49,7 @@ FORMAL_TO_USUAL = { 'ESP32-C5': 'esp32c5', 'ESP32-H2': 'esp32h2', 'ESP32-P4': 'esp32p4', + 'ESP32-C61': 'esp32c61', 'Linux': 'linux', } diff --git a/tools/cmake/dfu.cmake b/tools/cmake/dfu.cmake index 4f58cd283d..3c77d1cd51 100644 --- a/tools/cmake/dfu.cmake +++ b/tools/cmake/dfu.cmake @@ -15,6 +15,8 @@ function(__add_dfu_targets) return() elseif("${target}" STREQUAL "esp32c6") return() + elseif("${target}" STREQUAL "esp32c61") + return() elseif("${target}" STREQUAL "esp32c5") return() elseif("${target}" STREQUAL "esp32h2") diff --git a/tools/cmake/toolchain-esp32c61.cmake b/tools/cmake/toolchain-esp32c61.cmake new file mode 100644 index 0000000000..6415daa59b --- /dev/null +++ b/tools/cmake/toolchain-esp32c61.cmake @@ -0,0 +1,18 @@ +include($ENV{IDF_PATH}/tools/cmake/utilities.cmake) + +set(CMAKE_SYSTEM_NAME Generic) + +set(CMAKE_C_COMPILER riscv32-esp-elf-gcc) +set(CMAKE_CXX_COMPILER riscv32-esp-elf-g++) +set(CMAKE_ASM_COMPILER riscv32-esp-elf-gcc) +set(_CMAKE_TOOLCHAIN_PREFIX riscv32-esp-elf-) + +remove_duplicated_flags("-march=rv32imac_zicsr_zifencei ${CMAKE_C_FLAGS}" UNIQ_CMAKE_C_FLAGS) +set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}" CACHE STRING "C Compiler Base Flags" FORCE) +remove_duplicated_flags("-march=rv32imac_zicsr_zifencei ${CMAKE_CXX_FLAGS}" UNIQ_CMAKE_CXX_FLAGS) +set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}" CACHE STRING "C++ Compiler Base Flags" FORCE) + +remove_duplicated_flags("-nostartfiles -march=rv32imac_zicsr_zifencei --specs=nosys.specs \ + ${CMAKE_EXE_LINKER_FLAGS}" + UNIQ_CMAKE_SAFE_EXE_LINKER_FLAGS) +set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_SAFE_EXE_LINKER_FLAGS}" CACHE STRING "Linker Base Flags" FORCE) diff --git a/tools/idf_py_actions/constants.py b/tools/idf_py_actions/constants.py index 6a7835835e..a22fb17a7c 100644 --- a/tools/idf_py_actions/constants.py +++ b/tools/idf_py_actions/constants.py @@ -1,10 +1,11 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import collections import multiprocessing import os import platform -from typing import Dict, Union +from typing import Dict +from typing import Union GENERATORS: Dict[str, Union[str, Dict, list]] = collections.OrderedDict([ # - command: build command line @@ -33,7 +34,7 @@ if os.name != 'nt': URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf' SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6', 'esp32h2'] -PREVIEW_TARGETS = ['linux', 'esp32p4', 'esp32c5'] +PREVIEW_TARGETS = ['linux', 'esp32p4', 'esp32c5', 'esp32c61'] OPENOCD_TAGET_CONFIG_DEFAULT = '-f interface/ftdi/esp32_devkitj_v1.cfg -f target/{target}.cfg' OPENOCD_TAGET_CONFIG: Dict[str, str] = { diff --git a/tools/tools.json b/tools/tools.json index a1e844dfe1..7fe241bca0 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -94,7 +94,8 @@ "esp32c6", "esp32c5", "esp32h2", - "esp32p4" + "esp32p4", + "esp32c61" ], "version_cmd": [ "riscv32-esp-elf-gdb-no-python", @@ -249,7 +250,8 @@ "esp32c2", "esp32c6", "esp32c5", - "esp32h2" + "esp32h2", + "esp32c61" ], "version_cmd": [ "clang", @@ -314,7 +316,8 @@ "esp32c2", "esp32c6", "esp32c5", - "esp32h2" + "esp32h2", + "esp32c61" ], "version_cmd": [ "riscv32-esp-elf-gcc",