Commits

Steven Osborn committed a8e10b8

clean up code a little and add upload command to scons

  • Participants
  • Parent commits 066cfa5

Comments (0)

Files changed (2)

 from os.path import dirname
 
 f_cpu='16000000L'
-mcu='atmega8u2'
+mcu='at90usb82'
 
 if (os.environ.has_key('AVR_TOOLS_PATH')):
     avr_tools_path = os.environ['AVR_TOOLS_PATH']
 
 env.Append(BUILDERS={'Elf':Builder(action=avr_tools_path+"/avr-gcc -mmcu="+mcu+" -Wl,-Map=${TARGET}.map -Os -Wl,--gc-sections -o $TARGET $SOURCES")})
 env.Append(BUILDERS={'Hex':Builder(action=avr_tools_path+"/avr-objcopy -O ihex -R .eeprom $SOURCES $TARGET")})
-env.Elf(elf_name, objs) 
-env.Hex(hex_name, elf_name)
+elfprog = env.Elf(elf_name, objs) 
+hexprog = env.Hex(hex_name, elf_name)
+env.Depends(hexprog, elfprog)
+
+dfu_programmer = "/usr/local/dfu-programmer/bin/dfu-programmer"
+
+dfu_command = " ".join([dfu_programmer, mcu, "flash", hex_name])
+upload_alias = env.Alias('upload', hex_name, dfu_command)
+AlwaysBuild(upload_alias)
+env.Depends(upload_alias, elfprog)