Skip to content

Commit

Permalink
Dynamically configure path to DSP library for STM32Cube
Browse files Browse the repository at this point in the history
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
  • Loading branch information
valeros committed Oct 27, 2021
1 parent 991b3fa commit 1ed58e0
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions builder/frameworks/stm32cube.py
Expand Up @@ -175,6 +175,21 @@ def build_usb_libs(usb_libs_root):
build_custom_lib(os.path.join(usb_class_dir, device_class), manifest)


def process_dsp_lib():
dsp_lib_path = os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Lib", "GCC")
if not os.path.isdir(dsp_lib_path):
dsp_lib_path = os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Lib", "GCC")

env.Append(
CPPPATH=[
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Include"),
],
LIBPATH=[
dsp_lib_path,
]
)


env.Replace(AS="$CC", ASCOM="$ASPPCOM")

env.Append(
Expand All @@ -198,7 +213,6 @@ def build_usb_libs(usb_libs_root):
CPPPATH=[
"$PROJECT_SRC_DIR",
"$PROJECT_INCLUDE_DIR",
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "DSP", "Include"),
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Include"),
os.path.join(
FRAMEWORK_DIR,
Expand Down Expand Up @@ -238,7 +252,6 @@ def build_usb_libs(usb_libs_root):
],

LIBPATH=[
os.path.join(FRAMEWORK_DIR, "Drivers", "CMSIS", "Lib", "GCC"),
os.path.join(FRAMEWORK_DIR, "platformio", "ldscripts"),
],

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

#
# DSP Library processing
#

if board.get("build.stm32cube.custom_dsp_library", "no") == "no":
process_dsp_lib()

#
# HAL libraries
#
Expand Down

0 comments on commit 1ed58e0

Please sign in to comment.