Permalink
Browse files

make MCU, PARTNO and F_CPU configurable

  • Loading branch information...
gdamjan authored and sw17ch committed Oct 17, 2011
1 parent 3a19d2b commit 617adde81d28872879f03cc058dad6b029ef13b7
Showing with 8 additions and 5 deletions.
  1. +8 −5 Rakefile
View
@@ -1,6 +1,9 @@
require 'rake/clean'
require 'fileutils'
+MCU = ENV['MCU'] || 'atmega328p'
+PARTNO = ENV['PARTNO'] || MCU
+F_CPU = ENV['F_CPU'] || '16000000UL'
SERIAL_PORT = ENV['SERIAL_PORT']
PROG = 'scaffold'
SRCDIR = 'src'
@@ -23,16 +26,16 @@ TARGET = {
:compiler => 'avr-gcc',
:compiler_args => [
'-DTARGET',
- '-DF_CPU=16000000UL',
- '-mmcu=atmega328p',
+ "-DF_CPU=#{F_CPU}",
+ "-mmcu=#{MCU}",
'-Iinclude/',
'-Wall',
'-Os',
'-c'
],
:linker => 'avr-gcc',
:linker_args => [
- '-mmcu=atmega328p'
+ "-mmcu=#{MCU}"
],
:objcopy => 'avr-objcopy'
}
@@ -90,11 +93,11 @@ namespace :target do
desc "Program the Arduino over the serial port."
task :program => [:convert, :serial_port] do
- sh "avrdude -F -V -c arduino -p ATMEGA328P -P #{SERIAL_PORT} -b 115200 -U flash:w:#{PROG}.hex"
+ sh "avrdude -F -V -c arduino -p #{PARTNO} -P #{SERIAL_PORT} -b 115200 -U flash:w:#{PROG}.hex"
end
desc "Make a backup hex image of the flash contents."
task :backup, [:backup_name] => :serial_port do |t, args|
- sh "avrdude -F -V -c arduino -p ATMEGA328P -P #{SERIAL_PORT} -b 115200 -U flash:r:#{args.backup_name}:i"
+ sh "avrdude -F -V -c arduino -p #{PARTNO} -P #{SERIAL_PORT} -b 115200 -U flash:r:#{args.backup_name}:i"
end
end

0 comments on commit 617adde

Please sign in to comment.