aboutsummaryrefslogtreecommitdiff
path: root/hexedit/Makefile
blob: d1cfa5be38fef882827c2b2c5c0ee97b9946f96a (plain)
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
PICO = /dev/disk/by-label/RPI-RP2
DEVICE = /dev/ttyUSB0

.PHONY: build
build: hexedit.oe

hexedit.oe: hexedit.bin
	od -An -v hexedit.bin | sed "s/^ //" | tr " " "\n" > hexedit.oe

hexedit.bin: hexedit.elf
	arm-none-eabi-objcopy -O binary hexedit.elf hexedit.bin

hexedit.elf: pico_bin.ld hexedit.o
	arm-none-eabi-ld -T pico_bin.ld -o hexedit.elf hexedit.o

hexedit.o: hexedit.s
	arm-none-eabi-as -o hexedit.o hexedit.s

.PHONY: clean
clean:
	rm -f hexedit.elf hexedit.bin hexedit.oe hexedit.o slowcat

.PHONY: dump
dump: hexedit.bin
	@od hexedit.bin

.PHONY: serial
serial: $(DEVICE) hexedit.oe slowcat
	cat hexedit.oe | tr "\n" "\r" | ./slowcat | picocom -b 115200 -q $(DEVICE)
	@echo
	echo -n "G" | picocom -b 115200 -q $(DEVICE)
	@echo

$(DEVICE):
	@echo Serial device not found
	@echo Connect USB cable from USB-UART bridge
	@false