2022-01-24 01:12:57 +00:00
|
|
|
|
|
|
|
PREFIX ?= arm-none-eabi-
|
|
|
|
CC = $(PREFIX)gcc
|
2022-01-29 01:26:40 +00:00
|
|
|
CFLAGS = -mcpu=cortex-a9 -I. -DZYNQ -Wall
|
2022-01-24 01:12:57 +00:00
|
|
|
LDFLAGS = -T zynq.ld -nostartfiles -nostdlib
|
|
|
|
GDB ?= $(PREFIX)gdb
|
|
|
|
PYTHON3 ?= python3
|
|
|
|
NC ?= nc
|
|
|
|
|
|
|
|
OPENOCD_HOST ?= 172.16.10.2
|
|
|
|
OPENOCD_PORT_GDB ?= 3333
|
|
|
|
OPENOCD_PORT_TELNET ?= 4444
|
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
all: zynq.elf
|
|
|
|
|
|
|
|
zynq.o: zynq.c
|
|
|
|
$(CC) $(CFLAGS) -c -o "$@" "$<"
|
|
|
|
|
|
|
|
zynq.elf: zynq.o
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^
|
|
|
|
|
2022-01-29 01:26:40 +00:00
|
|
|
jazelle.o: ../jazelle.c cache_cortexa.c zynq_printf.h
|
|
|
|
$(CC) $(CFLAGS) -c -o "$@" "$<"
|
|
|
|
|
2022-01-24 01:12:57 +00:00
|
|
|
openocd-load: zynq.elf
|
|
|
|
{ $(PYTHON3) ./elf2oocd.py "$<"; echo exit; } | $(NC) $(OPENOCD_HOST) $(OPENOCD_PORT_TELNET)
|
|
|
|
# printf 'halt\nload_image zynq.elf\nexit\n' \
|
|
|
|
# | nc $(OPENOCD_HOST) $(OPENOCD_PORT_TELNET)
|
|
|
|
|
|
|
|
gdb: zynq.elf
|
|
|
|
$(GDB) -ex 'target extended-remote $(OPENOCD_HOST):$(OPENOCD_PORT_GDB)' \
|
|
|
|
-ex 'set $$pc=_start' \
|
|
|
|
$(GDB_EXTRA_CMDS) \
|
|
|
|
zynq.elf
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@$(RM) -v zynq.o zynq.elf
|
|
|
|
|
|
|
|
.PHONY: gdb openocd-load all default clean
|