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

How do we pass in definitions and flags to our projects and the MCU SDK? #15

Open
david-perez opened this issue Aug 11, 2019 · 3 comments

Comments

@david-perez
Copy link
Contributor

This is a question. I'm using the project as a submodule (so I don't want to alter any files from it).

I'd like to define some symbols (-DARM_MATH_CM4=1) and flags (-mfpu=fpv4-sp-d16 -mfloat-abi=hard) that are used by the MCU SDK (e.g. in CMSIS) to enable use of the FPU unit found in some boards. How can I pass them to both my project's source files and the MCU SDK?

I'm currently using cmake -DCMAKE_BUILD_TYPE=Release -DOPTIONAL_DEBUG_SYMBOLS="-DARM_MATH_CM4=1 -mfpu=fpv4-sp-d16 -mfloat-abi=hard" .. and it seems to be working, but I don't think OPTIONAL_DEBUG_SYMBOLS from toolchain/efm32-base.cmake is meant to be used for these purposes.

@ryankurte
Copy link
Owner

my usual approach with submoduling is to copy CMakeLists.txt into the top level project where you rename / do whatever you need to for your project, and in that file you can set(X y) whatever you need, so you don't have to pass anything in to the cli invocation.

It looks like OPTIONAL_DEBUG_SYMBOLS is the best place for these to be propagated at the moment, and since there are no other references to this perhaps it could be renamed to something more indicative of it's utility.

that said, these seem like features that could perhaps be configured for a given device here? afaik it should be CPU rather than board dependent?

@david-perez
Copy link
Contributor Author

It looks like OPTIONAL_DEBUG_SYMBOLS is the best place for these to be propagated at the moment, and since there are no other references to this perhaps it could be renamed to something more indicative of it's utility.

Yes, the name threw me off. Shall we rename it to e.g. ADDITIONAL_SYMBOLS_AND_FLAGS?

that said, these seem like features that could perhaps be configured for a given device here? afaik it should be CPU rather than board dependent?

Yes, these are CPU dependent. I'm not sure about explicitly supporting these definitions and flags by activating them with a variable to enable FPU support, a user might want some other combination. I think just letting them have a placeholder to define additional symbols and flags is flexible and does the job.

@ryankurte
Copy link
Owner

Hey sorry for the delay

Shall we rename it to e.g. ADDITIONAL_SYMBOLS_AND_FLAGS?

Something like this seems good to me! maybe OPTIONAL_DEFINITIONS or ADDITIONAL_DEFINITIONS to be in line with cmake's add_definitions()?

(also in re-reading this I realise add_definitions(-DARM_MATH_CM4=1 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) in the CMakeLists.txt file should also achieve what you need)

I think just letting them have a placeholder to define additional symbols and flags is flexible and does the job.

Yeah fair point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants