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

Build flags set in my boards.txt file not used in the compilation command #210

Open
manasIU opened this issue May 20, 2019 · 7 comments
Open
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@manasIU
Copy link

manasIU commented May 20, 2019

Hi, in my boards.txt file I am using my own build flags (eg. -DFLAGNAME). Arduino-cli recognises these flags but sets these to their default values (0). How do I tell arduino-cli to set certain flags?

@per1234
Copy link
Contributor

per1234 commented May 20, 2019

Arduino-cli recognises these flags but sets these to their default values (0).

I can't reproduce this. Could you please provide more details, including the exact line from your boards.txt file and a minimal demonstration sketch so that I can reproduce your setup exactly?

How do I tell arduino-cli to set certain flags?

You can use arduino-cli compile's --build-properties option to do things like:

arduino-cli compile --fqbn arduino:avr:uno --build-properties build.extra_flags=-DFLAGNAME SketchName

but be aware this will override the value of the build.extra_flags property that might have been set in your boards.txt.

@bxparks
Copy link

bxparks commented May 20, 2019

I would like to make a feature request for the Arduino-CLI to explicitly support user-defined -D macros without resorting to this hack (which also happens to work in the Arduino IDE CommandLine ). You mentioned in https://forum.arduino.cc/index.php?topic=537500.0 that the Arduino devs have previously been reluctant to do this, but maybe they have changed their minds due to the ongoing work on the Arduino CLI.

@manasIU
Copy link
Author

manasIU commented May 21, 2019

@per1234 My boards.txt file looks something like this :

# Dragonfly-L496RG
Dragonfly-L496RG.menu.debugOptions.none=None
Dragonfly-L496RG.menu.debugOptions.none.build.debugEnable=1

When I compile with verbose on, I see the -DDEBUGENABLE=0 in the output even after using your suggestion of using the --build-properties build.extra_flags=-DFLAGNAME

@per1234
Copy link
Contributor

per1234 commented May 21, 2019

Is this an existing unmodified hardware core? If so, post a link to it. If you customized it yourself, then you need to provide the full boards.txt and platform.txt.

I also need the complete arduino-cli command you're running.

@per1234
Copy link
Contributor

per1234 commented May 24, 2019

I would like to make a feature request for the Arduino-CLI to explicitly support user-defined -D macros

We can consider #159 as the dedicated issue for that feature request and use this issue to investigate @manasIU's problem.

@per1234 per1234 added the bug label May 24, 2019
@manasIU
Copy link
Author

manasIU commented May 24, 2019

It's a slightly modified Dragonfly-l496RG board with custom debug flag options added (link).
Full arduino-cli command :
arduino-cli compile --fqbn grumpyoldpizza:stm32l4:Dragonfly-L496RG --build-properties build.extra_flags=-DDEBUGENABLE=1 sketch_name --verbose
When I run the above command, I see -DDEBUGENABLE=0 in the verbose output.

@nerdralph
Copy link

How do I tell arduino-cli to set certain flags?

You can use arduino-cli compile's --build-properties option to do things like:

arduino-cli compile --fqbn arduino:avr:uno --build-properties build.extra_flags=-DFLAGNAME SketchName

but be aware this will override the value of the build.extra_flags property that might have been set in your boards.txt.

Is there a way to save the fqbn and build-properties in the global config so they don't have to be repeated on the command line? I skimmed the source but couldn't find anything obvious. For now I'm using shell aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

7 participants