Skip to content

Commit 654f182

Browse files
committed
build host examples with imx
1 parent 6945c59 commit 654f182

File tree

6 files changed

+38
-71
lines changed

6 files changed

+38
-71
lines changed

examples/host/cdc_msc_hid/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ add_executable(${PROJECT})
1414

1515
# Example source
1616
target_sources(${PROJECT} PUBLIC
17-
${CMAKE_CURRENT_SOURCE_DIR}/src/cdc_app.c
18-
${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c
19-
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
20-
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c
21-
)
17+
${CMAKE_CURRENT_SOURCE_DIR}/src/cdc_app.c
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c
19+
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
20+
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c
21+
)
2222

2323
# Example include
2424
target_include_directories(${PROJECT} PUBLIC
25-
${CMAKE_CURRENT_SOURCE_DIR}/src
26-
)
25+
${CMAKE_CURRENT_SOURCE_DIR}/src
26+
)
2727

2828
# Configure compilation flags and libraries for the example... see the corresponding function
2929
# in hw/bsp/FAMILY/family.cmake for details.

examples/host/hid_controller/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ add_executable(${PROJECT})
1414

1515
# Example source
1616
target_sources(${PROJECT} PUBLIC
17-
${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c
18-
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
19-
)
17+
${CMAKE_CURRENT_SOURCE_DIR}/src/hid_app.c
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
19+
)
2020

2121
# Example include
2222
target_include_directories(${PROJECT} PUBLIC
23-
${CMAKE_CURRENT_SOURCE_DIR}/src
24-
)
23+
${CMAKE_CURRENT_SOURCE_DIR}/src
24+
)
2525

2626
# Configure compilation flags and libraries for the example... see the corresponding function
2727
# in hw/bsp/FAMILY/family.cmake for details.

examples/host/msc_file_explorer/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ add_executable(${PROJECT})
1414

1515
# Example source
1616
target_sources(${PROJECT} PUBLIC
17-
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
18-
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c
19-
${TOP}/lib/fatfs/source/ff.c
20-
${TOP}/lib/fatfs/source/ffsystem.c
21-
${TOP}/lib/fatfs/source/ffunicode.c
22-
)
17+
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_app.c
19+
${TOP}/lib/fatfs/source/ff.c
20+
${TOP}/lib/fatfs/source/ffsystem.c
21+
${TOP}/lib/fatfs/source/ffunicode.c
22+
)
2323

2424
# Example include
2525
target_include_directories(${PROJECT} PUBLIC
26-
${CMAKE_CURRENT_SOURCE_DIR}/src
27-
${TOP}/lib/fatfs/source
28-
${TOP}/lib/embedded-cli
29-
)
26+
${CMAKE_CURRENT_SOURCE_DIR}/src
27+
${TOP}/lib/fatfs/source
28+
${TOP}/lib/embedded-cli
29+
)
3030

3131
# Configure compilation flags and libraries for the example... see the corresponding function
3232
# in hw/bsp/FAMILY/family.cmake for details.

hw/bsp/board.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,55 +25,6 @@
2525

2626
#include "board.h"
2727

28-
#if 0
29-
#define LED_PHASE_MAX 8
30-
31-
static struct
32-
{
33-
uint32_t phase[LED_PHASE_MAX];
34-
uint8_t phase_count;
35-
36-
bool led_state;
37-
uint8_t current_phase;
38-
uint32_t current_ms;
39-
}led_pattern;
40-
41-
void board_led_pattern(uint32_t const phase_ms[], uint8_t count)
42-
{
43-
memcpy(led_pattern.phase, phase_ms, 4*count);
44-
led_pattern.phase_count = count;
45-
46-
// reset with 1st phase is on
47-
led_pattern.current_ms = board_millis();
48-
led_pattern.current_phase = 0;
49-
led_pattern.led_state = true;
50-
board_led_on();
51-
}
52-
53-
void board_led_task(void)
54-
{
55-
if ( led_pattern.phase_count == 0 ) return;
56-
57-
uint32_t const duration = led_pattern.phase[led_pattern.current_phase];
58-
59-
// return if not enough time
60-
if (board_millis() - led_pattern.current_ms < duration) return;
61-
62-
led_pattern.led_state = !led_pattern.led_state;
63-
board_led_write(led_pattern.led_state);
64-
65-
led_pattern.current_ms += duration;
66-
led_pattern.current_phase++;
67-
68-
if (led_pattern.current_phase == led_pattern.phase_count)
69-
{
70-
led_pattern.current_phase = 0;
71-
led_pattern.led_state = true;
72-
board_led_on();
73-
}
74-
}
75-
#endif
76-
7728
//--------------------------------------------------------------------+
7829
// newlib read()/write() retarget
7930
//--------------------------------------------------------------------+

hw/bsp/imxrt/family.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ endif ()
1212
set(CMAKE_SYSTEM_PROCESSOR cortex-m7 CACHE INTERNAL "System Processor")
1313
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/../../../examples/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
1414

15+
set(FAMILY_MCUS MIMXRT CACHE INTERNAL "")
16+
1517
# include board specific
1618
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
1719

@@ -89,6 +91,7 @@ function(family_configure_target TARGET)
8991
${TOP}/src/portable/ehci/ehci.c
9092
# BSP
9193
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
94+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
9295
)
9396
target_include_directories(${BSP_TARGET} PUBLIC
9497
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
@@ -152,3 +155,7 @@ endfunction()
152155
function(family_configure_device_example TARGET)
153156
family_configure_target(${TARGET})
154157
endfunction()
158+
159+
function(family_configure_host_example TARGET)
160+
family_configure_target(${TARGET})
161+
endfunction()

src/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ cmake_minimum_required(VERSION 3.17)
66
# Add tinyusb to a target
77
function(add_tinyusb TARGET)
88
target_sources(${TARGET} PUBLIC
9+
# common
910
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
1011
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
12+
# device
1113
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd.c
1214
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd_control.c
1315
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/audio/audio_device.c
@@ -22,6 +24,13 @@ function(add_tinyusb TARGET)
2224
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/usbtmc/usbtmc_device.c
2325
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_device.c
2426
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/video/video_device.c
27+
# host
28+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/host/usbh.c
29+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/host/hub.c
30+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_host.c
31+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_host.c
32+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_host.c
33+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
2534
)
2635
target_include_directories(${TARGET} PUBLIC
2736
${CMAKE_CURRENT_FUNCTION_LIST_DIR}

0 commit comments

Comments
 (0)