-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 1.56 KB
/
Makefile
File metadata and controls
60 lines (47 loc) · 1.56 KB
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
57
58
59
60
TARGET=tempsensor
# Standard arm development tools
CC=arm-none-eabi-gcc
LD=arm-none-eabi-gcc
AR=arm-none-eabi-ar
AS=arm-none-eabi-as
CP=arm-none-eabi-objcopy
OD=arm-none-eabi-objdump
SE=arm-none-eabi-size
SF=st-flash
# This needs to point to the roof of your libopencm3 installation
LIBOPENPCMROOT = /home/euler357/libopencm3
CFLAGS = -std=gnu99 -g -O2 -Wall
CFLAGS += -mlittle-endian -mthumb -mthumb-interwork -mcpu=cortex-m3
CFLAGS += -fsingle-precision-constant -Wdouble-promotion
CFLAGS += -I$(LIBOPENPCMROOT)/include -c -DSTM32F1
LDFLAGS = --static -nostartfiles -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wl,-Map=tempsensor.map
LDFLAGS += -Wl,--gc-sections -specs=nosys.specs -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
LDFLAGS += -T./stm32f103c8t6.ld -L../libopencm3/lib
default: $(TARGET).bin
$(TARGET).bin: $(TARGET).elf
@echo '***************************'
@echo '*** Making Bin from Elf ***'
@echo '***************************'
$(CP) -O binary $^ $@
@echo
$(TARGET).o: $(TARGET).c
@echo '*****************'
@echo '*** Compiling ***'
@echo '*****************'
$(CC) $(INCLUDE) $(CFLAGS) $^ -o $@
$(TARGET).elf: $(TARGET).o
@echo '***************'
@echo '*** Linking ***'
@echo '***************'
$(LD) $(LDFLAGS) $^ -lopencm3_stm32f1 -o $@
fresh: clean default
clean:
@echo '****************'
@echo '*** Cleaning ***'
@echo '****************'
rm -f *.o *.elf *.bin *.map
flash: default
@echo '************************'
@echo '*** Burning to Flash ***'
@echo '************************'
$(SF) write $(TARGET).bin 0x8000000