-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrakefile.rb
30 lines (26 loc) · 1016 Bytes
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
PROJECT_CEEDLING_ROOT = "vendor/ceedling"
load "#{PROJECT_CEEDLING_ROOT}/lib/rakefile.rb"
task :default => %w[ test:all release ]
# Dummy task to ensure that the SERIAL_PORT environment variable is set.
# It can be set on the command line as follows:
# $ rake SERIAL_PORT=[serial port name]
task :serial_port do
unless ENV['SERIAL_PORT']
raise "SERIAL_PORT is not defined in the environment!"
end
end
desc "Convert the output binary to a hex file for programming to the Arduino"
task :convert => :release do
bin_file = "build/release/#{RELEASE_BUILD_OUTPUT}.bin"
hex_file = "build/release/#{RELEASE_BUILD_OUTPUT}.hex"
cmd = "#{ENV['OBJCOPY']} -O ihex -R .eeprom #{bin_file} #{hex_file}"
puts cmd
sh cmd
end
desc "Program the Arduino over the serial port."
task :program => [:convert, :serial_port] do
hex_file = "build/release/#{RELEASE_BUILD_OUTPUT}.hex"
cmd = "avrdude -F -V -c arduino -p #{ENV['MCU']} -P #{ENV['SERIAL_PORT']} -b 115200 -U flash:w:#{hex_file}"
puts cmd
sh cmd
end