Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement separate compile flags per module/file #129

Merged
merged 2 commits into from
Jan 16, 2019

Conversation

salkinium
Copy link
Member

@salkinium salkinium commented Nov 21, 2018

This implements adding separate compile flags for specific files by attaching metadata to lbuild operations. This allows to compile CMSIS-DSP with its own flags (specifically __FPU_PRESENT=1 is required), without using these settings globally (which triggers a warning since <stm32xx.h> device headers usually define this macro).

Implemented for:

  • SCons
  • CMake

See #125 for discussion.
Depends on modm-io/lbuild#16.
cc @dergraaf @rleh @se-bi @chris-durand

@salkinium
Copy link
Member Author

Unfortunately the generated SConscript files now gets a little more verbose:

files = [
    env.File("ext/tlsf/tlsf.c"),
    # ...
    env.File("src/modm/utils/dummy.cpp"),
]
flags = {"CFLAGS": ['$CFLAGS', '-fno-strict-aliasing'], "CPPDEFINES": ['$CPPDEFINES', 'ARM_MATH_ROUNDING', 'UNALIGNED_SUPPORT_DISABLE', '__FPU_PRESENT=1'], }
if profile == "debug": flags["CPPDEFINES"].extend(['ARM_MATH_MATRIX_CHECK']);
files.append(env.Object("ext/cmsis/dsp/BasicMathFunctions/arm_abs_f32.c", **flags))
flags = {"CFLAGS": ['$CFLAGS', '-fno-strict-aliasing'], "CPPDEFINES": ['$CPPDEFINES', 'ARM_MATH_ROUNDING', 'UNALIGNED_SUPPORT_DISABLE', '__FPU_PRESENT=1'], }
if profile == "debug": flags["CPPDEFINES"].extend(['ARM_MATH_MATRIX_CHECK']);
files.append(env.Object("ext/cmsis/dsp/BasicMathFunctions/arm_abs_q15.c", **flags))
# ... for all cmsis-dsp files

@salkinium salkinium changed the title [wip] Implement separate compile flags per module/file Implement separate compile flags per module/file Jan 16, 2019
@salkinium salkinium merged commit a3ac4b4 into modm-io:develop Jan 16, 2019
@salkinium salkinium deleted the feature/file-compile-flags branch January 16, 2019 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant