-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (26 loc) · 1.32 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
TINYGO=~/go/bin/tinygo
BM_DEV=/dev/ttyACM0
OUT=zeroconso.elf
SRC=zeroconso.go
#OUT=timers.elf
#SRC=timers.go
BOARD=bluepill
SPEED=9600
SPEED=115200
BM_TTY_GDB=$(shell grep -n "Black Magic GDB Server" /sys/class/tty/tty*/device/interface 2>&1 | cut -d/ -f5)
BM_TTY_USART=$(shell grep -n "Black Magic UART Port" /sys/class/tty/tty*/device/interface 2>&1 | cut -d/ -f5)
OPT=1
build:
${TINYGO} build -size=full -target=${BOARD} -opt=${OPT} -o ${OUT} ${SRC}
flash:
@echo "******** BM GDB TTY:"$(BM_TTY_GDB)"************"
arm-none-eabi-gdb -nx --batch -ex "target extended-remote /dev/$(BM_TTY_GDB)" -ex "monitor swdp_scan" -ex "attach 1" -ex load -ex compare-sections -ex kill $(OUT)
debug:
@echo "******** BM USART TTY:"$(BM_TTY_USART)"************"
arm-none-eabi-gdb -nx -ex "target extended-remote /dev/$(BM_TTY_GDB)" -ex "monitor swdp_scan" -ex "attach 1" -ex "set mem inaccessible-by-default off" -ex "file $(OUT)" -ex "load"
#arm-none-eabi-gdb -nx -ex "target extended-remote /dev/$(BM_TTY_GDB)" -ex "monitor swdp_scan" -ex "attach 1" -ex "set mem inaccessible-by-default off" -ex "file $(OUT)" -ex "load $(OUT)" -ex "compare-sections"
term:
@echo "******** BM USART TTY:"$(BM_TTY_USART)"************"
picocom -b $(SPEED) /dev/$(BM_TTY_USART) --imap lfcrlf
#all:
# tinygo build -target bluepill -o zeroconso.elf zeroconso.go