Skip to content

Commit cda5ab8

Browse files
committed
more temp work
1 parent 97ee40f commit cda5ab8

File tree

3 files changed

+60
-50
lines changed

3 files changed

+60
-50
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
set(MCU_VARIANT MIMXRT1011)
22

3-
target_sources(${PROJECT} PUBLIC
3+
target_sources(bsp PUBLIC
44
${CMAKE_CURRENT_LIST_DIR}/evkmimxrt1010_flexspi_nor_config.c
55
)
66

7-
target_compile_definitions(${PROJECT} PUBLIC
7+
target_compile_definitions(bsp PUBLIC
88
CPU_MIMXRT1011DAE5A
99
CFG_EXAMPLE_VIDEO_READONLY
1010
)

hw/bsp/imxrt/family.cmake

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set(CMAKE_SYSTEM_PROCESSOR cortex-m7 CACHE INTERNAL "System Processor")
33
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/../../../examples/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
44

5+
56
function(family_configure_target TARGET)
67
if (NOT BOARD)
78
message(FATAL_ERROR "BOARD not specified")
@@ -17,9 +18,14 @@ function(family_configure_target TARGET)
1718
set(SDK_DIR ${TOP}/hw/mcu/nxp/mcux-sdk)
1819
set(DEPS_SUBMODULES ${SDK_DIR})
1920

21+
# define BSP target
22+
add_library(bsp STATIC
23+
)
24+
25+
# include board specific cmake
2026
include(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}/board.cmake)
2127

22-
target_compile_definitions(${TARGET} PUBLIC
28+
target_compile_definitions(bsp PUBLIC
2329
CFG_TUSB_MCU=OPT_MCU_MIMXRT
2430
__ARMVFP__=0
2531
__ARMFPV5__=0
@@ -32,11 +38,11 @@ function(family_configure_target TARGET)
3238
--specs=nano.specs
3339
)
3440

35-
target_sources(${TARGET} PUBLIC
41+
target_sources(bsp PUBLIC
3642
# 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
4046
# BSP
4147
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
4248
${SDK_DIR}/drivers/common/fsl_common.c
@@ -49,18 +55,18 @@ function(family_configure_target TARGET)
4955
)
5056

5157
if (TOOLCHAIN STREQUAL "gcc")
52-
target_sources(${TARGET} PUBLIC
58+
target_sources(bsp PUBLIC
5359
${SDK_DIR}/devices/${MCU_VARIANT}/gcc/startup_${MCU_VARIANT}.S
5460
)
5561

56-
target_link_options(${TARGET} PUBLIC
62+
target_link_options(bsp PUBLIC
5763
"LINKER:--script=${SDK_DIR}/devices/${MCU_VARIANT}/gcc/${MCU_VARIANT}xxxxx_flexspi_nor.ld"
5864
)
5965
else ()
6066
# TODO support IAR
6167
endif ()
6268

63-
target_include_directories(${TARGET} PUBLIC
69+
target_include_directories(bsp PUBLIC
6470
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
6571
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
6672
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
@@ -73,25 +79,31 @@ function(family_configure_target TARGET)
7379
${SDK_DIR}/drivers/lpuart
7480
)
7581

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()
8085

81-
target_compile_definitions(tinyusb_config PUBLIC
86+
target_compile_definitions(tinyusb_config INTERFACE
87+
CFG_TUSB_MCU=OPT_MCU_MIMXRT
8288
)
8389

84-
# include tinyusb cmake
90+
# include tinyusb CMakeList.txt for tinyusb target
8591
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
8897
)
8998

90-
#include(${TOP}/src/CMakeLists.txt)
91-
#add_tinyusb(${TARGET})
9299

100+
target_link_libraries(${TARGET} PUBLIC
101+
tinyusb
102+
bsp
103+
)
93104
endfunction()
94105

106+
95107
function(family_add_freertos_config TARGET)
96108
add_library(freertos_config INTERFACE)
97109

src/CMakeLists.txt

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,31 @@ target_link_libraries(tinyusb PUBLIC
3434
tinyusb_config
3535
)
3636

37-
function(add_tinyusb TARGET)
38-
target_sources(${TARGET} PUBLIC
39-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
40-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
41-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd.c
42-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd_control.c
43-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/audio/audio_device.c
44-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_device.c
45-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_device.c
46-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_rt_device.c
47-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_device.c
48-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/midi/midi_device.c
49-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_device.c
50-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ecm_rndis_device.c
51-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ncm_device.c
52-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/usbtmc/usbtmc_device.c
53-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_device.c
54-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/video/video_device.c
55-
)
56-
57-
target_include_directories(${TARGET} PUBLIC
58-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
59-
)
60-
61-
# enable all possible warnings
62-
target_compile_options(${TARGET} PUBLIC
63-
64-
)
65-
66-
endfunction()
37+
#function(add_tinyusb TARGET)
38+
# target_sources(${TARGET} PUBLIC
39+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
40+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
41+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd.c
42+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd_control.c
43+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/audio/audio_device.c
44+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_device.c
45+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_device.c
46+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_rt_device.c
47+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_device.c
48+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/midi/midi_device.c
49+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_device.c
50+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ecm_rndis_device.c
51+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ncm_device.c
52+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/usbtmc/usbtmc_device.c
53+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_device.c
54+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/video/video_device.c
55+
# )
56+
#
57+
# target_include_directories(${TARGET} PUBLIC
58+
# ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
59+
# )
60+
#
61+
# # enable all possible warnings
62+
# target_compile_options(${TARGET} PUBLIC
63+
# )
64+
#endfunction()

0 commit comments

Comments
 (0)