From c9f6d18dfc8c91d571658fc255e3dd8d8fe3779a Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 2 Mar 2022 17:46:45 -0300 Subject: [PATCH] soc: esp32: add Espressif HAL config Current Espressif porting requires standard include as part of hal implementation. compiler_flags.cmake checks for variant name to keep those stdinc in build. Instead of using variant name as check, use this new CONFIG to make it clear and to allow having toolchain integrated in zephyr-sdk package. stdinc dependency in hal_espressif will be worked out and removed soon. Signed-off-by: Sylvio Alves --- cmake/compiler/gcc/compiler_flags.cmake | 2 +- modules/Kconfig | 1 + modules/Kconfig.esp32 | 6 ++++++ soc/riscv/esp32c3/Kconfig.soc | 1 + soc/xtensa/esp32/Kconfig.soc | 1 + soc/xtensa/esp32s2/Kconfig.soc | 1 + 6 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 modules/Kconfig.esp32 diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 7c3284eb47d..0d4d6942360 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -106,7 +106,7 @@ set_compiler_property(PROPERTY cstd -std=) if (NOT CONFIG_NEWLIB_LIBC AND NOT COMPILER STREQUAL "xcc" AND - NOT ZEPHYR_TOOLCHAIN_VARIANT STREQUAL "espressif" AND + NOT CONFIG_HAS_ESPRESSIF_HAL AND NOT CONFIG_NATIVE_APPLICATION) set_compiler_property(PROPERTY nostdinc -nostdinc) set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC}) diff --git a/modules/Kconfig b/modules/Kconfig index c582e0ea855..6a45dcbe1c2 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -13,6 +13,7 @@ source "modules/Kconfig.civetweb" source "modules/Kconfig.cmsis" source "modules/Kconfig.cypress" source "modules/Kconfig.eos_s3" +source "modules/Kconfig.esp32" source "modules/Kconfig.imx" source "modules/Kconfig.infineon" source "modules/Kconfig.libmetal" diff --git a/modules/Kconfig.esp32 b/modules/Kconfig.esp32 new file mode 100644 index 00000000000..11541e83d6f --- /dev/null +++ b/modules/Kconfig.esp32 @@ -0,0 +1,6 @@ +# Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HAS_ESPRESSIF_HAL + bool + depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3 diff --git a/soc/riscv/esp32c3/Kconfig.soc b/soc/riscv/esp32c3/Kconfig.soc index 331a6149496..35c84a7de85 100644 --- a/soc/riscv/esp32c3/Kconfig.soc +++ b/soc/riscv/esp32c3/Kconfig.soc @@ -10,6 +10,7 @@ config SOC_ESP32C3 select CLOCK_CONTROL_ESP32 select PINCTRL select XIP + select HAS_ESPRESSIF_HAL if SOC_ESP32C3 diff --git a/soc/xtensa/esp32/Kconfig.soc b/soc/xtensa/esp32/Kconfig.soc index 870173b01b7..a475dffb26e 100644 --- a/soc/xtensa/esp32/Kconfig.soc +++ b/soc/xtensa/esp32/Kconfig.soc @@ -11,6 +11,7 @@ config SOC_ESP32 select ARCH_SUPPORTS_COREDUMP select PINCTRL select XIP + select HAS_ESPRESSIF_HAL if SOC_ESP32 diff --git a/soc/xtensa/esp32s2/Kconfig.soc b/soc/xtensa/esp32s2/Kconfig.soc index 8676c681cab..57c538cfcb7 100644 --- a/soc/xtensa/esp32s2/Kconfig.soc +++ b/soc/xtensa/esp32s2/Kconfig.soc @@ -10,6 +10,7 @@ config SOC_ESP32S2 select CLOCK_CONTROL_ESP32 select PINCTRL select XIP + select HAS_ESPRESSIF_HAL if SOC_ESP32S2