OPENOCD_HOST ?= localhost OPENOCD_PORT_GDB ?= 3333 OPENOCD_PORT_TELNET ?= 4444 PREFIX ?= arm-none-eabi- CC = $(PREFIX)gcc CFLAGS = -mcpu=arm1176jzf-s -Wall -O2 LDFLAGS = -T rpi.ld -nostartfiles -Wl,-Map=rpi.map -Wl,--cref GDB ?= $(PREFIX)gdb PYTHON3 ?= python3 NC ?= nc default: all all: rpi.elf rpi.img rpi.o: rpi.c $(CC) $(CFLAGS) -c -o "$@" "$<" vectors.o: vectors.s $(CC) -mcpu=arm1176jzf-s -c -o "$@" "$<" #jazelle.S: ../jazelle.c # $(CC) $(CFLAGS) -S -o "$@" "$<" jazelle.o: ../jazelle.c $(CC) $(CFLAGS) -c -o "$@" "$<" nl-glue.o: nl-glue.c $(CC) $(CFLAGS) -c -o "$@" "$<" rpi.elf: rpi.o vectors.o nl-glue.o jazelle.o $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ rpi.img: rpi.elf $(PREFIX)objcopy -O binary "$<" "$@" openocd-launch: openocd -f interface/cmsis-dap.cfg -c "transport select jtag" \ -c "adapter speed 50" -f target/bcm2835.cfg \ -c init -c scan_chain openocd-load: rpi.elf printf 'halt\nload_image rpi.elf\nexit\n' \ | nc $(OPENOCD_HOST) $(OPENOCD_PORT_TELNET) gdb: $(GDB) -ex 'target extended-remote $(OPENOCD_HOST):$(OPENOCD_PORT_GDB)' \ -ex 'set $$pc=_start' \ $(GDB_EXTRA_CMDS) \ rpi.elf clean: @$(RM) -v rpi.o rpi.elf vectors.o jazelle.o nl-glue.o rpi.img .PHONY: all clean openocd-launch openocd-load gdb