From 067b1b91c205804c53307e03777d0000e3e19fce Mon Sep 17 00:00:00 2001 From: morris Date: Wed, 15 Jan 2020 21:50:19 +0800 Subject: [PATCH] global: add new target name: esp32-s3 add target name, chip ID, toochain descriptions for ESP32-S3 --- Kconfig | 8 ++++++++ .../bootloader_support/include/esp_app_format.h | 3 ++- components/esp_system/include/esp_system.h | 1 + tools/cmake/dfu.cmake | 2 ++ tools/cmake/toolchain-esp32s3.cmake | 8 ++++++++ tools/idf_py_actions/constants.py | 2 ++ tools/idf_py_actions/core_ext.py | 16 ++++++++++++++-- 7 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tools/cmake/toolchain-esp32s3.cmake diff --git a/Kconfig b/Kconfig index 7bdd6edff..bb0690157 100644 --- a/Kconfig +++ b/Kconfig @@ -11,6 +11,7 @@ mainmenu "Espressif IoT Development Framework Configuration" config IDF_ENV_FPGA # This option is for internal use only bool + option env="IDF_ENV_FPGA" config IDF_TARGET # This option records the IDF target when sdkconfig is generated the first time. @@ -29,10 +30,16 @@ mainmenu "Espressif IoT Development Framework Configuration" default "y" if IDF_TARGET="esp32s2" select FREERTOS_UNICORE + config IDF_TARGET_ESP32S3 + bool + default "y" if IDF_TARGET="esp32s3" + select IDF_ENV_FPGA + config IDF_FIRMWARE_CHIP_ID hex default 0x0000 if IDF_TARGET_ESP32 default 0x0002 if IDF_TARGET_ESP32S2 + default 0x0004 if IDF_TARGET_ESP32S3 default 0xFFFF menu "SDK tool configuration" @@ -40,6 +47,7 @@ mainmenu "Espressif IoT Development Framework Configuration" string "Compiler toolchain path/prefix" default "xtensa-esp32-elf-" if IDF_TARGET_ESP32 default "xtensa-esp32s2-elf-" if IDF_TARGET_ESP32S2 + default "xtensa-esp32s3-elf-" if IDF_TARGET_ESP32S3 help The prefix/path that is used to call the toolchain. The default setting assumes a crosstool-ng gcc setup that is in your PATH. diff --git a/components/bootloader_support/include/esp_app_format.h b/components/bootloader_support/include/esp_app_format.h index 0f0a60382..a67c38ee0 100644 --- a/components/bootloader_support/include/esp_app_format.h +++ b/components/bootloader_support/include/esp_app_format.h @@ -19,7 +19,8 @@ */ typedef enum { ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */ - ESP_CHIP_ID_ESP32S2 = 0x0002, /*!< chip ID: ESP32S2 */ + ESP_CHIP_ID_ESP32S2 = 0x0002, /*!< chip ID: ESP32-S2 */ + ESP_CHIP_ID_ESP32S3 = 0x0004, /*!< chip ID: ESP32-S3 */ ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */ } __attribute__((packed)) esp_chip_id_t; diff --git a/components/esp_system/include/esp_system.h b/components/esp_system/include/esp_system.h index 9b0abf431..f11b195dc 100644 --- a/components/esp_system/include/esp_system.h +++ b/components/esp_system/include/esp_system.h @@ -251,6 +251,7 @@ void __attribute__((noreturn)) esp_system_abort(const char* details); typedef enum { CHIP_ESP32 = 1, //!< ESP32 CHIP_ESP32S2 = 2, //!< ESP32-S2 + CHIP_ESP32S3 = 4, //!< ESP32-S3 } esp_chip_model_t; /* Chip feature flags, used in esp_chip_info_t */ diff --git a/tools/cmake/dfu.cmake b/tools/cmake/dfu.cmake index 7b68ff2b2..e3199bb21 100644 --- a/tools/cmake/dfu.cmake +++ b/tools/cmake/dfu.cmake @@ -7,6 +7,8 @@ function(__add_dfu_targets) return() elseif("${target}" STREQUAL "esp32s2") set(dfu_pid "2") + elseif("${target}" STREQUAL "esp32s3") + set(dfu_pid "4") else() message(FATAL_ERROR "DFU PID unknown for ${target}") endif() diff --git a/tools/cmake/toolchain-esp32s3.cmake b/tools/cmake/toolchain-esp32s3.cmake new file mode 100644 index 000000000..279622b49 --- /dev/null +++ b/tools/cmake/toolchain-esp32s3.cmake @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Generic) + +set(CMAKE_C_COMPILER xtensa-esp32s3-elf-gcc) +set(CMAKE_CXX_COMPILER xtensa-esp32s3-elf-g++) +set(CMAKE_ASM_COMPILER xtensa-esp32s3-elf-gcc) + +set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags") +set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags") diff --git a/tools/idf_py_actions/constants.py b/tools/idf_py_actions/constants.py index 04015a3f4..85baaee2f 100644 --- a/tools/idf_py_actions/constants.py +++ b/tools/idf_py_actions/constants.py @@ -37,3 +37,5 @@ GENERATORS = collections.OrderedDict([ ]) SUPPORTED_TARGETS = ["esp32", "esp32s2"] + +PREVIEW_TARGETS = ["esp32s3"] diff --git a/tools/idf_py_actions/core_ext.py b/tools/idf_py_actions/core_ext.py index 97c8e248f..d129d929d 100644 --- a/tools/idf_py_actions/core_ext.py +++ b/tools/idf_py_actions/core_ext.py @@ -5,7 +5,7 @@ import sys import click -from idf_py_actions.constants import GENERATORS, SUPPORTED_TARGETS +from idf_py_actions.constants import GENERATORS, SUPPORTED_TARGETS, PREVIEW_TARGETS from idf_py_actions.errors import FatalError from idf_py_actions.global_options import global_options from idf_py_actions.tools import ensure_build_directory, idf_version, merge_action_lists, realpath, run_target, TargetChoice @@ -122,6 +122,8 @@ def action_extensions(base_actions, project_path): os.remove(f) def set_target(action, ctx, args, idf_target): + if(not args["preview"] and idf_target in PREVIEW_TARGETS): + raise FatalError("%s is still in preview. You have to append '--preview' option after idf.py to use any preview feature." % idf_target) args.define_cache_entry.append("IDF_TARGET=" + idf_target) sdkconfig_path = os.path.join(args.project_dir, 'sdkconfig') sdkconfig_old = sdkconfig_path + ".old" @@ -164,6 +166,10 @@ def action_extensions(base_actions, project_path): for target in SUPPORTED_TARGETS: print(target) + if "preview" in ctx.params: + for target in PREVIEW_TARGETS: + print(target) + sys.exit(0) root_options = { @@ -208,6 +214,12 @@ def action_extensions(base_actions, project_path): "default": False, "callback": verbose_callback }, + { + "names": ["--preview"], + "help": "Enable IDF features that are still in preview.", + "is_flag": True, + "default": False, + }, { "names": ["--ccache/--no-ccache"], "help": ( @@ -379,7 +391,7 @@ def action_extensions(base_actions, project_path): { "names": ["idf-target"], "nargs": 1, - "type": TargetChoice(SUPPORTED_TARGETS), + "type": TargetChoice(SUPPORTED_TARGETS + PREVIEW_TARGETS), }, ], "dependencies": ["fullclean"],