File tree Expand file tree Collapse file tree 13 files changed +40
-84
lines changed Expand file tree Collapse file tree 13 files changed +40
-84
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.5 )
2
2
3
- include (${CMAKE_CURRENT_SOURCE_DIR} /../../../hw/bsp/family_support.cmake )
4
-
5
- # Check for -DFAMILY=
6
- if (FAMILY MATCHES "^esp32s[2-3]" )
7
- # use BOARD-Directory name for project id
8
- get_filename_component (PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME )
9
- set (PROJECT ${BOARD} -${PROJECT} )
10
-
3
+ # -DFAMILY=espressif
4
+ if (FAMILY STREQUAL "espressif" )
11
5
# TOP is absolute path to root directory of TinyUSB git repo
12
6
set (TOP "../../.." )
13
7
get_filename_component (TOP "${TOP} " REALPATH )
8
+ endif ()
14
9
15
- project (${PROJECT} )
16
-
17
- else ()
10
+ include (${CMAKE_CURRENT_SOURCE_DIR} /../../../hw/bsp/family_support.cmake )
18
11
19
- # gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
20
- family_get_project_name (PROJECT ${CMAKE_CURRENT_LIST_DIR} )
12
+ # gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
13
+ family_get_project_name (PROJECT ${CMAKE_CURRENT_LIST_DIR} )
21
14
22
- project (${PROJECT} )
15
+ project (${PROJECT} )
23
16
24
- # Checks this example is valid for the family and initializes the project
25
- family_initialize_project (${PROJECT} ${CMAKE_CURRENT_LIST_DIR} )
17
+ # Checks this example is valid for the family and initializes the project
18
+ family_initialize_project (${PROJECT} ${CMAKE_CURRENT_LIST_DIR} )
26
19
20
+ # Other family such as rp2040
21
+ if (NOT FAMILY STREQUAL "espressif" )
27
22
add_executable (${PROJECT} )
28
23
29
24
# Example source
Original file line number Diff line number Diff line change 1
- # FAMILY = esp32sx
2
1
idf_component_register (SRCS "main.c"
3
2
INCLUDE_DIRS "."
4
- REQUIRES freertos soc )
3
+ REQUIRES freertos soc tinyusb_src )
5
4
6
- file (TO_NATIVE_PATH "${TOP} /hw/bsp/${FAMILY} /boards/${BOARD} /board.cmake" board_cmake )
7
-
8
- if (EXISTS ${board_cmake} )
9
- include (${board_cmake} )
10
- endif ()
11
-
12
- idf_component_get_property ( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH )
13
5
target_include_directories (${COMPONENT_TARGET} PUBLIC
14
- "${FREERTOS_ORIG_INCLUDE_PATH} "
15
- "${TOP} /hw"
16
- "${TOP} /src"
17
- )
6
+ "${TOP} /hw"
7
+ )
Original file line number Diff line number Diff line change 30
30
#include "bsp/board.h"
31
31
32
32
//--------------------------------------------------------------------+
33
- // MACRO CONSTANT TYPEDEF PROTYPES
33
+ // MACRO CONSTANT TYPEDEF PROTOTYPES
34
34
//--------------------------------------------------------------------+
35
35
36
36
/* Blink pattern
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ project(${PROJECT})
16
16
family_initialize_project (${PROJECT} ${CMAKE_CURRENT_LIST_DIR} )
17
17
18
18
# Check for -DFAMILY=
19
- if (NOT FAMILY STREQUAL "espressif" )
19
+ if (NOT FAMILY STREQUAL "espressif" )
20
20
message (FATAL_ERROR "Invalid FAMILY specified: ${FAMILY} " )
21
21
endif ()
Original file line number Diff line number Diff line change @@ -5,7 +5,3 @@ idf_component_register(SRCS "main.c" "usb_descriptors.c" "msc_disk.c"
5
5
target_include_directories (${COMPONENT_TARGET} PUBLIC
6
6
"${TOP} /hw"
7
7
)
8
-
9
- target_compile_definitions (${COMPONENT_TARGET} PUBLIC
10
- ESP_PLATFORM
11
- )
Original file line number Diff line number Diff line change 54
54
#endif
55
55
56
56
// This examples use FreeRTOS
57
+ #ifndef CFG_TUSB_OS
57
58
#define CFG_TUSB_OS OPT_OS_FREERTOS
59
+ #endif
58
60
59
61
// Espressif IDF requires "freertos/" prefix in include path
60
62
#if TU_CHECK_MCU (OPT_MCU_ESP32S2 , OPT_MCU_ESP32S3 )
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.5 )
2
2
3
- # use BOARD-Directory name for project id
4
- get_filename_component (PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME )
5
- set (PROJECT ${BOARD} -${PROJECT} )
6
-
7
3
# TOP is absolute path to root directory of TinyUSB git repo
4
+ # needed for esp32sx build. TODO could be removed later on
8
5
set (TOP "../../.." )
9
6
get_filename_component (TOP "${TOP} " REALPATH )
10
7
8
+ include (${CMAKE_CURRENT_SOURCE_DIR} /../../../hw/bsp/family_support.cmake )
9
+
10
+ # gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
11
+ family_get_project_name (PROJECT ${CMAKE_CURRENT_LIST_DIR} )
12
+
13
+ project (${PROJECT} )
14
+
15
+ # Checks this example is valid for the family and initializes the project
16
+ family_initialize_project (${PROJECT} ${CMAKE_CURRENT_LIST_DIR} )
17
+
11
18
# Check for -DFAMILY=
12
- if (FAMILY MATCHES "^esp32s[2-3]" )
13
- include (${TOP} /hw/bsp/${FAMILY}/family.cmake )
14
- project (${PROJECT} )
15
- else ()
19
+ if (NOT FAMILY STREQUAL "espressif" )
16
20
message (FATAL_ERROR "Invalid FAMILY specified: ${FAMILY} " )
17
21
endif ()
Original file line number Diff line number Diff line change 1
1
idf_component_register (SRCS "main.c" "usb_descriptors.c"
2
2
INCLUDE_DIRS "."
3
- REQUIRES freertos soc )
4
-
5
- file (TO_NATIVE_PATH "${TOP} /hw/bsp/${FAMILY} /boards/${BOARD} /board.cmake" board_cmake )
6
-
7
- if (EXISTS ${board_cmake} )
8
- include (${board_cmake} )
9
- endif ()
3
+ REQUIRES freertos soc tinyusb_src )
10
4
11
5
target_include_directories (${COMPONENT_TARGET} PUBLIC
12
- "${TOP} /hw"
13
- "${TOP} /src"
14
- )
15
-
16
- target_compile_definitions (${COMPONENT_TARGET} PUBLIC
17
- ESP_PLATFORM
18
- )
19
-
20
- target_sources (${COMPONENT_TARGET} PUBLIC
21
- "${TOP} /src/tusb.c"
22
- "${TOP} /src/common/tusb_fifo.c"
23
- "${TOP} /src/device/usbd.c"
24
- "${TOP} /src/device/usbd_control.c"
25
- "${TOP} /src/class/cdc/cdc_device.c"
26
- "${TOP} /src/class/dfu/dfu_rt_device.c"
27
- "${TOP} /src/class/hid/hid_device.c"
28
- "${TOP} /src/class/midi/midi_device.c"
29
- "${TOP} /src/class/msc/msc_device.c"
30
- "${TOP} /src/class/net/ecm_rndis_device.c"
31
- "${TOP} /src/class/net/ncm_device.c"
32
- "${TOP} /src/class/usbtmc/usbtmc_device.c"
33
- "${TOP} /src/class/vendor/vendor_device.c"
34
- "${TOP} /src/portable/synopsys/dwc2/dcd_dwc2.c"
35
- )
6
+ "${TOP} /hw"
7
+ )
Original file line number Diff line number Diff line change 54
54
#endif
55
55
56
56
// This examples use FreeRTOS
57
+ #ifndef CFG_TUSB_OS
57
58
#define CFG_TUSB_OS OPT_OS_FREERTOS
59
+ #endif
58
60
59
61
// Espressif IDF requires "freertos/" prefix in include path
60
62
#if TU_CHECK_MCU (OPT_MCU_ESP32S2 , OPT_MCU_ESP32S3 )
Original file line number Diff line number Diff line change 1
1
idf_component_register (SRCS family.c
2
2
INCLUDE_DIRS "." "${BOARD} "
3
3
PRIV_REQUIRES "driver"
4
- REQUIRES freertos src led_strip )
4
+ REQUIRES led_strip src tinyusb_src )
5
5
6
- # Apply board specific content
7
- include ("${BOARD} /board.cmake" )
8
-
9
- idf_component_get_property (FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH )
10
6
target_include_directories (${COMPONENT_TARGET} PUBLIC
11
- "${FREERTOS_ORIG_INCLUDE_PATH} "
12
7
"${TOP} /hw"
13
- "${TOP} /src"
14
8
)
You can’t perform that action at this time.
0 commit comments