2
2
set (CMAKE_SYSTEM_PROCESSOR cortex-m7 CACHE INTERNAL "System Processor" )
3
3
set (CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR} /../../../examples/cmake/toolchain/arm_${TOOLCHAIN}.cmake )
4
4
5
+
5
6
function (family_configure_target TARGET )
6
7
if (NOT BOARD )
7
8
message (FATAL_ERROR "BOARD not specified" )
@@ -17,9 +18,14 @@ function(family_configure_target TARGET)
17
18
set (SDK_DIR ${TOP} /hw/mcu/nxp/mcux-sdk )
18
19
set (DEPS_SUBMODULES ${SDK_DIR} )
19
20
21
+ # define BSP target
22
+ add_library (bsp STATIC
23
+ )
24
+
25
+ # include board specific cmake
20
26
include (${CMAKE_CURRENT_FUNCTION_LIST_DIR} /boards/${BOARD}/board.cmake )
21
27
22
- target_compile_definitions (${TARGET} PUBLIC
28
+ target_compile_definitions (bsp PUBLIC
23
29
CFG_TUSB_MCU=OPT_MCU_MIMXRT
24
30
__ARMVFP__=0
25
31
__ARMFPV5__=0
@@ -32,11 +38,11 @@ function(family_configure_target TARGET)
32
38
--specs=nano.specs
33
39
)
34
40
35
- target_sources (${TARGET} PUBLIC
41
+ target_sources (bsp PUBLIC
36
42
# TinyUSB
37
- ${TOP} /src/portable/chipidea/ci_hs/dcd_ci_hs.c
38
- ${TOP} /src/portable/chipidea/ci_hs/hcd_ci_hs.c
39
- ${TOP} /src/portable/ehci/ehci.c
43
+ # ${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
44
+ # ${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
45
+ # ${TOP}/src/portable/ehci/ehci.c
40
46
# BSP
41
47
${CMAKE_CURRENT_FUNCTION_LIST_DIR} /family.c
42
48
${SDK_DIR} /drivers/common/fsl_common.c
@@ -49,18 +55,18 @@ function(family_configure_target TARGET)
49
55
)
50
56
51
57
if (TOOLCHAIN STREQUAL "gcc" )
52
- target_sources (${TARGET} PUBLIC
58
+ target_sources (bsp PUBLIC
53
59
${SDK_DIR} /devices/${MCU_VARIANT}/gcc/startup_${MCU_VARIANT}.S
54
60
)
55
61
56
- target_link_options (${TARGET} PUBLIC
62
+ target_link_options (bsp PUBLIC
57
63
"LINKER:--script=${SDK_DIR} /devices/${MCU_VARIANT} /gcc/${MCU_VARIANT} xxxxx_flexspi_nor.ld"
58
64
)
59
65
else ()
60
66
# TODO support IAR
61
67
endif ()
62
68
63
- target_include_directories (${TARGET} PUBLIC
69
+ target_include_directories (bsp PUBLIC
64
70
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
65
71
${CMAKE_CURRENT_FUNCTION_LIST_DIR} /../../
66
72
${CMAKE_CURRENT_FUNCTION_LIST_DIR} /boards/${BOARD}
@@ -73,25 +79,31 @@ function(family_configure_target TARGET)
73
79
${SDK_DIR} /drivers/lpuart
74
80
)
75
81
76
- # define tinyusb_config target
77
-
78
- #target_include_directories(tinyusb_config INTERFACE
79
- # )
82
+ if (NOT TARGET tinyusb_config )
83
+ message (FATAL_ERROR "tinyusb_config target not found" )
84
+ endif ()
80
85
81
- target_compile_definitions (tinyusb_config PUBLIC
86
+ target_compile_definitions (tinyusb_config INTERFACE
87
+ CFG_TUSB_MCU=OPT_MCU_MIMXRT
82
88
)
83
89
84
- # include tinyusb cmake
90
+ # include tinyusb CMakeList.txt for tinyusb target
85
91
add_subdirectory (${TOP} /src ${CMAKE_CURRENT_BINARY_DIR} /tinyusb )
86
- target_link_libraries (${TARGET} PUBLIC
87
- tinyusb
92
+
93
+ add_library (tinyusb_port STATIC
94
+ ${TOP} /src/portable/chipidea/ci_hs/dcd_ci_hs.c
95
+ ${TOP} /src/portable/chipidea/ci_hs/hcd_ci_hs.c
96
+ ${TOP} /src/portable/ehci/ehci.c
88
97
)
89
98
90
- #include(${TOP}/src/CMakeLists.txt)
91
- #add_tinyusb(${TARGET})
92
99
100
+ target_link_libraries (${TARGET} PUBLIC
101
+ tinyusb
102
+ bsp
103
+ )
93
104
endfunction ()
94
105
106
+
95
107
function (family_add_freertos_config TARGET )
96
108
add_library (freertos_config INTERFACE )
97
109
0 commit comments