-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (34 loc) · 967 Bytes
/
Makefile
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
NIMFILE=src/main.nim
NIMDEPS:=
NIMDEPS += \
src/panicoverride.nim \
src/rcc_pll.nim \
src/stm32f3/rcc.nim \
src/stm32f3/memmap.nim \
src/stm32f3/ptr_macros.nim
PROJECT=nim_stm32
CFLAGS:=
CLIBS:=
CLIBDIRS:=
#
# Do not modify below this line.
#
OCM3_DIR := ./libopencm3
OCM3_LIB := opencm3_stm32f3
CLIBDIRS += -L$(OCM3_DIR)/lib
CLIBS += -l$(OCM3_LIB)
LD_SCRIPT := stm32f303vct6.ld
CFLAGS += -Wl,-gc-sections,-T,$(LD_SCRIPT)
CFLAGS += -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
.PHONY: clean all
all: $(PROJECT).bin
clean:
rm -rf nimcache
rm -f $(PROJECT).bin $(PROJECT).elf
$(PROJECT).elf: $(NIMFILE) $(NIMDEPS) $(OCM3_DIR)/lib/lib$(OCM3_LIB).a nim.cfg
nim c --nimcache=$(CURDIR)/nimcache $(NIMFILE)
arm-none-eabi-gcc $(CFLAGS) -o $@ nimcache/*.o $(CLIBDIRS) $(CLIBS)
$(OCM3_DIR)/lib/lib$(OCM3_LIB).a:
$(MAKE) -C $(OCM3_DIR)
%.bin: %.elf
arm-none-eabi-objcopy $< -O binary $@