User Tools

Site Tools


sconsarduino

This is an old revision of the document!


"""     SConstruct
#
#       Copyright 2008 Markus Burrer & CJT, cjt@users.sourceforge.net
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
"""
avr = Environment()
 
Target="main"
mcu="atmega128"
F_CPU=16e6
 
# Add all additional source files to compile
src=""" obj/utils.c
        obj/usart.c
        obj/usart1.c"""
 
# Add Source Path here
cpppath=""" .
            ../../EP-gcc-lib"""
 
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
opt = "s"
 
# Add Additional Compiler Flags
flags=""" """
 
# Add Variant Dirs
avr.VariantDir('obj', '../../EP-gcc-lib')
 
 
# Set Environment Parameters
avr['CC'] = "avr-gcc -mmcu=%s" % mcu
avr.Append(CPPPATH = Split(cpppath))
avr.Append(CCFLAGS = "-O%s" % opt)
avr.Append(CCFLAGS = "-Wall" )
avr.Append(CCFLAGS = "-DF_CPU=%i" % F_CPU)
avr.Append(CCFLAGS = Split(flags))
 
# Execute AVR-GCC
avr.Program(Target+".elf", Split(Target+".c " + src))
 
avr.Command(Target+".hex", Target+".elf", "avr-objcopy -j .text -j .data -O ihex $SOURCE $TARGET")
# Show memory usage
avr.Command(None, Target+".elf", "avr-size $SOURCE")

vim setting

  • copy arduino.vim under ~/.vim/syntax/
  • link pde extention to arduino syntax
au BufNewFile,BufRead *.pde setl ft=arduino

references

sconsarduino.1248347861.txt.gz · Last modified: 2013/08/03 05:04 (external edit)