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

Feature Request - ability to append to build.extra_flags from within main sketch file. #4528

Closed
sleemanj opened this issue Feb 5, 2016 · 1 comment
Milestone

Comments

@sleemanj
Copy link

sleemanj commented Feb 5, 2016

It is often desirable that the sketch author might need to pass some #define into a library or into the core to "configure" the build process for that component. For example, they may wish to turn on debug functions within a library, or specify that some section should not be compiled, or provide a non-default constant value such as say an i2c address... while many of these things could be done "at runtime" on an embedded platform this is often at best undesirably wasteful and at worst impossible simply due to program memory constraints.

In boards.txt we have the ability to set "build.extra_flags", this can even be done based on menu entries

I propose that it would be advantageous to have the sketch file, as part of the pre-processing, parsed for some "special" #defines which are then extracted and appended to build.extra_flags, in effect passing them into gcc for the entire compilation process of libraries and core for the sketch. Thereby making it possible for the sketch to easily set such configurations as mentioned above.

For example, perhaps:

#define BUILD_CONFIG ZORT
#define BUILD_CONFIG NARF=23

in the sketch file could result in appending to build.extra_flags -DZORT -DNARF=23

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

3 participants