Skip to content

Commit 18ae0a2

Browse files
committed
Refactor tinyusb build
1 parent 2123e5a commit 18ae0a2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

builder/frameworks/arduino/nrf5.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,7 @@
9090
join(FRAMEWORK_DIR, "cores", board.get("build.core"),
9191
"BLEBond_nvs"),
9292
join(FRAMEWORK_DIR, "cores", board.get("build.core"),
93-
"FC_Store"),
94-
join(FRAMEWORK_DIR, "cores", board.get("build.core"),
95-
"TinyUSB"),
96-
join(FRAMEWORK_DIR, "cores", board.get("build.core"),
97-
"TinyUSB", "Adafruit_TinyUSB_ArduinoCore"),
98-
join(FRAMEWORK_DIR, "cores", board.get("build.core"),
99-
"TinyUSB", "Adafruit_TinyUSB_ArduinoCore", "tinyusb", "src")
93+
"FC_Store")
10094
],
10195

10296
LINKFLAGS=[
@@ -143,18 +137,29 @@
143137
]
144138
)
145139

146-
if "build.usb_product" in env.BoardConfig():
140+
usb_path = join(FRAMEWORK_DIR, "libraries", "Adafruit_TinyUSB_Arduino")
141+
if "build.usb_product" in env.BoardConfig() and isdir(usb_path):
147142
env.Append(
148143
CPPDEFINES=[
149144
"USBCON",
150145
"USE_TINYUSB",
146+
"ARDUINO_NRF52_ADAFRUIT",
147+
("CFG_TUSB_OS_INC_PATH","freertos/"),
148+
("TASK_PRIO_HIGH", "(configMAX_PRIORITIES - 1)"),
151149
("USB_VID", board.get("build.hwids")[0][0]),
152150
("USB_PID", board.get("build.hwids")[0][1]),
153151
("USB_PRODUCT", '\\"%s\\"' % board.get("build.usb_product", "").replace('"', "")),
154152
("USB_MANUFACTURER", '\\"%s\\"' % board.get("vendor", "").replace('"', ""))
155153
]
156154
)
157155

156+
env.Append(CPPPATH=[join(usb_path, "src", "arduino")])
157+
# libs.append(
158+
# env.BuildLibrary(
159+
# join("$BUILD_DIR", "Adafruit_TinyUSB_Arduino"),
160+
# join(FRAMEWORK_DIR, "libraries", "Adafruit_TinyUSB_Arduino", "src")))
161+
162+
158163
env.Append(
159164
ASFLAGS=env.get("CCFLAGS", [])[:]
160165
)

0 commit comments

Comments
 (0)