Skip to content

Commit

Permalink
make MCU, PARTNO and F_CPU configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamjan authored and sw17ch committed Oct 18, 2011
1 parent 3a19d2b commit 617adde
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Rakefile
@@ -1,6 +1,9 @@
require 'rake/clean' require 'rake/clean'
require 'fileutils' require 'fileutils'


MCU = ENV['MCU'] || 'atmega328p'
PARTNO = ENV['PARTNO'] || MCU
F_CPU = ENV['F_CPU'] || '16000000UL'
SERIAL_PORT = ENV['SERIAL_PORT'] SERIAL_PORT = ENV['SERIAL_PORT']
PROG = 'scaffold' PROG = 'scaffold'
SRCDIR = 'src' SRCDIR = 'src'
Expand All @@ -23,16 +26,16 @@ TARGET = {
:compiler => 'avr-gcc', :compiler => 'avr-gcc',
:compiler_args => [ :compiler_args => [
'-DTARGET', '-DTARGET',
'-DF_CPU=16000000UL', "-DF_CPU=#{F_CPU}",
'-mmcu=atmega328p', "-mmcu=#{MCU}",
'-Iinclude/', '-Iinclude/',
'-Wall', '-Wall',
'-Os', '-Os',
'-c' '-c'
], ],
:linker => 'avr-gcc', :linker => 'avr-gcc',
:linker_args => [ :linker_args => [
'-mmcu=atmega328p' "-mmcu=#{MCU}"
], ],
:objcopy => 'avr-objcopy' :objcopy => 'avr-objcopy'
} }
Expand Down Expand Up @@ -90,11 +93,11 @@ namespace :target do


desc "Program the Arduino over the serial port." desc "Program the Arduino over the serial port."
task :program => [:convert, :serial_port] do 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 end


desc "Make a backup hex image of the flash contents." desc "Make a backup hex image of the flash contents."
task :backup, [:backup_name] => :serial_port do |t, args| 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
end end

0 comments on commit 617adde

Please sign in to comment.