-
Notifications
You must be signed in to change notification settings - Fork 508
/
Makefile
57 lines (50 loc) · 1.81 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
57
# general Makefile
# make OptLIB=0 OptSRC=0 all tshow
include Makefile.common
LDFLAGS=$(COMMONFLAGS) -fno-exceptions -ffunction-sections -fdata-sections -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-Tlinker.ld
LDLIBS+=-lstm32
LDLIBS+=-lm
STARTUP=startup.c
all: libs src
$(CC) -o $(PROGRAM).elf $(LDFLAGS) \
-Wl,--whole-archive \
src/app.a \
-Wl,--no-whole-archive \
$(LDLIBS)
$(OBJCOPY) -O ihex $(PROGRAM).elf $(PROGRAM).hex
$(OBJCOPY) -O binary $(PROGRAM).elf $(PROGRAM).bin
#Extract info contained in ELF to readable text-files:
arm-none-eabi-readelf -a $(PROGRAM).elf > $(PROGRAM).info_elf
arm-none-eabi-size -d -B -t $(PROGRAM).elf > $(PROGRAM).info_size
arm-none-eabi-objdump -S $(PROGRAM).elf > $(PROGRAM).info_code
arm-none-eabi-nm -t d -S --size-sort -s $(PROGRAM).elf > $(PROGRAM).info_symbol
.PHONY: libs src clean tshow
libs:
$(MAKE) -C libs $@
src:
$(MAKE) -C src $@
clean:
$(MAKE) -C src $@
$(MAKE) -C libs $@
rm -f $(PROGRAM).elf $(PROGRAM).hex $(PROGRAM).bin $(PROGRAM).info_elf $(PROGRAM).info_size
rm -f $(PROGRAM).info_code
rm -f $(PROGRAM).info_symbol
rm -f DUMP.s
tshow:
@echo "=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_"
@echo "=🍺====>> optimize settings: $(InfoTextLib), $(InfoTextSrc)"
@echo "=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_"
isp: /dev/cu.SLAB_USBtoUART main.bin
cat -u /dev/cu.SLAB_USBtoUART & stty -f /dev/cu.SLAB_USBtoUART 115200
echo '>' > /dev/cu.SLAB_USBtoUART
pkill cat -u /dev/cu.SLAB_USBtoUART
make flash || make flash
flash: /dev/cu.SLAB_USBtoUART main.bin
stm32flash -w $(TOP)/main.bin -v -g 0 /dev/tty.SLAB_USBtoUART
dump:
$(OBJDUMP) -D main.elf > DUMP.s
open DUMP.s
tty:
screen /dev/tty.SLAB_USBtoUART 115200
dfu:
dfu-util -d 0483:df11 -c 1 -a 0 -s 0x08000000:leave -D main.bin