Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
Last active July 4, 2020 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threedaymonk/7d80e4e75edb369c2facd650ccb52406 to your computer and use it in GitHub Desktop.
Save threedaymonk/7d80e4e75edb369c2facd650ccb52406 to your computer and use it in GitHub Desktop.
Arduino IDE removal

How I worked out what the Arduino IDE was doing

Wrap each avr toolchain binary with a script that spies and reports on its command line arguments:

cd arduino-1.8.13/hardware/tools/avr
mv bin bin.real
mkdir bin
cd bin
cp path/to/wrapper .
chmod +x wrapper
ls ../bin.real | xargs -n 1 -I % ln -s wrapper %

Compile, and see what happened:

cat /tmp/avr.*

The build artefacts in /tmp/arduino_build_?????? are also useful.

#!/usr/bin/env ruby
require "shellwords"
tool_name = $0.split(/\//).last
full_path = "#{__dir__}.real/#{tool_name}"
args = ARGV.shelljoin
timestamp = Time.now.utc.strftime("%H%M%S.%L")
File.open("/tmp/avr.#{timestamp}", "w") do |io|
io.puts "#{tool_name} #{args}"
end
system(full_path + " " + args)
exit $?.exitstatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment