import os env = Environment( ENV = os.environ, CC = 'arm-none-eabi-gcc', CXX = 'arm-none-eabi-g++', AS = 'arm-none-eabi-gcc', CCFLAGS = '-O2 -Wall -ggdb -mcpu=cortex-m3 -mthumb -ffunction-sections', CXXFLAGS = '-fno-exceptions -fno-rtti', ASFLAGS = '-c -x assembler-with-cpp -mcpu=cortex-m3 -mthumb', #CPPDEFINES = [], LINK = 'arm-none-eabi-gcc', LINKFLAGS = '-Wall -mcpu=cortex-m3 -mthumb -Wl,-Tch.ld', # -Wl,--gc-sections AR = 'arm-none-eabi-ar', RANLIB = 'arm-none-eabi-ranlib', CPPPATH = ['.', 'chibios/os/kernel/include', 'chibios/os/ports/GCC/ARMCMx', 'chibios/os/ports/GCC/ARMCMx/STM32', 'chibios/os/hal/include', 'chibios/os/hal/platforms/STM32', ], #LIBPATH = [], LIBS = ['m'], ) sources = \ Glob('chibios/os/kernel/src/*.c') + \ ['chibios/os/ports/GCC/ARMCMx/' + i for i in ('STM32/vectors.c', 'chcore.c', 'chcore_v7m.c', 'nvic.c', 'crt0_v7m.s')] + \ Glob('chibios/os/hal/src/*.c') + \ Glob('chibios/os/hal/platforms/STM32/*.c') firmware = env.Program('suzumebachi.elf', Glob('*.cpp') + Glob('*.c') + sources) env.Depends(firmware, 'ch.ld') env.Command('prog', ['suzumebachi.elf'], 'openocd -f openocd.cfg -c flash_chip') Default('suzumebachi.elf')