espressif: group boards using target name as a family
`hw\bsp` separate one family folder to esp32s2, esp32s3 add board specific board.cmake file to override board specific options(features) fix examples and test scripts to use new family approach
This commit is contained in:
@@ -7,7 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
if(FAMILY MATCHES "^(esp32s[2-3])*")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
@@ -3,19 +3,12 @@ idf_component_register(SRCS "main.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES freertos soc)
|
||||
|
||||
string(REGEX MATCH "^(esp32s[2-3])*" chip_target "$ENV{IDF_TARGET}")
|
||||
file(TO_NATIVE_PATH "${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}/board.cmake" board_cmake)
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
if(EXISTS ${board_cmake})
|
||||
include(${board_cmake})
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_${upper_case_target}"
|
||||
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
|
||||
)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
target_include_directories(${COMPONENT_TARGET} PUBLIC
|
||||
"${FREERTOS_ORIG_INCLUDE_PATH}"
|
||||
|
@@ -7,7 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
if(FAMILY MATCHES "^(esp32s[2-3])*")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
@@ -9,10 +9,10 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
if(FAMILY MATCHES "^(esp32s[2-3])*")
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||
message(FATAL_ERROR "Invalid FAMILY specified: ${FAMILY}")
|
||||
endif()
|
||||
|
@@ -2,21 +2,12 @@ idf_component_register(SRCS "main.c" "usb_descriptors.c" "msc_disk.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES freertos soc)
|
||||
|
||||
string(REGEX MATCH "^(esp32s[2-3])*" chip_target "$ENV{IDF_TARGET}")
|
||||
file(TO_NATIVE_PATH "${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}/board.cmake" board_cmake)
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
else()
|
||||
set(chip_family "esp32sx")
|
||||
if(EXISTS ${board_cmake})
|
||||
include(${board_cmake})
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_${upper_case_target}"
|
||||
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
|
||||
)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
target_include_directories(${COMPONENT_TARGET} PUBLIC
|
||||
"${FREERTOS_ORIG_INCLUDE_PATH}"
|
||||
@@ -37,5 +28,5 @@ target_sources(${COMPONENT_TARGET} PUBLIC
|
||||
"${TOP}/src/class/net/net_device.c"
|
||||
"${TOP}/src/class/usbtmc/usbtmc_device.c"
|
||||
"${TOP}/src/class/vendor/vendor_device.c"
|
||||
"${TOP}/src/portable/espressif/${chip_family}/dcd_${chip_family}.c"
|
||||
"${TOP}/src/portable/espressif/esp32sx/dcd_esp32sx.c"
|
||||
)
|
||||
|
@@ -9,10 +9,9 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
if(FAMILY MATCHES "^(esp32s[2-3])*")
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified: ${FAMILY}")
|
||||
endif()
|
||||
|
@@ -2,21 +2,12 @@ idf_component_register(SRCS "main.c" "usb_descriptors.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES freertos soc)
|
||||
|
||||
string(REGEX MATCH "^(esp32s[2-3])*" chip_target "$ENV{IDF_TARGET}")
|
||||
file(TO_NATIVE_PATH "${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}/board.cmake" board_cmake)
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
else()
|
||||
set(chip_family "esp32sx")
|
||||
if(EXISTS ${board_cmake})
|
||||
include(${board_cmake})
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_${upper_case_target}"
|
||||
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
|
||||
)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
target_include_directories(${COMPONENT_TARGET} PUBLIC
|
||||
"${FREERTOS_ORIG_INCLUDE_PATH}"
|
||||
@@ -37,5 +28,5 @@ target_sources(${COMPONENT_TARGET} PUBLIC
|
||||
"${TOP}/src/class/net/net_device.c"
|
||||
"${TOP}/src/class/usbtmc/usbtmc_device.c"
|
||||
"${TOP}/src/class/vendor/vendor_device.c"
|
||||
"${TOP}/src/portable/espressif/${chip_family}/dcd_${chip_family}.c"
|
||||
"${TOP}/src/portable/espressif/esp32sx/dcd_esp32sx.c"
|
||||
)
|
||||
|
@@ -7,12 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
elseif(FAMILY STREQUAL "rp2040")
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/pico_sdk_import.cmake)
|
||||
|
@@ -6,7 +6,8 @@
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
# ESP32-SX and RP2040 has its own CMake build system
|
||||
ifneq ($(FAMILY),esp32sx)
|
||||
ifneq ($(FAMILY),esp32s2)
|
||||
ifneq ($(FAMILY),esp32s3)
|
||||
ifneq ($(FAMILY),rp2040)
|
||||
# ---------------------------------------
|
||||
# GNU Make build system
|
||||
@@ -135,6 +136,7 @@ else
|
||||
$(RM) -rf $(BUILD)
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
endif # GNU Make
|
||||
|
||||
|
Reference in New Issue
Block a user