ARDUINO-BUILDER(1)

✨ NAME ✨

arduino-builder β€” compiles Arduino sketches πŸ’…


🌸 SYNOPSIS 🌸

arduino-builder mandatory-arguments [options] sketch

πŸ’– DESCRIPTION πŸ’–

Okay bestie, so arduino-builder is a command line tool for compiling Arduino sketches. That's the whole vibe. 🫢

What it actually does: it parses Arduino Hardware specifications, runs gcc properly, and produces compiled sketches. Iconic behavior, no cap.

Now here's the tea about why an Arduino sketch is not just a standard C program β˜•:

  • it's missing a main β€” that's provided by the Arduino core, so don't worry about it
  • function prototypes are not mandatory (yes, really)
  • library inclusion is automagic β€” you literally just have to #include them and it's handled ✨

So this tool generates those function prototypes and gathers the library paths, handing gcc all the -I params it needs. She's doing the most so you don't have to. πŸ‘‘


πŸ‘‘ OPTIONS πŸ‘‘

Every single time you run this tool, it creates a build.options.json file in the build path. Why? Because it needs to know whether the build options changed (think hardware folders, fqbn, and so on) when you're compiling the same sketch.

  • If they changed β†’ the whole build path gets wiped out. Gone. πŸ’€
  • If they didn't change β†’ previous compiled files get reused, as long as the corresponding source files didn't change either. Efficient queen. ✨

And plot twist: you can save this file locally and use it instead of specifying -hardware, -tools, -libraries, -fqbn, -pref and -ide-version. Slay.

πŸŽ€ Mandatory πŸŽ€

  • -hardware folder β€” the folder containing Arduino platforms. For example, the hardware folder that ships with the Arduino IDE, or the packages folder that Arduino Boards Manager creates. You can specify it multiple times. And if you specify conflicting hardware definitions? The last one wins, periodt.
  • -tools folder β€” the folder containing Arduino tools (gcc, avrdude...). Like the hardware/tools folder shipped with the Arduino IDE, or the packages folder created by Arduino Boards Manager. Can be specified multiple times too.
  • -fqbn name β€” Fully Qualified Board Name, e.g.: arduino:avr:uno.

πŸ¦‹ Optional πŸ¦‹

  • -compile | -dump-prefs | -preprocess β€” if you omit this, it defaults to -compile. Here's the breakdown: dump-prefs just prints all the build preferences used, -compile uses those preferences to run the actual compiler, and -preprocess only prints preprocessed code to stdout.
  • -libraries folder β€” folder containing Arduino libraries, like the libraries folder shipped with the Arduino IDE. Can be specified multiple times.
  • -build-path folder β€” folder where the compiled files get saved. If you skip it, a folder gets created in the temporary folder specified by your OS.
  • -prefs=key=value β€” lets you override some build properties.
  • -warnings β€” can be "none", "default", "more" and "all". Defaults to "none". This tells gcc which warning level to use (the -W flag).
  • -verbose β€” turns on verbose mode. Spill the details. πŸ—£οΈ
  • -quiet β€” suppresses almost every output. Shhh. 🀫
  • -debug-level β€” defaults to "5". Used for debugging. Set it to 10 when submitting an issue. (Do it, bestie, the maintainers will love you for it πŸ’œ)
  • -core-api-version β€” defaults to "10600". This is the version of the Arduino IDE that's using this tool.
  • -logger β€” can be "human", "humantags" or "machine". Defaults to "human". If it's "humantags", messages get qualified with a prefix indicating their level (info, debug, error). If it's "machine", the messages emitted come out in a format that the Arduino IDE understands and uses for I18N.
  • -version β€” if specified, prints the version and exits. Short and sweet. 🌟
  • -build-options-file path β€” path to a local build.options.json file, which lets you omit specifying params such as -hardware, -tools, -libraries, -fqbn, -pref and -ide-version.
  • -vid-pid β€” when specified, VID/PID specific build properties get used, if the board supports them. πŸ‘€

🌈 SEE ALSO 🌈


and that's the whole page, bestie!! this manual came from Arduino AG, dated March 2018, and it's the general commands manual for section 1. go compile something gorgeous πŸ¦‹βœ¨πŸ’–