Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Confusing order in which the platformio.ini build_flags are passed to respective toolchains? #191
I am having an issue with the build flags when trying to configure the USB descriptors for the Teensy 3.1 board. Specifically I want to access the HID Keyboard/Mouse/Joystick functionality included in the Teensy libraries. These are contained within a preprocessor #if/#elif/#elif block determined by which value is defined during the compiler invocation. E.g.
For the Teensy framework, you have defined USB_SERIAL within the teensy base platform and this is passed to the compiler during the run command. As per the platformio instructions to use build_flags rather than create new platforms, I tried using the following platformio.ini setup.
With the intent to un-define the included USB_SERIAL value and define USB_HID to enable that portion of the USB code. The problem I have encountered is the order which the build_flags are passed to the compiler. The above configuration fails to compile (due to undeclared functions which are declared within the USB_HID conditional code block). The console output after platformio run is:
The '-UUSB_SERAL' option I declared is passed before the platform inherent '-DUSB_SERIAL' option, and as such does not clear it. I have not found a way to alter this order and this is preventing me from clearing the value and compiling my code. Note: If I manually rearrange the flags so the -U command follows, it will successfully compile as expected.
Should the platformio.ini build flags be passed last to rectify this issue?
Thanks for the great work so far!
changed the title from
Confusing order for passing the platformio.ini build_flags are passed to respective toolchains?
Confusing order in which the platformio.ini build_flags are passed to respective toolchains?
May 5, 2015
PlatformIO passes all