Skip to content

Commit 1ed58e0

Browse files
committed
Dynamically configure path to DSP library for STM32Cube
This commit also adds new functionality that allows developers to exclude the default DSP lib and use custom one per project if needed Resolves #569, resolves #570
1 parent 991b3fa commit 1ed58e0

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

builder/frameworks/stm32cube.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ def build_usb_libs(usb_libs_root):
175175
build_custom_lib(os.path.join(usb_class_dir, device_class), manifest)
176176

177177

178+
def process_dsp_lib():
179+
dsp_lib_path = os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Lib", "GCC")
180+
if not os.path.isdir(dsp_lib_path):
181+
dsp_lib_path = os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Lib", "GCC")
182+
183+
env.Append(
184+
CPPPATH=[
185+
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Include"),
186+
],
187+
LIBPATH=[
188+
dsp_lib_path,
189+
]
190+
)
191+
192+
178193
env.Replace(AS="$CC", ASCOM="$ASPPCOM")
179194

180195
env.Append(
@@ -198,7 +213,6 @@ def build_usb_libs(usb_libs_root):
198213
CPPPATH=[
199214
"$PROJECT_SRC_DIR",
200215
"$PROJECT_INCLUDE_DIR",
201-
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Include"),
202216
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Include"),
203217
os.path.join(
204218
FRAMEWORK_DIR,
@@ -238,7 +252,6 @@ def build_usb_libs(usb_libs_root):
238252
],
239253

240254
LIBPATH=[
241-
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Lib", "GCC"),
242255
os.path.join(FRAMEWORK_DIR, "platformio", "ldscripts"),
243256
],
244257

@@ -314,6 +327,13 @@ def build_usb_libs(usb_libs_root):
314327
if os.path.isdir(bsp_variant_dir):
315328
build_custom_lib(os.path.join(bsp_variant_dir), {"name": "FrameworkVariantBSP"})
316329

330+
#
331+
# DSP Library processing
332+
#
333+
334+
if board.get("build.stm32cube.custom_dsp_library", "no") == "no":
335+
process_dsp_lib()
336+
317337
#
318338
# HAL libraries
319339
#

0 commit comments

Comments
 (0)