42 lines
948 B
Makefile
42 lines
948 B
Makefile
|
|
PREFIX ?= arm-none-eabi-
|
|
CC = $(PREFIX)gcc
|
|
CFLAGS = -mcpu=cortex-a9 -I. -DZYNQ -Wall
|
|
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 "$@" $^
|
|
|
|
jazelle.o: ../jazelle.c cache_cortexa.c zynq_printf.h
|
|
$(CC) $(CFLAGS) -c -o "$@" "$<"
|
|
|
|
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
|