Преглед на файлове

ESP32-H2: Introduce new target for ESP32H2

Cao Sen Miao преди 3 години
родител
ревизия
86aa4df5b5
променени са 28 файла, в които са добавени 123 реда и са изтрити 2 реда
  1. 5 0
      components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32h2.c
  2. 5 0
      components/bootloader_support/src/bootloader_random_esp32h2.c
  3. 0 0
      components/bt/controller/esp32h2/Kconfig.in
  4. 5 0
      components/esp_adc/CMakeLists.txt
  5. 0 0
      components/esp_hw_support/include/soc/esp32h2/.gitkeep
  6. 0 0
      components/esp_hw_support/port/esp32h2/CMakeLists.txt
  7. 0 0
      components/esp_hw_support/port/esp32h2/Kconfig.mac
  8. 2 1
      components/esp_phy/CMakeLists.txt
  9. 0 0
      components/esp_rom/esp32h2/.gitkeep
  10. 0 0
      components/esp_rom/include/esp32h2/.gitkeep
  11. 5 0
      components/esp_system/ld/esp32h2/memory.ld.in
  12. 5 0
      components/esp_system/ld/esp32h2/sections.ld.in
  13. 13 0
      components/esp_system/port/soc/esp32h2/CMakeLists.txt
  14. 27 0
      components/esp_system/port/soc/esp32h2/Kconfig.cpu
  15. 0 0
      components/esp_system/port/soc/esp32h2/Kconfig.system
  16. 5 0
      components/esp_system/port/soc/esp32h2/cache_err_int.c
  17. 5 0
      components/esp_system/port/soc/esp32h2/clk.c
  18. 5 0
      components/esp_system/port/soc/esp32h2/reset_reason.c
  19. 5 0
      components/esp_system/port/soc/esp32h2/system_internal.c
  20. 5 0
      components/hal/esp32h2/efuse_hal.c
  21. 0 0
      components/hal/esp32h2/include/.gitkeep
  22. 5 0
      components/heap/port/esp32h2/memory_layout.c
  23. 0 0
      components/idf_test/include/esp32h2/.gitkeep
  24. 0 0
      components/soc/esp32h2/CMakeLists.txt
  25. 5 0
      components/spi_flash/esp32h2/flash_ops_esp32h2.c
  26. 2 0
      tools/cmake/dfu.cmake
  27. 18 0
      tools/cmake/toolchain-esp32h2.cmake
  28. 1 1
      tools/idf_py_actions/constants.py

+ 5 - 0
components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32h2.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/bootloader_support/src/bootloader_random_esp32h2.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 0 - 0
components/bt/controller/esp32h2/Kconfig.in


+ 5 - 0
components/esp_adc/CMakeLists.txt

@@ -1,3 +1,8 @@
+if(IDF_TARGET STREQUAL "esp32h2")
+    # TODO : IDF-6214
+    return()
+endif()
+
 idf_build_get_property(target IDF_TARGET)
 
 set(includes "include" "interface" "${target}/include" "deprecated/include")

+ 0 - 0
components/esp_hw_support/include/soc/esp32h2/.gitkeep


+ 0 - 0
components/esp_hw_support/port/esp32h2/CMakeLists.txt


+ 0 - 0
components/esp_hw_support/port/esp32h2/Kconfig.mac


+ 2 - 1
components/esp_phy/CMakeLists.txt

@@ -1,7 +1,8 @@
 idf_build_get_property(idf_target IDF_TARGET)
 
-if(IDF_TARGET STREQUAL "esp32c6")
+if(IDF_TARGET STREQUAL "esp32c6" OR IDF_TARGET STREQUAL "esp32h2")
     # TODO : IDF-5680
+    # TODO : IDF-6337
     return()
 endif()
 

+ 0 - 0
components/esp_rom/esp32h2/.gitkeep


+ 0 - 0
components/esp_rom/include/esp32h2/.gitkeep


+ 5 - 0
components/esp_system/ld/esp32h2/memory.ld.in

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/esp_system/ld/esp32h2/sections.ld.in

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 13 - 0
components/esp_system/port/soc/esp32h2/CMakeLists.txt

@@ -0,0 +1,13 @@
+set(srcs
+         "clk.c"
+         "reset_reason.c"
+         "system_internal.c"
+         "cache_err_int.c"
+         "../../arch/riscv/expression_with_stack.c"
+         "../../arch/riscv/expression_with_stack_asm.S"
+         "../../arch/riscv/panic_arch.c"
+         "../../arch/riscv/debug_stubs.c")
+
+add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" ${srcs})
+
+target_sources(${COMPONENT_LIB} PRIVATE ${srcs})

+ 27 - 0
components/esp_system/port/soc/esp32h2/Kconfig.cpu

@@ -0,0 +1,27 @@
+choice ESP_DEFAULT_CPU_FREQ_MHZ
+    prompt "CPU frequency"
+    default ESP_DEFAULT_CPU_FREQ_MHZ_64 if IDF_ENV_FPGA
+    default ESP_DEFAULT_CPU_FREQ_MHZ_96
+    help
+        CPU frequency to be set on application startup.
+
+    config ESP_DEFAULT_CPU_FREQ_MHZ_16
+        bool "16 MHz"
+        depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
+    config ESP_DEFAULT_CPU_FREQ_MHZ_32
+        bool "32 MHz"
+        depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
+    config ESP_DEFAULT_CPU_FREQ_MHZ_64
+        bool "64 MHz"
+        depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
+    config ESP_DEFAULT_CPU_FREQ_MHZ_96
+        bool "96 MHz"
+        depends on !IDF_ENV_FPGA
+endchoice
+
+config ESP_DEFAULT_CPU_FREQ_MHZ
+    int
+    default 16 if ESP_DEFAULT_CPU_FREQ_MHZ_16
+    default 32 if ESP_DEFAULT_CPU_FREQ_MHZ_32
+    default 64 if ESP_DEFAULT_CPU_FREQ_MHZ_64
+    default 96 if ESP_DEFAULT_CPU_FREQ_MHZ_96

+ 0 - 0
components/esp_system/port/soc/esp32h2/Kconfig.system


+ 5 - 0
components/esp_system/port/soc/esp32h2/cache_err_int.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/esp_system/port/soc/esp32h2/clk.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/esp_system/port/soc/esp32h2/reset_reason.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/esp_system/port/soc/esp32h2/system_internal.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 5 - 0
components/hal/esp32h2/efuse_hal.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 0 - 0
components/hal/esp32h2/include/.gitkeep


+ 5 - 0
components/heap/port/esp32h2/memory_layout.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 0 - 0
components/idf_test/include/esp32h2/.gitkeep


+ 0 - 0
components/soc/esp32h2/CMakeLists.txt


+ 5 - 0
components/spi_flash/esp32h2/flash_ops_esp32h2.c

@@ -0,0 +1,5 @@
+/*
+ * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */

+ 2 - 0
tools/cmake/dfu.cmake

@@ -17,6 +17,8 @@ function(__add_dfu_targets)
         return()
     elseif("${target}" STREQUAL "esp32c6")
         return()
+    elseif("${target}" STREQUAL "esp32h2")
+        return()
     elseif("${target}" STREQUAL "linux")
         return()
     else()

+ 18 - 0
tools/cmake/toolchain-esp32h2.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=rv32imc ${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=rv32imc ${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=rv32imc --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)

+ 1 - 1
tools/idf_py_actions/constants.py

@@ -33,7 +33,7 @@ if os.name != 'nt':
 URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf'
 
 SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2']
-PREVIEW_TARGETS = ['linux', 'esp32h4', 'esp32c6']
+PREVIEW_TARGETS = ['linux', 'esp32h4', 'esp32c6', 'esp32h2']
 
 OPENOCD_TAGET_CONFIG_DEFAULT = '-f interface/ftdi/esp32_devkitj_v1.cfg -f target/{target}.cfg'
 OPENOCD_TAGET_CONFIG: Dict[str, str] = {