I was struggling with how to set extra build options with arduino-cli and Teensy builds. Teensyduino, unless you add it yourself, doesn't support the Arduino-standard
I figured out a way, and that's to append your extra flags to
I haven't yet figured out an easy way, short of modifying Teensyduino's platform.txt file, to add extra build options using the Arduino IDE.
Notes and relevant posts:
1. How to add the Arduino-style "extra_flags" feature to Teensyduino: https://github.com/ssilverman/QNEth...E.md#configuring-macros-using-the-arduino-ide
2. https://forum.pjrc.com/index.php?threads/cant-recognize-platform-local-txt.76492/
3. https://forum.pjrc.com/index.php?threads/compilation-flag-with-arduino-cli.70580/
4. https://forum.pjrc.com/index.php?th...rty-to-preprocessing-and-compile-phase.73426/
compiler.cpp.extra_flags, compiler.c.extra_flags, and the like. (See: https://forum.pjrc.com/index.php?threads/request-for-arduino-ide-extra_flags-support.72556/)I figured out a way, and that's to append your extra flags to
build.flags.defs. Here's an example command:
Bash:
# Change the following to suit your needs
board=teensy:avr:teensy41
path=examples/LinkWatcher
all_flags="$(arduino-cli compile -b ${board} ${path} --show-properties |grep build.flags.defs) ${flags}"
arduino-cli compile \
--warnings all \
--build-property "${all_flags}" \
-b ${board} ${path}
I haven't yet figured out an easy way, short of modifying Teensyduino's platform.txt file, to add extra build options using the Arduino IDE.
Notes and relevant posts:
1. How to add the Arduino-style "extra_flags" feature to Teensyduino: https://github.com/ssilverman/QNEth...E.md#configuring-macros-using-the-arduino-ide
2. https://forum.pjrc.com/index.php?threads/cant-recognize-platform-local-txt.76492/
3. https://forum.pjrc.com/index.php?threads/compilation-flag-with-arduino-cli.70580/
4. https://forum.pjrc.com/index.php?th...rty-to-preprocessing-and-compile-phase.73426/