-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (40 loc) · 1.33 KB
/
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
51
52
53
54
55
56
# SPDX-License-Identifier: MIT
# Copyright (c) 2017 Andrea Loi
# Copyright (c) 2018 Aleksey Makarov
CROSS_COMPILE = arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJDUMP = $(CROSS_COMPILE)objdump
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
GDB = $(CROSS_COMPILE)gdb
AR = $(CROSS_COMPILE)ar
MCPU = -mcpu=cortex-m3 -mthumb -mabi=aapcs
CFLAGS = $(MCPU) -O0 -ggdb -ffreestanding -Wall -Wextra -I./libbsd
LDFLAGS = $(MCPU) -ggdb -static -nostdlib -TSTM32F103C8.ld -L.
LDLIBS = -lgcc -lstm
# tests (programs)
ELFS = test01_uart_putc test02_uart_inout test03_stdio test04_i2c test05_blink \
test06_dwt test07_oled test08_3dcube test09_font test11_am2301
BINS = $(addsuffix .bin, $(ELFS))
.PHONY: all clean
all: $(BINS)
include ./libbsd/Makefile.libbsd
LIBBSD_OBJS_P=$(addprefix ./libbsd/, $(LIBBSD_OBJS))
include ./liboled/Makefile.liboled
LIBOLED_OBJS_P=$(addprefix ./liboled/, $(LIBOLED_OBJS))
# functions that may be shared between tests
libstm.a: $(LIBBSD_OBJS_P) $(LIBOLED_OBJS_P) \
init.o rcc.o gpio.o uart.o dwt.o i2c.o am2301.o
$(AR) rcs $@ $^
$(ELFS) : libstm.a
%.bin: %
$(OBJCOPY) -O binary $< $@
%.lst: %
$(OBJDUMP) -x -S $< > $@
%.dis: %
$(OBJDUMP) -D $< > $@
%.size: %
$(SIZE) $< > $@
clean:
$(RM) -f *.o *.a *.bin *.size *.dis *.lst $(ELFS) ./liboled/*.o ./libbsd/*.o