diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-07-03 21:56:54 -0500 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-07-03 21:56:54 -0500 |
commit | 996111e3043da0f7c16bad7151b99a378f6fef48 (patch) | |
tree | ea0d22da315ed05a730e98e58e099d69347b8f0d /hexedit | |
parent | 51ba81648d2e63ac724989918ce5e9496fdf01da (diff) |
Improve makefiles
Diffstat (limited to 'hexedit')
-rw-r--r-- | hexedit/.gitignore | 1 | ||||
-rw-r--r-- | hexedit/Makefile | 52 |
2 files changed, 33 insertions, 20 deletions
diff --git a/hexedit/.gitignore b/hexedit/.gitignore new file mode 100644 index 0000000..ef90be6 --- /dev/null +++ b/hexedit/.gitignore @@ -0,0 +1 @@ +hexedit.oe diff --git a/hexedit/Makefile b/hexedit/Makefile index 01d5224..a42b16a 100644 --- a/hexedit/Makefile +++ b/hexedit/Makefile @@ -1,16 +1,8 @@ -PICO_UART=/dev/ttyUSB0 +PICO = /dev/disk/by-label/RPI-RP2 +PICO_CONSOLE = /dev/ttyUSB0 -all: build - -build: hexedit.uf2 - -dump: hexedit.bin - od hexedit.bin - -serial: hexedit.oe - [ -c PICO_UART ] && \ - (cat hexedit.oe | tr "\n" "\r" > PICO_UART ; echo -n "G" > PICO_UART) || \ - echo No serial device +.PHONY: build +build: hexedit.oe hexedit.oe: hexedit.bin od -An -v hexedit.bin | sed "s/^ //" | tr " " "\n" > hexedit.oe @@ -19,20 +11,40 @@ hexedit.bin: hexedit.o arm-none-eabi-ld -T pico_bin.ld -o hexedit.bin hexedit.o arm-none-eabi-objcopy -O binary hexedit.bin +objects = hexedit.o main.o + +$(objects): %.o: %.s + arm-none-eabi-as -o $@ $< + hexedit.uf2: hexedit.elf ../elf/elf2uf2 hexedit.elf hexedit.uf2 -objects = hexedit.o main.o - hexedit.elf: $(objects) arm-none-eabi-ld -T pico_ram_only.ld -o hexedit.elf $(objects) ../setup/setup.so -$(objects): %.o: %.s - arm-none-eabi-as -o $@ $< - +.PHONY: clean clean: rm -f hexedit.elf hexedit.uf2 hexedit.bin hexedit.oe *.o -flash: hexedit.uf2 - [ -h /dev/disk/by-label/RPI-RP2 ] || sleep 3s - cat hexedit.uf2 > /dev/disk/by-label/RPI-RP2 +.PHONY: dump +dump: hexedit.bin + @od hexedit.bin + +.PHONY: serial +serial: $(PICO_CONSOLE) hexedit.oe + cat hexedit.oe | tr "\n" "\r" > PICO_CONSOLE + echo -n "G" > PICO_CONSOLE + +$(PICO_CONSOLE): + @echo Serial device not found + @echo Connect USB cable from USB-UART bridge + @false + +.PHONY: flash +flash: $(PICO) hexedit.uf2 + cat hexedit.uf2 > $(PICO) + +$(PICO): + @echo "RPI-RP2 bootloader drive not found" + @echo Connect the pico with USB cable while holding bootsel button + @false |