Пример #1
0
import time
import glob

# define controller and clockspeed
mcu='atmega328'
f_cpu=8000000

# sourcefolder
sources = glob.glob('./source/*.c')
headerlocation = './header'

# compile the project
cc = AvrGcc(mcu = mcu)
cc.f_cpu = f_cpu
cc.options_extra = ['-I%s'%headerlocation,
                    '-uvfprintf',
                    '-lprintf_flt', '-lm', '-DF_CPU=%d'%f_cpu]

print '-------------------------------------------------------------------'
print  'compiler version:', cc.version()
print '-------------------------------------------------------------------'
print 'Project targets'
for source in sources:
    print '  '+source
print '-------------------------------------------------------------------'
print cc.command_list(sources)
error = False
try:
    cc.build(sources = sources)

except: