2022-01-28 22:58:46 +00:00
|
|
|
|
|
|
|
OPENOCD_HOST ?= localhost
|
|
|
|
OPENOCD_PORT_GDB ?= 3333
|
|
|
|
OPENOCD_PORT_TELNET ?= 4444
|
|
|
|
PREFIX ?= arm-none-eabi-
|
|
|
|
|
|
|
|
CC = $(PREFIX)gcc
|
2022-01-29 01:26:40 +00:00
|
|
|
CFLAGS = -mcpu=arm1176jzf-s -Wall
|
2022-01-28 22:58:46 +00:00
|
|
|
LDFLAGS = -T rpi.ld -nostartfiles -nostdlib
|
|
|
|
GDB ?= $(PREFIX)gdb
|
|
|
|
PYTHON3 ?= python3
|
|
|
|
NC ?= nc
|
|
|
|
|
2022-01-29 02:24:18 +00:00
|
|
|
LNXPREFIX ?= arm-linux-gnueabihf-
|
|
|
|
LNXCC = $(LNXPREFIX)gcc
|
|
|
|
|
2022-01-28 22:58:46 +00:00
|
|
|
default: all
|
|
|
|
|
|
|
|
all: rpi.elf
|
|
|
|
|
|
|
|
rpi.o: rpi.c
|
|
|
|
$(CC) $(CFLAGS) -c -o "$@" "$<"
|
|
|
|
|
|
|
|
rpi.elf: rpi.o
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^
|
|
|
|
|
2022-01-29 01:26:40 +00:00
|
|
|
#jazelle.S: ../jazelle.c
|
|
|
|
# $(CC) $(CFLAGS) -S -o "$@" "$<"
|
|
|
|
|
|
|
|
jazelle.o: ../jazelle.c
|
|
|
|
$(CC) $(CFLAGS) -c -o "$@" "$<"
|
|
|
|
|
2022-01-29 02:24:18 +00:00
|
|
|
jazlinux: linux.c ../jazelle.c
|
|
|
|
$(LNXCC) $(CLFAGS) -o "$@" $^
|
|
|
|
|
2022-01-28 22:58:46 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
.PHONY: all clean openocd-launch openocd-load gdb
|