Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork114
A command line tool for compiling Arduino sketches
License
arduino/arduino-builder
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A command line tool for compiling Arduino sketches
This tool is able to parseArduino Hardware specifications, properly rungcc and produce compiled sketches.
An Arduino sketch differs from a standard C program in that it misses amain (provided by the Arduino core), function prototypes are not mandatory, and libraries inclusion is automagic (you just have to#include them).This tool generates function prototypes and gathers library paths, providinggcc with all the needed-I params.
-compileor-dump-prefsor-preprocess: Optional. If omitted, defaults to-compile.-dump-prefswill just print all build preferences used,-compilewill use those preferences to run the actual compiler,-preprocesswill only print preprocessed code to stdout.-hardware: Mandatory. Folder containing Arduino platforms. An example is thehardwarefolder shipped with the Arduino IDE, or thepackagesfolder created by Arduino Boards Manager. Can be specified multiple times. If conflicting hardware definitions are specified, the last one wins.-tools: Mandatory. Folder containing Arduino tools (gcc,avrdude...). An example is thehardware/toolsfolder shipped with the Arduino IDE, or thepackagesfolder created by Arduino Boards Manager. Can be specified multiple times.-libraries: Optional. Folder containing Arduino libraries. An example is thelibrariesfolder shipped with the Arduino IDE. Can be specified multiple times.-fqbn: Mandatory. Fully Qualified Board Name, e.g.: arduino:avr:uno-build-path: Optional. Folder where to save compiled files. If omitted, a folder will be created in the temporary folder specified by your OS.-prefs=key=value: Optional. It allows to override some build properties.-warnings: Optional, can be "none", "default", "more" and "all". Defaults to "none". Used to tellgccwhich warning level to use (-Wflag).-verbose: Optional, turns on verbose mode.-quiet: Optional, supresses almost every output.-debug-level: Optional, defaults to "5". Used for debugging. Set it to 10 when submitting an issue.-core-api-version: Optional, defaults to "10600". The version of the Arduino IDE which is using this tool.-logger: Optional, can be "human", "humantags" or "machine". Defaults to "human". If "humantags" the messages are qualified with a prefix that indicates their level (info, debug, error). If "machine", messages emitted will be in a format which the Arduino IDE understands and that it uses for I18N.-version: if specified, prints version and exits.-build-options-file: it specifies path to a localbuild.options.jsonfile (see paragraph below), which allows you to omit specifying params such as-hardware,-tools,-libraries,-fqbn,-prefand-ide-version.-vid-pid: when specified, VID/PID specific build properties are used, if boards supports them.
Final mandatory parameter is the sketch to compile (of course).
Every time you run this tool, it will create abuild.options.json file in build path. It's used to understand if build options (such as hardware folders, fqbn and so on) were changed when compiling the same sketch.If they changed, the whole build path is wiped out. If they didn't change, previous compiled files will be reused if the corresponding source files didn't change as well.You can save this file locally and use it instead of specifying-hardware,-tools,-libraries,-fqbn,-pref and-ide-version.
SeeDoing continuous integration with arduino builder.
You needa recent version of Go (>=1.8.0).
To build, run the following commands:
go get github.com/go-errors/errorsgo get github.com/stretchr/testifygo get github.com/jstemmer/go-junit-reportgo get github.com/arduino/go-properties-mapgo get github.com/arduino/go-timeutilsgo get github.com/arduino/arduino-buildergo build github.com/arduino/arduino-builder/arduino-builderIn order to run the tests, type:
go test github.com/arduino/arduino-builder/arduino-builder/...This runs all tests, showing any failures and a summary at the end.Add the -v option to show each test as it is being ran. Currently,arduino-builder itself also generates copious output, even fornon-failing testcases and without -v, and testing does not stop at thefirst failure, so you probably want to redirect test output so you canscroll back to find any failures.
To run a single test, use the -run option, which accepts a regularexpression (see also go help testflag).
go test github.com/arduino/arduino-builder/arduino-builder/... -run 'TestBuilderEmptySketch'go test github.com/arduino/arduino-builder/arduino-builder/... -run 'TestPrototypesAdder.*'In jenkins, use
go test -v github.com/arduino/arduino-builder/arduino-builder/... | bin/go-junit-report > report.xmlThe first time you run the tests, some needed files (toolchains andsource files) will be downloaded, which needs about 1GB of space (at thetime of writing). If you have a slow connection, this download mightexceed the default 10 minute timeout for a single test. If you run intothis, add-timeout 60m or similar to the commandline to extend thetimeout. If you are running on slower system (like a rasbperry pi),increasing the timeout might be needed as well.
arduino-builder is licensed under General Public License version 2, as published by the Free Software Foundation. SeeLICENSE.txt.
Copyright (C) 2017 Arduino AG and contributors
Seehttps://www.arduino.cc/ andhttps://github.com/arduino/arduino-builder/graphs/contributors
About
A command line tool for compiling Arduino sketches
Topics
Resources
License
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.