tinyusb: add support of esp32s3 target
add support of new esp32s3 target and the board update the roles.mk wrapper to allow dfu flashing of espressif chip update examples to allow compilation for esp32s3_addax_1 board once the code is tested the PR to original tinyusb repo will be submitted
This commit is contained in:

committed by
Alex Lisitsyn

parent
c611199632
commit
2f0cb8b5f1
@@ -7,7 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
@@ -1,4 +1,3 @@
|
||||
CONFIG_IDF_CMAKE=y
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_IDF_TARGET_ESP32S2=y
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||
|
@@ -1,10 +1,18 @@
|
||||
# FAMILY = "esp32s2"
|
||||
# FAMILY = esp32sx
|
||||
idf_component_register(SRCS "main.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES freertos soc)
|
||||
|
||||
string(REGEX MATCH "^(esp32s[2-3])*" chip_target "$ENV{IDF_TARGET}")
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_${upper_case_target}"
|
||||
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
|
||||
)
|
||||
|
||||
|
@@ -70,7 +70,7 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
|
||||
void app_main(void)
|
||||
{
|
||||
main();
|
||||
|
@@ -7,7 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
@@ -9,7 +9,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
CONFIG_IDF_CMAKE=y
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_IDF_TARGET_ESP32S2=y
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||
|
@@ -2,8 +2,19 @@ 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}")
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
else()
|
||||
set(chip_family "esp32sx")
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
|
||||
"-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)
|
||||
@@ -26,5 +37,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/esp32s2/dcd_esp32s2.c"
|
||||
"${TOP}/src/portable/espressif/${chip_family}/dcd_${chip_family}.c"
|
||||
)
|
||||
|
@@ -94,15 +94,15 @@ int main(void)
|
||||
// Create CDC task
|
||||
(void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-2, cdc_stack, &cdc_taskdef);
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2
|
||||
#if CFG_TUSB_MCU != OPT_MCU_ESP32S2
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if CFG_TUSB_MCU != OPT_MCU_ESP32S2 && CFG_TUSB_MCU != OPT_MCU_ESP32S3
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
|
||||
void app_main(void)
|
||||
{
|
||||
main();
|
||||
|
@@ -9,10 +9,10 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||
message(FATAL_ERROR "Invalid FAMILY specified: ${FAMILY}")
|
||||
endif()
|
||||
|
@@ -1,5 +1,3 @@
|
||||
CONFIG_IDF_CMAKE=y
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_IDF_TARGET_ESP32S2=y
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||
|
@@ -2,8 +2,19 @@ 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}")
|
||||
|
||||
if(NOT chip_target)
|
||||
message(FATAL_ERROR "Incorrect target: $ENV{IDF_TARGET}" )
|
||||
else()
|
||||
set(chip_family "esp32sx")
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${chip_target} upper_case_target)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
|
||||
"-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)
|
||||
@@ -26,5 +37,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/esp32s2/dcd_esp32s2.c"
|
||||
"${TOP}/src/portable/espressif/${chip_family}/dcd_${chip_family}.c"
|
||||
)
|
||||
|
@@ -95,15 +95,15 @@ int main(void)
|
||||
// Create HID task
|
||||
(void) xTaskCreateStatic( hid_task, "hid", HID_STACK_SZIE, NULL, configMAX_PRIORITIES-2, hid_stack, &hid_taskdef);
|
||||
|
||||
// skip starting scheduler (and return) for ESP32-S2
|
||||
#if CFG_TUSB_MCU != OPT_MCU_ESP32S2
|
||||
// skip starting scheduler (and return) for ESP32-S2 or ESP32-S3
|
||||
#if CFG_TUSB_MCU != OPT_MCU_ESP32S2 && CFG_TUSB_MCU != OPT_MCU_ESP32S3
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
|
||||
void app_main(void)
|
||||
{
|
||||
main();
|
||||
|
@@ -7,7 +7,7 @@ set(TOP "../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# Check for -DFAMILY=
|
||||
if(FAMILY STREQUAL "esp32s2")
|
||||
if(FAMILY STREQUAL "esp32sx")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
project(${PROJECT})
|
||||
|
@@ -27,6 +27,9 @@ endif
|
||||
# Board within family
|
||||
ifeq ($(BOARD_PATH),)
|
||||
BOARD_PATH := $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/*/boards/$(BOARD)))
|
||||
ifneq ($(wildcard $(TOP)/hw/bsp/*/boards/$(BOARD)/board.mk),)
|
||||
include $(TOP)/hw/bsp/*/boards/$(BOARD)/board.mk
|
||||
endif
|
||||
FAMILY := $(word 3, $(subst /, ,$(BOARD_PATH)))
|
||||
FAMILY_PATH = hw/bsp/$(FAMILY)
|
||||
endif
|
||||
|
@@ -5,8 +5,8 @@
|
||||
# Set all as default goal
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
# ESP32-S2 and RP2040 has its own CMake build system
|
||||
ifneq ($(FAMILY),esp32s2)
|
||||
# ESP32-SX and RP2040 has its own CMake build system
|
||||
ifneq ($(FAMILY),esp32sx)
|
||||
ifneq ($(FAMILY),rp2040)
|
||||
# ---------------------------------------
|
||||
# GNU Make build system
|
||||
|
Reference in New Issue
Block a user