aboutsummaryrefslogtreecommitdiff
path: root/debug_rom/Makefile
blob: 9d286c9dc74b61c36e3671cc66de6c6c048dd7b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Recursive make is bad, but in this case we're cross compiling which is a
# pretty unusual use case.

CC = $(RISCV)/bin/riscv64-unknown-elf-gcc
OBJCOPY = $(RISCV)/bin/riscv64-unknown-elf-objcopy

%.o:	%.S
	$(CC) -I.. -c $<

debug_rom.h:	debug_rom.raw
	xxd -i $^ | sed "s/^unsigned/static const unsigned/" > $@

debug_rom.raw:	debug_rom
	$(OBJCOPY) -O binary --only-section .text debug_rom debug_rom.raw

debug_rom:	debug_rom.o
	$(CC) -nostdlib -nostartfiles -Tlink.ld -o $@ $^

clean:
	rm -f debug_rom debug_rom.o debug_rom.raw debug_rom.h