Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
vendors/espressif: Add support for esp32s3
Browse files Browse the repository at this point in the history
  • Loading branch information
laukik-hase committed Oct 7, 2022
1 parent d26a7ce commit 608bf03
Show file tree
Hide file tree
Showing 84 changed files with 9,403 additions and 21 deletions.
31 changes: 31 additions & 0 deletions tools/cmake/toolchains/xtensa-esp32s3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
include("${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake")

set(CMAKE_SYSTEM_NAME Generic)

# Find GCC for Xtensa-ESP32S2.
afr_find_compiler(AFR_COMPILER_CC xtensa-esp32s3-elf-gcc)
afr_find_compiler(AFR_COMPILER_CXX xtensa-esp32s3-elf-g++)

# Specify the cross compiler.
set(CMAKE_C_COMPILER ${AFR_COMPILER_CC} CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER ${AFR_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
set(CMAKE_ASM_COMPILER ${AFR_COMPILER_CC} CACHE FILEPATH "ASM compiler")

# Disable compiler checks.
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)

# Add target system root to cmake find path.
get_filename_component(AFR_COMPILER_DIR "${AFR_COMPILER_CC}" DIRECTORY)
get_filename_component(CMAKE_FIND_ROOT_PATH "${AFR_COMPILER_DIR}" DIRECTORY)

# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)

# Helper variables to abstracts some common compiler flags.
set(AFR_COMPILER_NO_WARNINGS "-w" CACHE INTERNAL "")

# Global compiler flags.
set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags")
28 changes: 8 additions & 20 deletions vendors/espressif/boards/components/freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ set(AMAZON_FREERTOS_KERNEL_DIR "${AFR_KERNEL_DIR}")
set(AMAZON_FREERTOS_FREERTOS_PLUS_DIR "${AFR_MODULES_FREERTOS_PLUS_DIR}")
set(AMAZON_FREERTOS_3RDPARTY_DIR "${AFR_3RDPARTY_DIR}")

string(FIND "${AFR_BOARD_NAME}" "esp32s3" SOC_NAME_ESP32S3)
string(FIND "${AFR_BOARD_NAME}" "esp32s2" SOC_NAME_ESP32S2)
string(FIND "${AFR_BOARD_NAME}" "esp32" SOC_NAME_ESP32)

if (NOT(${SOC_NAME_ESP32S2} EQUAL -1))
if(NOT(${SOC_NAME_ESP32S3} EQUAL -1))
set(SOC_NAME "esp32s3")
elseif(NOT(${SOC_NAME_ESP32S2} EQUAL -1))
set(SOC_NAME "esp32s2")
elseif(NOT($SOC_NAME_ESP32) EQUAL -1)
set(SOC_NAME "esp32")
Expand All @@ -22,27 +25,12 @@ if(AFR_ENABLE_TESTS)
list(APPEND include_dirs
"${AMAZON_FREERTOS_FREERTOS_PLUS_DIR}/standard/freertos_plus_posix/include"
"${AMAZON_FREERTOS_3RDPARTY_DIR}/unity/src"
"${CMAKE_CURRENT_LIST_DIR}/../../${SOC_NAME}/aws_tests/config_files"
)
if(SOC_NAME STREQUAL "esp32s2")
list(APPEND include_dirs
"${CMAKE_CURRENT_LIST_DIR}/../../esp32s2/aws_tests/config_files"
)
else()
list(APPEND include_dirs
"${CMAKE_CURRENT_LIST_DIR}/../../esp32/aws_tests/config_files"
)
endif()

else()
if(SOC_NAME STREQUAL "esp32s2")
list(APPEND include_dirs
"${CMAKE_CURRENT_LIST_DIR}/../../esp32s2/aws_demos/config_files"
)
else()
list(APPEND include_dirs
"${CMAKE_CURRENT_LIST_DIR}/../../esp32/aws_demos/config_files"
)
endif()
list(APPEND include_dirs
"${CMAKE_CURRENT_LIST_DIR}/../../${SOC_NAME}/aws_demos/config_files"
)
endif()

# Edit following two lines to set component requirements (see docs)
Expand Down
5 changes: 4 additions & 1 deletion vendors/espressif/boards/components/mbedtls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ set(MBEDTLS_DIR "${AFR_VENDORS_DIR}/espressif/esp-idf/components/mbedtls")
set(ESP_HW_SUPPORT_DIR "${AFR_VENDORS_DIR}/espressif/esp-idf/components/esp_hw_support")
set(ESP_PM_DIR "${AFR_VENDORS_DIR}/espressif/esp-idf/components/esp_pm")

string(FIND "${AFR_BOARD_NAME}" "esp32s3" SOC_NAME_ESP32S3)
string(FIND "${AFR_BOARD_NAME}" "esp32s2" SOC_NAME_ESP32S2)
string(FIND "${AFR_BOARD_NAME}" "esp32" SOC_NAME_ESP32)

if (NOT(${SOC_NAME_ESP32S2} EQUAL -1))
if(NOT(${SOC_NAME_ESP32S3} EQUAL -1))
set(SOC_NAME "esp32s3")
elseif(NOT(${SOC_NAME_ESP32S2} EQUAL -1))
set(SOC_NAME "esp32s2")
elseif(NOT($SOC_NAME_ESP32) EQUAL -1)
set(SOC_NAME "esp32")
Expand Down
2 changes: 2 additions & 0 deletions vendors/espressif/boards/esp32s3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore the build artifacts in the projects.
*build*
Loading

0 comments on commit 608bf03

Please sign in to comment.