Arduino Builder¶
‘arduino-builder’ is a tool provided along with the Arduino IDE. Let’s take a look at how the command is invoked when the commpile button is pressed:
/home/marcidy/arduino-1.8.10/arduino-builder -dump-prefs -logger=machine -hardware /home/marcidy/arduino-1.8.10/hardware -hardware /home/marcidy/.arduino15/packages -hardware /home/marcidy/Arduino/hardware -tools /home/marcidy/arduino-1.8.10/tools-builder -tools /home/marcidy/arduino-1.8.10/hardware/tools/avr -tools /home/marcidy/.arduino15/packages -built-in-libraries /home/marcidy/arduino-1.8.10/libraries -libraries /home/marcidy/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10810 -build-path /tmp/arduino_build_709419 -warnings=none -build-cache /tmp/arduino_cache_430568 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avrdude.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -verbose /home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino
/home/marcidy/arduino-1.8.10/arduino-builder -compile -logger=machine -hardware /home/marcidy/arduino-1.8.10/hardware -hardware /home/marcidy/.arduino15/packages -hardware /home/marcidy/Arduino/hardware -tools /home/marcidy/arduino-1.8.10/tools-builder -tools /home/marcidy/arduino-1.8.10/hardware/tools/avr -tools /home/marcidy/.arduino15/packages -built-in-libraries /home/marcidy/arduino-1.8.10/libraries -libraries /home/marcidy/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10810 -build-path /tmp/arduino_build_709419 -warnings=none -build-cache /tmp/arduino_cache_430568 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avrdude.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -verbose /home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino
Using board 'uno' from platform in folder: /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2
Using core 'arduino' from platform in folder: /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2
These are two distinct steps goverend by the arduino-build command: first gather information about the project using -dump-perfs and then use that information to compile the code using -compile. Let’s explore both in detail.
Dump Perfs¶
This step gathers information stored in settings from the Arduino IDE and from the code being compiled.
Expanding the first line so it’s more readable:
/home/marcidy/arduino-1.8.10/arduino-builder
-dump-prefs
-logger=machine
-hardware /home/marcidy/arduino-1.8.10/hardware
-hardware /home/marcidy/.arduino15/packages
-hardware /home/marcidy/Arduino/hardware
-tools /home/marcidy/arduino-1.8.10/tools-builder
-tools /home/marcidy/arduino-1.8.10/hardware/tools/avr
-tools /home/marcidy/.arduino15/packages
-built-in-libraries /home/marcidy/arduino-1.8.10/libraries
-libraries /home/marcidy/Arduino/libraries
-fqbn=arduino:avr:uno
-ide-version=10810
-build-path /tmp/arduino_build_709419
-warnings=none
-build-cache /tmp/arduino_cache_430568
-prefs=build.warn_data_percentage=75
-prefs=runtime.tools.arduinoOTA.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
-prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
-prefs=runtime.tools.avr-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
-prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
-prefs=runtime.tools.avrdude.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
-prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
-verbose /home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino
Again since I’m using linux, the /home/marcidy/arduino-1.8.10/ is the path to the programs that come with the Arduino IDE. They’ll be different for everyone but the idea here is to learn to read this output and deconstruct it into its parts, and discover from those parts what is happening.
The command has a number of repeated options like -hardware and -tools which are telling the program where to look for files important to compiliation. Let’s go over the options.
Generic options¶
- -dump-perfs
- The command, what is to be done, i.e. gather information about the project and preferences from the Arduino IDE.
- -logger
- Probably configures logging for executing on the target hardware, but not sure
- -ide-version
- The version of the Arduino IDE used to commpile the program. Mine is 1.8.10 which translates to 10810.
- -build-path
- directory on the machine to look for / save files related to compilation
- -build-cache
- When compiling, look here to see if we can reuse any compiliation results. Save compilation results here when required.
- -warnings
- Compiliers emit warnings that aren’t always necessary for successful compilation. This probably translates down to a flag during the actual compilation step to turn off warnings.
- -verbose
- Print information to the screen relevent to this step
Note that the file I’m compiling is /home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino, which is the final input into the command.
Library options¶
Libraries are code required by the project that arent’ written directly as part of the project. For example, a servo library, or the libraries that make up the Arduino ecosystem.
- -built-in-libraries
- This is the path to the libraries which come with the Arduino IDE. Only the libraries required for the project will be compiled in, but this path tells the compiler where to find the libraries.
- -libraries
- Again tells the compiler where to find libraries required for compilation. This would be the libraries downloaded from the Arduino IDE via the library manager or possibly placed manually.
- -tools
- paths to programs which help in pre-compiliation steps, also knows as ‘preprocessing’ or ‘precompiling’.
Hardware options¶
- -hardware
- tell the program where to find files with hardware. It’s repeated a number of times to tell the program to look in various locations, meaning the hardware definitions can be in any of the listed directories.
- -fqbn
- “fully qualified board name”, which is the board for which we are compiling.
Toolchain options¶
- -prefs=runtime.tools.arduinoOTA.path
- Path to Over The Air updater
- -prefs=runtime.tools.arduinoOTA-1.3.0.path
- Path to version specific OTA updater
- -prefs=runtime.tools.avr-gcc.path
- avr-gcc is the AVR Gnu C Compiler. AVR is the type of processor used in arduino UNOs (and others, but not all arduino compatible processors are AVRs). This option tells the program where to find it.
- -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path
- path to a specific avr-gcc version
- -prefs=runtime.tools.avrdude.path
- Path to the AVRDownloadersUploader (avr-dude). We’ll go into this more in depth in other sections. It’s the tool used to upload a compiled program to an avr processor.
- -prefs=runtime.tools.avrdude-6.3.0-arduino17.path
- Version specific path to avr-dude.
Dump perfs summary¶
From this command, we see that the tool has determined what hardware we are using and what libraries and tools are required for the project. We also see where intermediate steps are saved on the machine, specifically in the -build-path and -build-cache locations. We’ll be investigating those in a separate section. Pay close attention to the values used when using the IDE, they change, even for the same project, and they get deleted with the program exits.
If you run this command on it’s own, you’ll see a wealth of information.
===info ||| Progress {0} ||| [0.00]
===info ||| Progress {0} ||| [50.00]
===info ||| Progress {0} ||| [55.56]
===info ||| Progress {0} ||| [61.11]
===info ||| Progress {0} ||| [66.67]
===info ||| Progress {0} ||| [72.22]
===info ||| Progress {0} ||| [77.78]
===info ||| Using board '{0}' from platform in folder: {1} ||| [uno /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2]
===info ||| Using core '{0}' from platform in folder: {1} ||| [arduino /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2]
===info ||| Progress {0} ||| [83.33]
===info ||| Progress {0} ||| [88.89]
===info ||| Progress {0} ||| [94.44]
===info ||| Progress {0} ||| [100.00]
===info ||| Progress {0} ||| [101.39]
===info ||| Progress {0} ||| [102.78]
===info ||| Progress {0} ||| [104.17]
===info ||| Progress {0} ||| [105.56]
_id=uno
archive_file_path={build.path}/{archive_file}
bootloader.extended_fuses=0xFD
bootloader.file=optiboot/optiboot_atmega328.hex
bootloader.high_fuses=0xDE
bootloader.lock_bits=0x0F
bootloader.low_fuses=0xFF
bootloader.tool=avrdude
bootloader.unlock_bits=0x3F
build.arch=AVR
build.board=AVR_UNO
build.core=arduino
build.core.path=/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino
build.extra_flags=
build.f_cpu=16000000L
build.fqbn=arduino:avr:uno
build.mcu=atmega328p
build.path=/tmp/arduino_build_709419
build.project_name=Fade.ino
build.source.path=/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade
build.system.path=/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/system
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
build.usb_manufacturer="Unknown"
build.variant=standard
build.variant.path=/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard
build.warn_data_percentage=75
compiler.S.extra_flags=
compiler.S.flags=-c -g -x assembler-with-cpp -flto -MMD
compiler.ar.cmd=avr-gcc-ar
compiler.ar.extra_flags=
compiler.ar.flags=rcs
compiler.c.cmd=avr-gcc
compiler.c.elf.cmd=avr-gcc
compiler.c.elf.extra_flags=
compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections
compiler.c.extra_flags=
compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects
compiler.cpp.cmd=avr-g++
compiler.cpp.extra_flags=
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto
compiler.elf2hex.cmd=avr-objcopy
compiler.elf2hex.extra_flags=
compiler.elf2hex.flags=-O ihex -R .eeprom
compiler.ldflags=
compiler.objcopy.cmd=avr-objcopy
compiler.objcopy.eep.extra_flags=
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.size.cmd=avr-size
compiler.warning_flags=-w
compiler.warning_flags.all=-Wall -Wextra
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.none=-w
extra.time.dst=3600
extra.time.local=1592684105
extra.time.utc=1592709305
extra.time.zone=-28800
ide_version=10810
name=Arduino Uno
pid.0=0x0043
pid.1=0x0001
pid.2=0x0043
pid.3=0x0243
preproc.includes.flags=-w -x c++ -M -MG -MP
preproc.macros.flags=-w -x c++ -E -CC
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
recipe.output.save_file={build.project_name}.{build.variant}.hex
recipe.output.tmp_file={build.project_name}.hex
recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}"
recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}"
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
runtime.hardware.path=/home/marcidy/.arduino15/packages/arduino/hardware/avr
runtime.ide.path=/home/marcidy/arduino-1.8.10
runtime.ide.version=10810
runtime.os=linux
runtime.platform.path=/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2
runtime.tools.CMSIS-4.5.0.path=/home/marcidy/.arduino15/packages/arduino/tools/CMSIS/4.5.0
runtime.tools.CMSIS-Atmel-1.2.0.path=/home/marcidy/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0
runtime.tools.CMSIS-Atmel.path=/home/marcidy/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0
runtime.tools.CMSIS.path=/home/marcidy/.arduino15/packages/arduino/tools/CMSIS/4.5.0
runtime.tools.arduino-preprocessor-0.1.5.path=/home/marcidy/arduino-1.8.10/tools-builder/arduino-preprocessor/0.1.5
runtime.tools.arduino-preprocessor.path=/home/marcidy/arduino-1.8.10/tools-builder/arduino-preprocessor/0.1.5
runtime.tools.arduinoOTA-1.2.1.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.2.1
runtime.tools.arduinoOTA-1.3.0.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
runtime.tools.arduinoOTA.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
runtime.tools.arm-none-eabi-gcc-7-2017q4.path=/home/marcidy/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4
runtime.tools.arm-none-eabi-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4
runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
runtime.tools.avr-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
runtime.tools.avrdude-6.3.0-arduino17.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
runtime.tools.avrdude.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
runtime.tools.bossac-1.7.0-arduino3.path=/home/marcidy/.arduino15/packages/arduino/tools/bossac/1.7.0-arduino3
runtime.tools.bossac-1.8.0-48-gb176eee.path=/home/marcidy/.arduino15/packages/arduino/tools/bossac/1.8.0-48-gb176eee
runtime.tools.bossac.path=/home/marcidy/.arduino15/packages/arduino/tools/bossac/1.8.0-48-gb176eee
runtime.tools.ctags-5.8-arduino11.path=/home/marcidy/arduino-1.8.10/tools-builder/ctags/5.8-arduino11
runtime.tools.ctags.path=/home/marcidy/arduino-1.8.10/tools-builder/ctags/5.8-arduino11
runtime.tools.esptool_py-2.6.1.path=/home/marcidy/.arduino15/packages/Heltec-esp32/tools/esptool_py/2.6.1
runtime.tools.esptool_py.path=/home/marcidy/.arduino15/packages/Heltec-esp32/tools/esptool_py/2.6.1
runtime.tools.mkspiffs-0.2.3.path=/home/marcidy/.arduino15/packages/Heltec-esp32/tools/mkspiffs/0.2.3
runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=/home/marcidy/.arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9
runtime.tools.mkspiffs.path=/home/marcidy/.arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9
runtime.tools.openocd-0.10.0-arduino7.path=/home/marcidy/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7
runtime.tools.openocd.path=/home/marcidy/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7
runtime.tools.python-3.7.2-post1.path=/home/marcidy/.arduino15/packages/esp8266/tools/python/3.7.2-post1
runtime.tools.python.path=/home/marcidy/.arduino15/packages/esp8266/tools/python/3.7.2-post1
runtime.tools.xtensa-esp32-elf-gcc-1.22.0-80-g6c4433a-5.2.0.path=/home/marcidy/.arduino15/packages/Heltec-esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0
runtime.tools.xtensa-esp32-elf-gcc.path=/home/marcidy/.arduino15/packages/Heltec-esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0
runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=/home/marcidy/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9
runtime.tools.xtensa-lx106-elf-gcc.path=/home/marcidy/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9
software=ARDUINO
tools.arduino-preprocessor.cmd.path={path}/arduino-preprocessor
tools.arduino-preprocessor.path={runtime.tools.arduino-preprocessor.path}
tools.arduino-preprocessor.pattern="{cmd.path}" "{source_file}" "{codecomplete}" -- -std=gnu++11
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.params.verbose=-v
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m
tools.avrdude.cmd.path={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m
tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.program.params.noverify=-V
tools.avrdude.program.params.quiet=-q -q
tools.avrdude.program.params.verbose=-v
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.program.verify=
tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port {upload.network.port} -sketch "{build.path}/{build.project_name}.hex" -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}
tools.avrdude.upload.params.noverify=-V
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.upload.verify=
tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}
tools.ctags.cmd.path={path}/ctags
tools.ctags.path={runtime.tools.ctags.path}
tools.ctags.pattern="{cmd.path}" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "{source_file}"
upload.maximum_data_size=2048
upload.maximum_size=32256
upload.protocol=arduino
upload.speed=115200
upload.tool=avrdude
version=1.8.2
vid.0=0x2341
vid.1=0x2341
vid.2=0x2A03
vid.3=0x2341
Yikes, that’s a lot. I think my bank code is in there. Well, you can peruse that if you want. It’s listing some programs it will use, options for those programs, and locations in the filesystem.
This command, on it’s own, doesn’t modify anything.
Compile¶
As you can guess from the name, compiling means ‘putting it together’. Specifically gathering all the necessary information and coverting the human readable source code into a machine readable binary.
/home/marcidy/arduino-1.8.10/arduino-builder
-compile
-logger=machine
-hardware /home/marcidy/arduino-1.8.10/hardware
-hardware /home/marcidy/.arduino15/packages
-hardware /home/marcidy/Arduino/hardware
-tools /home/marcidy/arduino-1.8.10/tools-builder
-tools /home/marcidy/arduino-1.8.10/hardware/tools/avr
-tools /home/marcidy/.arduino15/packages
-built-in-libraries /home/marcidy/arduino-1.8.10/libraries
-libraries /home/marcidy/Arduino/libraries
-fqbn=arduino:avr:uno
-ide-version=10810
-build-path /tmp/arduino_build_709419
-warnings=none
-build-cache /tmp/arduino_cache_430568
-prefs=build.warn_data_percentage=75
-prefs=runtime.tools.arduinoOTA.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
-prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/marcidy/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0
-prefs=runtime.tools.avr-gcc.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
-prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5
-prefs=runtime.tools.avrdude.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
-prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/home/marcidy/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
-verbose /home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino
Well, these are identical to the -dump-perfs invokation, so no need to reiterate their defintions. The only difference here is that the program is actually going to compile the program using this information. Compiliation is covered in the Quickstart.
Running the command on it’s own displays output related to compilation.
The lines like ===info ||| looks like it’s information for the IDE itself. Removing those, we see these commands run:
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /tmp/arduino_build_709419/sketch/Fade.ino.cpp -o /dev/null
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /tmp/arduino_build_709419/sketch/Fade.ino.cpp -o /tmp/arduino_build_709419/preproc/ctags_target_for_gcc_minus_e.cpp
/home/marcidy/arduino-1.8.10/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_709419/preproc/ctags_target_for_gcc_minus_e.cpp
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /tmp/arduino_build_709419/sketch/Fade.ino.cpp -o /tmp/arduino_build_709419/sketch/Fade.ino.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -x assembler-with-cpp -flto -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring_pulse.S -o /tmp/arduino_build_709419/core/wiring_pulse.S.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/WInterrupts.c -o /tmp/arduino_build_709419/core/WInterrupts.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/hooks.c -o /tmp/arduino_build_709419/core/hooks.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring_analog.c -o /tmp/arduino_build_709419/core/wiring_analog.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring.c -o /tmp/arduino_build_709419/core/wiring.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring_digital.c -o /tmp/arduino_build_709419/core/wiring_digital.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring_pulse.c -o /tmp/arduino_build_709419/core/wiring_pulse.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/wiring_shift.c -o /tmp/arduino_build_709419/core/wiring_shift.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/CDC.cpp -o /tmp/arduino_build_709419/core/CDC.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial1.cpp -o /tmp/arduino_build_709419/core/HardwareSerial1.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial.cpp -o /tmp/arduino_build_709419/core/HardwareSerial.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial0.cpp -o /tmp/arduino_build_709419/core/HardwareSerial0.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial2.cpp -o /tmp/arduino_build_709419/core/HardwareSerial2.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial3.cpp -o /tmp/arduino_build_709419/core/HardwareSerial3.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/IPAddress.cpp -o /tmp/arduino_build_709419/core/IPAddress.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/PluggableUSB.cpp -o /tmp/arduino_build_709419/core/PluggableUSB.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/Print.cpp -o /tmp/arduino_build_709419/core/Print.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/Stream.cpp -o /tmp/arduino_build_709419/core/Stream.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/Tone.cpp -o /tmp/arduino_build_709419/core/Tone.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/USBCore.cpp -o /tmp/arduino_build_709419/core/USBCore.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/WMath.cpp -o /tmp/arduino_build_709419/core/WMath.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/WString.cpp -o /tmp/arduino_build_709419/core/WString.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/abi.cpp -o /tmp/arduino_build_709419/core/abi.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/main.cpp -o /tmp/arduino_build_709419/core/main.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/standard /home/marcidy/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/new.cpp -o /tmp/arduino_build_709419/core/new.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring_pulse.S.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/WInterrupts.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/hooks.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring_analog.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring_digital.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring_pulse.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/wiring_shift.c.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/CDC.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/HardwareSerial.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/HardwareSerial0.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/HardwareSerial1.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/HardwareSerial2.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/HardwareSerial3.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/IPAddress.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/PluggableUSB.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/Print.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/Stream.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/Tone.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/USBCore.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/WMath.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/WString.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/abi.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/main.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar rcs /tmp/arduino_build_709419/core/core.a /tmp/arduino_build_709419/core/new.cpp.o
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/arduino_build_709419/Fade.ino.elf /tmp/arduino_build_709419/sketch/Fade.ino.cpp.o /tmp/arduino_build_709419/core/core.a -L/tmp/arduino_build_709419 -lm
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino_build_709419/Fade.ino.elf /tmp/arduino_build_709419/Fade.ino.eep
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy -O ihex -R .eeprom /tmp/arduino_build_709419/Fade.ino.elf /tmp/arduino_build_709419/Fade.ino.hex
/home/marcidy/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-size -A /tmp/arduino_build_709419/Fade.ino.elf
Lot’s of output, but it falls into specific classes of commands which are further covered in Command Line Compilation.
Let’s look at the build directory /tmp/arduino_build_709419, and specifically order the files by the time they were creates.
total 108
-rw-r--r-- 1 marcidy marcidy 1295 Jun 20 20:24 build.options.json
-rw-r--r-- 1 marcidy marcidy 421 Jun 20 20:24 includes.cache
drwxr-xr-x 2 marcidy marcidy 4096 Jun 20 20:24 preproc
drwxr-xr-x 2 marcidy marcidy 4096 Jun 20 20:24 sketch
drwxr-xr-x 2 marcidy marcidy 4096 Jun 20 20:24 libraries
drwxr-xr-x 2 marcidy marcidy 4096 Jun 20 20:24 core
-rwxr-xr-x 1 marcidy marcidy 15952 Jun 20 20:24 Fade.ino.elf
drwxrwxrwt 22 root root 45056 Jun 20 20:24 ..
-rw-r--r-- 1 marcidy marcidy 4596 Jun 20 20:24 Fade.ino.with_bootloader.hex
-rw-r--r-- 1 marcidy marcidy 3250 Jun 20 20:24 Fade.ino.hex
-rw-r--r-- 1 marcidy marcidy 13 Jun 20 20:24 Fade.ino.eep
drwxr-xr-x 6 marcidy marcidy 4096 Jun 20 20:24 .
Look at build.options.json and include.cache, but we’re going to look in the “preproc” and “sketch” directories.
In the ‘preproc’ directory, there’s just one file.
# 1 "/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino"
/*
Fade
This example shows how to fade an LED on pin 9 using the analogWrite()
function.
The analogWrite() function uses PWM, so if you want to change the pin you're
using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Fade
*/
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, 0x1);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
This file looks a lot like the sketch, but with a change on the first line. We’ll, at least they give us a hint about what the file is for in the filename: ctags target for gcc -E.
You can google ctags to see what it’s all about. I’m not going to cover it here.
In the ‘sketch’ directory, there are 3 files:
Fade.ino.cpp
Fade.ino.cpp.d
Fade.ino.cpp.o
Sketch Preprocessing¶
arduino-builder converted the sketch into valid C++ by automatically making changes to the .ino file. Take a look at Fade.ino.cpp.
#include <Arduino.h>
#line 1 "/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino"
/*
Fade
This example shows how to fade an LED on pin 9 using the analogWrite()
function.
The analogWrite() function uses PWM, so if you want to change the pin you're
using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Fade
*/
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
#line 21 "/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino"
void setup();
#line 27 "/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino"
void loop();
#line 21 "/home/marcidy/arduino-1.8.10/examples/01.Basics/Fade/Fade.ino"
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
We see the additions of #line directives, along with function prototypes for setup() and loop().
C++ directives covers what the #line does as well as cover everything you see that starts with a #.
The added function function prototypes are required as a rule of writing C++:
void setup();
void loop();
This is covered in gerenal by learning C++. I’ll add here that C++ required you to declare the type of all variables before using the variable. Here we are telling the compilier that “setup” and “loop” are functions which doesn’t return anything (void). This guide, or at least this part of it, isn’t concerned with learning C/C++, but there’s plenty of resources for that. arduino-builder is doing a bit of extra work for us at this stage so that writing sketches is a bit easier than writing valid C++. Not much easier, but slightly easier.
Now that we have valid C++ thanks to the arduino-builder pre-processing the .ino files, we can move to the topic of compilation. This will cover the rest of the files created during this process.
Head over to Command Line Compilation to keep moving forward.