Rev 6 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
# Create and initialize the environment.
env = Environment()
# Set environment for AVR-GCC.
env['CC'] = 'avr-gcc'
env['CPPPATH'] = '/usr/lib/avr/include'
env['OBJCOPY'] = 'avr-objcopy'
env['SIZE'] = 'avr-size'
env['AR'] = 'avr-ar'
env['RANLIB'] = 'avr-ranlib'
env.Append(CCFLAGS = '-Os')
# Declare some variables about microcontroller.
# Microcontroller type.
DEVICE = 'atmega328p'
# Microcontroller frequency.
CPU_FREQUENCY = '16000000UL' # Hz
# Set environment for an Atmel AVR ATmega328p microcontroller.
env.Append(CCFLAGS = '-mmcu=' + DEVICE)
env.Append(LINKFLAGS = '-mmcu=' + DEVICE)
env.Append(CPPDEFINES = 'F_CPU=' + CPU_FREQUENCY)
# Append CPPPATH.
env.Append(CPPPATH = [ '#../' ])
# Build library.
SConscript(
'src/SConscript',
variant_dir = '#build/lib/',
exports = { 'env_target' : env, 'env_name' : 'env_arduino_uno', 'DEVICE' : DEVICE },
duplicate = 0
)
# Append LIBPATH and LIBS.
env.Append(LIBPATH = [ '#build/lib/'])
env.Append(LIBS = [ 'digital_io' ])
# Build demonstration program.
SConscript(
'demo/SConscript',
variant_dir = '#build/demo/',
exports = { 'env_target' : env, 'env_name' : 'env_arduino_uno', 'DEVICE' : DEVICE },
duplicate = 0
)
# Build test program.
SConscript(
'test/SConscript',
variant_dir = '#build/test/',
exports = { 'env_target' : env, 'env_name' : 'env_arduino_uno', 'DEVICE' : DEVICE },
duplicate = 0
)