summaryrefslogtreecommitdiff
path: root/SConstruct
blob: 133ec8f9630a0c914821ecf91fc4e366c21d1f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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-m4 -mthumb -mhard-float -ffunction-sections -Wno-pmf-conversions',
	CXXFLAGS = '-fno-exceptions -fno-rtti',
	ASFLAGS = '-c -x assembler-with-cpp -mcpu=cortex-m4 -mthumb -mhard-float',
	
	#CPPDEFINES = [],
	
	LINK = 'arm-none-eabi-gcc',
	LINKFLAGS = '-Wall -mcpu=cortex-m4 -mthumb -mhard-float -nostartfiles -Wl,-Tsuzumebachi.ld', # -Wl,--gc-sections
	
	AR = 'arm-none-eabi-ar',
	RANLIB = 'arm-none-eabi-ranlib',
	
	CPPPATH = ['os', 'hal', 'drivers'],
	#LIBPATH = [],
	
	LIBS = ['m'],
)

sources = Glob('os/*.cpp') + Glob('hal/*.cpp') + Glob('drivers/*.cpp') + Glob('*.cpp')

firmware = env.Program('suzumebachi.elf', sources)
env.Depends(firmware, 'suzumebachi.ld')

env.Command('prog', ['suzumebachi.elf'], 'openocd -f openocd.cfg -c flash_chip')

Default('suzumebachi.elf')