Skip to content

compile

arduino-cli compile

Compiles Arduino sketches.

Synopsis

Compiles Arduino sketches.

arduino-cli compile [flags]

Examples

  arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=\"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=-DPIN=2 \"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property build.extra_flags=-DPIN=2 --build-property "compiler.cpp.extra_flags=\"-DSSID=\"hello world\"\"" /home/user/Arduino/MySketch

Options

      --board-options strings                   List of board options separated by commas. Or can be used multiple times for multiple options.
      --build-cache-path string                 Builds of 'core.a' are saved into this path to be cached and reused.
      --build-path string                       Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.
      --build-property stringArray              Override a build property with a custom value. Can be used multiple times for multiple properties.
      --clean                                   Optional, cleanup the build folder and do not use any cached build.
      --discovery-timeout duration              Max time to wait for port discovery, e.g.: 30s, 1m (default 1s)
      --dump-profile                            Create and print a profile configuration from the build.
      --encrypt-key string                      The name of the custom encryption key to use to encrypt a binary during the compile process. Used only by the platforms that support it.
  -e, --export-binaries                         If set built binaries will be exported to the sketch folder.
  -b, --fqbn string                             Fully Qualified Board Name, e.g.: arduino:avr:uno
  -h, --help                                    help for compile
      --keys-keychain string                    The path of the dir to search for the custom keys to sign and encrypt a binary. Used only by the platforms that support it.
      --libraries strings                       Path to a collection of libraries. Can be used multiple times or entries can be comma separated.
      --library strings                         Path to a single library’s root folder. Can be used multiple times or entries can be comma separated.
      --only-compilation-database               Just produce the compilation database, without actually compiling. All build commands are skipped except pre* hooks.
      --optimize-for-debug                      Optional, optimize compile output for debugging, rather than for release.
      --output-dir string                       Save build artifacts in this directory.
  -p, --port string                             Upload port address, e.g.: COM3 or /dev/ttyACM2
      --preprocess                              Print preprocessed code to stdout instead of compiling.
  -m, --profile string                          Sketch profile to use
  -P, --programmer string                       Programmer to use, e.g: atmel_ice
  -l, --protocol string                         Upload port protocol, e.g: serial
      --quiet                                   Optional, suppresses almost every output.
      --show-properties string[="unexpanded"]   Show build properties instead of compiling. The properties are returned exactly as they are defined. Use "--show-properties=expanded" to replace placeholders with compilation context values. (default "disabled")
      --sign-key string                         The name of the custom signing key to use to sign a binary during the compile process. Used only by the platforms that support it.
  -u, --upload                                  Upload the binary after the compilation.
  -t, --verify                                  Verify uploaded binary after the upload.
      --warnings string                         Optional, can be: none, default, more, all. Used to tell gcc which warning level to use (-W flag). (default "none")

Options inherited from parent commands

      --additional-urls strings   Comma-separated list of additional URLs for the Boards Manager.
      --config-file string        The custom config file (if not specified the default will be used).
      --format string             The output format for the logs, can be: text, json, jsonmini, yaml (default "text")
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.
  -v, --verbose                   Print the logs on the standard output.

SEE ALSO