Skip to content

Commit 28df5da

Browse files
committed
polish Kconfig and cmake use
1 parent b8aaa8e commit 28df5da

13 files changed

Lines changed: 232 additions & 159 deletions

File tree

.vscode/tasks.json

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
{
22
"version": "2.0.0",
33
"tasks": [
4-
{
5-
"label": "Select c2usb as manifest repository",
6-
"group": {
7-
"kind": "none",
8-
"isDefault": true
9-
},
10-
"options": {
11-
"cwd": "${workspaceFolder:c2usb}"
12-
},
13-
"runOptions": {
14-
"runOn": "folderOpen"
15-
},
16-
"type": "process",
17-
"command": "west",
18-
"args": [
19-
"config",
20-
"manifest.path",
21-
"c2usb"
22-
]
23-
},
244
{
255
"label": "Select nRF Connect SDK",
266
"group": {
@@ -30,13 +10,8 @@
3010
"options": {
3111
"cwd": "${workspaceFolder:c2usb}"
3212
},
33-
"type": "process",
34-
"command": "west",
35-
"args": [
36-
"config",
37-
"manifest.file",
38-
"west4nrfsdk.yml"
39-
]
13+
"type": "shell",
14+
"command": "west config manifest.file west4nrfsdk.yml && west config manifest.path c2usb"
4015
},
4116
{
4217
"label": "Select McuXpresso SDK",
@@ -47,47 +22,20 @@
4722
"options": {
4823
"cwd": "${workspaceFolder:c2usb}"
4924
},
50-
"type": "process",
51-
"command": "west",
52-
"args": [
53-
"config",
54-
"manifest.file",
55-
"west4mcuxsdk.yml"
56-
]
57-
},
58-
{
59-
"label": "West update",
60-
"group": {
61-
"kind": "none",
62-
"isDefault": true
63-
},
64-
"options": {
65-
"cwd": "${workspaceFolder:c2usb}"
66-
},
67-
"type": "process",
68-
"command": "west",
69-
"args": [
70-
"update"
71-
]
25+
"type": "shell",
26+
"command": "west config manifest.file west4mcuxsdk.yml && west config manifest.path c2usb"
7227
},
7328
{
74-
"label": "West update && patch",
29+
"label": "West update and patch",
7530
"group": {
7631
"kind": "none",
7732
"isDefault": true
7833
},
7934
"options": {
8035
"cwd": "${workspaceFolder:c2usb}"
8136
},
82-
"type": "process",
83-
"command": "west",
84-
"args": [
85-
"patch"
86-
],
87-
"dependsOrder": "sequence",
88-
"dependsOn": [
89-
"West update"
90-
]
37+
"type": "shell",
38+
"command": "west update && west patch"
9139
},
9240
{
9341
"label": "Select SDK by vscode workspace",
@@ -101,13 +49,8 @@
10149
"runOptions": {
10250
"runOn": "folderOpen"
10351
},
104-
"type": "process",
105-
"command": "west",
106-
"args": [
107-
"config",
108-
"manifest.file",
109-
"west4${config:c2usb.startupSdk}.yml"
110-
]
52+
"type": "shell",
53+
"command": "west config manifest.file west4${config:c2usb.startupSdk}.yml && west config manifest.path c2usb"
11154
}
11255
]
11356
}

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(CMAKE_CXX_STANDARD 20)
99
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1010
set(CMAKE_CXX_EXTENSIONS ON)
1111

12+
set(CONFIG_C2USB ON)
1213
add_subdirectory(${PROJECT_NAME})
1314

1415
option(C2USB_TESTS "c2usb: enable unit testing" ${PROJECT_IS_TOP_LEVEL})

c2usb/CMakeLists.txt

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
if(ZEPHYR_BASE)
2-
if (NOT CONFIG_C2USB_CPP)
3-
message("Zephyr build without c2usb")
4-
return()
5-
endif()
1+
if (NOT CONFIG_C2USB)
2+
message("build without c2usb")
3+
return()
64
endif()
75

86
add_library(c2usb)
@@ -39,18 +37,12 @@ CPMAddPackage("gh:Neargye/magic_enum@0.9.3")
3937
include(../cmake/get_cpm.cmake)
4038
if(ZEPHYR_HID_RP_MODULE_DIR OR MCUX_HID_RP_MODULE_DIR)
4139
else()
42-
CPMAddPackage("gh:IntergatedCircuits/hid-rp#ceb9a63678114790e58ad884fe79998b952968c8")
40+
CPMAddPackage("gh:IntergatedCircuits/hid-rp#84b98bd8e0dbfe237c316a62331bc35e6188bd1b")
4341
endif()
4442

4543
if(ZEPHYR_ETL_MODULE_DIR OR MCUX_ETL_MODULE_DIR)
46-
# make etl available in any case
47-
if(NOT DEFINED CONFIG_ETL)
48-
include(FetchContent)
49-
FetchContent_Declare(etl SOURCE_DIR ${ZEPHYR_ETL_MODULE_DIR})
50-
FetchContent_MakeAvailable(etl)
51-
endif()
5244
else()
53-
CPMAddPackage("gh:ETLCPP/etl#20.36.1")
45+
CPMAddPackage("gh:ETLCPP/etl#20.46.2")
5446
endif()
5547

5648
target_link_libraries(c2usb
@@ -66,41 +58,6 @@ target_include_directories(c2usb
6658
)
6759

6860
target_sources(c2usb
69-
PUBLIC
70-
hid/application.hpp
71-
i2c/hid/device.hpp
72-
i2c/hid/standard.hpp
73-
i2c/base.hpp
74-
i2c/slave.hpp
75-
usb/class/hid.hpp
76-
usb/df/class/cdc.hpp
77-
usb/df/class/cdc_acm.hpp
78-
usb/df/class/hid.hpp
79-
usb/df/vendor/microsoft/os_extension.hpp
80-
usb/df/vendor/microsoft/xinput.hpp
81-
usb/df/config.hpp
82-
usb/df/device.hpp
83-
usb/df/ep_flags.hpp
84-
usb/df/function.hpp
85-
usb/df/mac.hpp
86-
usb/df/message.hpp
87-
usb/df/transfer.hpp
88-
usb/standard/descriptors.hpp
89-
usb/standard/requests.hpp
90-
usb/vendor/microsoft_os.hpp
91-
usb/vendor/microsoft_xusb.hpp
92-
usb/base.hpp
93-
usb/control.hpp
94-
usb/endpoint.hpp
95-
usb/product_info.hpp
96-
usb/speeds.hpp
97-
usb/version.hpp
98-
c2usb.hpp
99-
compatibility_helper.hpp
100-
raw_to_hex_string.hpp
101-
reference_array_view.hpp
102-
single_elem_queue.hpp
103-
uninit_store.hpp
10461
PRIVATE
10562
i2c/hid/device.cpp
10663
usb/df/class/cdc.cpp

c2usb/examples/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
add_library(c2usb-example-hid INTERFACE)
2-
target_sources(c2usb-example-hid
3-
PUBLIC
4-
high_resolution_mouse.hpp
5-
leds_saving_keyboard.hpp
6-
simple_keyboard.hpp
7-
)
82
target_include_directories(c2usb-example-hid
93
INTERFACE
104
${CMAKE_CURRENT_SOURCE_DIR}

c2usb/port/nxp/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
if(CONFIG_C2USB_MCUX_MAC)
22
# add these sources to the firmware executable target
33
target_sources(${MCUX_SDK_PROJECT_NAME}
4-
PUBLIC
5-
mcux_mac.hpp
64
PRIVATE
7-
controller_interface.hpp
85
dwc3_mac.cpp
96
ehci_mac.cpp
107
khci_mac.cpp

c2usb/port/nxp/Kconfig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
menu "c2usb configuration"
2-
3-
menuconfig C2USB_MCUX_MAC
1+
config C2USB_MCUX_MAC
42
bool "c2usb MCUX MAC driver"
3+
select C2USB
54
select MCUX_MISC_USB_LITE
65
select MCUX_COMPONENT_middleware.usb.common_header
76
select MCUX_COMPONENT_middleware.usb.device.common_header
8-
9-
endmenu

c2usb/port/zephyr/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,15 @@ target_link_libraries(c2usb
44
INTERFACE
55
kernel
66
)
7-
target_sources_ifdef(C2USB_CPP c2usb
8-
PUBLIC
9-
message_queue.hpp
10-
tick_timer.hpp
11-
semaphore.hpp
12-
)
137
target_sources_ifdef(CONFIG_C2USB_UDC_MAC c2usb
14-
PUBLIC
15-
udc_mac.hpp
168
PRIVATE
179
udc_mac.cpp
1810
)
1911
target_sources_ifdef(CONFIG_C2USB_BLUETOOTH c2usb
20-
PUBLIC
21-
bluetooth/gatt.hpp
22-
bluetooth/hid.hpp
23-
bluetooth/le.hpp
2412
PRIVATE
2513
bluetooth/hid.cpp
2614
)
2715
target_sources_ifdef(CONFIG_SHELL_BACKEND_C2USB c2usb
28-
PUBLIC
29-
usb_shell.hpp
3016
PRIVATE
3117
usb_shell.c
3218
usb_shell.cpp

c2usb/port/zephyr/Kconfig

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
menu "c2usb configuration"
2-
3-
config C2USB_CPP
4-
bool
5-
select CPP
6-
select REQUIRES_FULL_LIBCPP
7-
81
rsource "bluetooth/Kconfig"
92

103
menuconfig C2USB_UDC_MAC
114
bool "c2usb UDC MAC driver"
125
select UDC_DRIVER
13-
select C2USB_CPP
6+
select C2USB
147

158
if C2USB_UDC_MAC
169

@@ -35,9 +28,3 @@ config C2USB_UDC_MAC_BUF_POOL_RESERVE
3528
endif # C2USB_UDC_MAC
3629

3730
rsource "Kconfig.shell"
38-
39-
endmenu
40-
41-
choice STD_CPP
42-
default STD_CPP20 if C2USB_CPP
43-
endchoice

mcux/Kconfig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
rsource "../c2usb/port/nxp/Kconfig"
1+
menu "c2usb configuration"
2+
3+
config C2USB
4+
bool "c2usb library"
5+
select HID_RP
6+
7+
rsource "../c2usb/port/nxp/Kconfig"
8+
9+
endmenu

0 commit comments

Comments
 (0)