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:
Alex Lisitsyn
2021-03-09 11:29:07 +01:00
committed by Alex Lisitsyn
parent c611199632
commit 2f0cb8b5f1
51 changed files with 257 additions and 85 deletions
+3
View File
@@ -115,6 +115,9 @@
#elif CFG_TUSB_MCU == OPT_MCU_ESP32S2
// no header needed
#elif CFG_TUSB_MCU == OPT_MCU_ESP32S3
// no header needed
#elif CFG_TUSB_MCU == OPT_MCU_DA1469X
#include "DA1469xAB.h"
-6
View File
@@ -1,6 +0,0 @@
cmake_minimum_required(VERSION 3.5)
# Add example src and bsp directories
set(EXTRA_COMPONENT_DIRS "src" "${TOP}/hw/bsp/esp32s2/boards" "${TOP}/hw/bsp/esp32s2/components")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(SUPPORTED_TARGETS esp32s2)
-36
View File
@@ -1,36 +0,0 @@
#DEPS_SUBMODULES +=
.PHONY: all clean flash
all:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) build
build: all
clean:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) clean
fullclean:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) fullclean
flash:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) flash
bootloader-flash:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) bootloader-flash
app-flash:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) app-flash
erase:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) erase_flash
monitor:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) monitor
uf2: $(BUILD)/$(PROJECT).uf2
UF2_FAMILY_ID = 0xbfdd4eee
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
@echo CREATE $@
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0 -c -o $@ $^
@@ -1,12 +1,10 @@
idf_component_register(SRCS esp32s2.c
idf_component_register(SRCS esp32sx.c
INCLUDE_DIRS "." "${BOARD}"
PRIV_REQUIRES "driver"
REQUIRES freertos src led_strip)
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
# Apply board specific content
add_subdirectory(${BOARD})
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
target_include_directories(${COMPONENT_TARGET} PUBLIC
@@ -0,0 +1,15 @@
# Apply board specific context here
target_include_directories(${COMPONENT_LIB} PRIVATE .)
message(STATUS "Apply board specific content ${BOARD}: $ENV{IDF_TARGET} " )
idf_build_get_property(idf_target IDF_TARGET)
if(NOT ${idf_target} STREQUAL "esp32s2")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s2" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s2
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
@@ -0,0 +1,15 @@
# Apply board specific context here
target_include_directories(${COMPONENT_LIB} PRIVATE .)
message(STATUS "Apply board specific content ${BOARD}: $ENV{IDF_TARGET} " )
idf_build_get_property(idf_target IDF_TARGET)
if(NOT ${idf_target} STREQUAL "esp32s2")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s2" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s2
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
@@ -0,0 +1,15 @@
# Apply board specific context here
target_include_directories(${COMPONENT_LIB} PRIVATE .)
message(STATUS "Apply board specific content ${BOARD}: $ENV{IDF_TARGET} " )
idf_build_get_property(idf_target IDF_TARGET)
if(NOT ${idf_target} STREQUAL "esp32s2")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s2" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s2
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
@@ -0,0 +1,15 @@
# Apply board specific content here
target_include_directories(${COMPONENT_LIB} PRIVATE .)
message(STATUS "Apply board specific content ${BOARD}: $ENV{IDF_TARGET} " )
idf_build_get_property(idf_target IDF_TARGET)
if(NOT ${idf_target} STREQUAL "esp32s3")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s3" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S3"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,44 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020, Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
#ifndef BOARD_H_
#define BOARD_H_
#ifdef __cplusplus
extern "C" {
#endif
// Note: On the production version (v1.1) WS2812 is connected to GPIO 47
#define NEOPIXEL_PIN 47
#define BUTTON_PIN 0
#define BUTTON_STATE_ACTIVE 0
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s3
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
@@ -0,0 +1,14 @@
# Apply board specific context here
target_include_directories(${COMPONENT_LIB} PRIVATE .)
idf_build_get_property(idf_target IDF_TARGET)
if( NOT ${idf_target} STREQUAL "esp32s2")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s2" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s2
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
@@ -0,0 +1,14 @@
# Apply board specific context here
target_include_directories(${COMPONENT_LIB} PUBLIC .)
idf_build_get_property(idf_target IDF_TARGET)
if(NOT ${idf_target} STREQUAL "esp32s2")
message(STATUS "Incorrect target for board ${BOARD}: $ENV{IDF_TARGET} " )
set(IDF_TARGET "esp32s2" FORCE)
endif()
target_compile_options(${COMPONENT_TARGET} PUBLIC
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
"-DCFG_TUSB_OS=OPT_OS_FREERTOS"
)
@@ -0,0 +1,3 @@
IDF_TARGET = esp32s2
$(info Processing of board.mk for board: $(BOARD){$(BOARD_PATH)}, family: $(FAMILY), target: $(IDF_TARGET))
+6
View File
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.5)
# Add example src and bsp directories
set(EXTRA_COMPONENT_DIRS "src" "${TOP}/hw/bsp/esp32sx/boards" "${TOP}/hw/bsp/esp32sx/components")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(SUPPORTED_TARGETS esp32s2 esp32s3)
+26
View File
@@ -0,0 +1,26 @@
#DEPS_SUBMODULES +=
.PHONY: all clean flash bootloader-flash app-flash erase monitor dfu-flash dfu
all:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) -DIDF_TARGET=$(IDF_TARGET) build
build: all
clean:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) clean
fullclean:
if test -f sdkconfig; then $(RM) -f sdkconfig ; fi
if test -d $(BUILD); then $(RM) -rf $(BUILD) ; fi
flash bootloader-flash app-flash erase monitor dfu-flash dfu:
idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) $@
uf2: $(BUILD)/$(PROJECT).uf2
UF2_FAMILY_ID = 0xbfdd4eee
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
@echo CREATE $@
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0 -c -o $@ $^