add esp32s2 saola bsp
update cdc_msc_freertos main.c to work with esp32s2 add CMake file
This commit is contained in:
10
examples/device/cdc_msc_freertos/CMakeLists.txt
Normal file
10
examples/device/cdc_msc_freertos/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
# The following five lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# example src directory
|
||||
set(EXTRA_COMPONENT_DIRS "src")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(blink)
|
1060
examples/device/cdc_msc_freertos/sdkconfig
Normal file
1060
examples/device/cdc_msc_freertos/sdkconfig
Normal file
File diff suppressed because it is too large
Load Diff
36
examples/device/cdc_msc_freertos/src/CMakeLists.txt
Normal file
36
examples/device/cdc_msc_freertos/src/CMakeLists.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
# TOP is absolute path to root directory of TinyUSB git repo
|
||||
set(TOP "../../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
idf_component_register(SRCS "main.c" "usb_descriptors.c" "msc_disk.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES freertos soc)
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET} PUBLIC
|
||||
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
|
||||
)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
target_include_directories(${COMPONENT_TARGET} PUBLIC
|
||||
"${FREERTOS_ORIG_INCLUDE_PATH}"
|
||||
"${TOP}/hw"
|
||||
"${TOP}/src"
|
||||
)
|
||||
|
||||
target_sources(${COMPONENT_TARGET} PUBLIC
|
||||
"${TOP}/hw/bsp/esp32s2_saola/esp32s2_saola.c"
|
||||
"${TOP}/src/tusb.c"
|
||||
"${TOP}/src/common/tusb_fifo.c"
|
||||
"${TOP}/src/device/usbd.c"
|
||||
"${TOP}/src/device/usbd_control.c"
|
||||
"${TOP}/src/class/cdc/cdc_device.c"
|
||||
"${TOP}/src/class/dfu/dfu_rt_device.c"
|
||||
"${TOP}/src/class/hid/hid_device.c"
|
||||
"${TOP}/src/class/midi/midi_device.c"
|
||||
"${TOP}/src/class/msc/msc_device.c"
|
||||
"${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"
|
||||
)
|
||||
|
@@ -56,12 +56,12 @@ StaticTimer_t static_blink;
|
||||
TimerHandle_t blink_tm;
|
||||
|
||||
// static task for usbd
|
||||
#define USBD_STACK_SIZE (3*(configMINIMAL_STACK_SIZE/2))
|
||||
#define USBD_STACK_SIZE (2*configMINIMAL_STACK_SIZE)
|
||||
StackType_t stack_usbd[USBD_STACK_SIZE];
|
||||
StaticTask_t static_task_usbd;
|
||||
|
||||
// static task for cdc
|
||||
#define CDC_STACK_SZIE configMINIMAL_STACK_SIZE
|
||||
#define CDC_STACK_SZIE (2*configMINIMAL_STACK_SIZE)
|
||||
StackType_t stack_cdc[CDC_STACK_SZIE];
|
||||
StaticTask_t static_task_cdc;
|
||||
|
||||
@@ -72,11 +72,10 @@ void cdc_task(void* params);
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
// ESP32S2 entry function is app_main()
|
||||
#define main app_main
|
||||
#endif
|
||||
|
||||
void app_main(void)
|
||||
#else
|
||||
int main(void)
|
||||
#endif
|
||||
{
|
||||
board_init();
|
||||
|
||||
@@ -91,21 +90,16 @@ int main(void)
|
||||
|
||||
// Create task
|
||||
#if CFG_TUD_CDC
|
||||
(void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-2, stack_cdc, &static_task_cdc);
|
||||
(void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-1, stack_cdc, &static_task_cdc);
|
||||
#endif
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
// skip starting scheduler for ESP32 S2 (already started)
|
||||
while(1)
|
||||
{
|
||||
vTaskSuspend(NULL);
|
||||
}
|
||||
#else
|
||||
// skip starting scheduler (and return) for ESP32-S2
|
||||
#if CFG_TUSB_MCU != OPT_MCU_ESP32S2
|
||||
vTaskStartScheduler();
|
||||
NVIC_SystemReset();
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// USB Device Driver task
|
||||
@@ -186,7 +180,8 @@ void cdc_task(void* params)
|
||||
}
|
||||
}
|
||||
|
||||
taskYIELD();
|
||||
// For ESP32-S2 this delay is essential to allow idle how to run and reset wdt
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user