-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (51 loc) · 1.77 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.PHONY: all clean
PLATFORM?=PAPRO
ARCH=rv32im
ABI=ilp32
DEBUGFLAG?=NODEBUG
UPLOAD_DIR?=~/upload
TARGET_PREFIX ?= riscv32-unknown-elf
TARGET_CC := $(TARGET_PREFIX)-gcc
TARGET_LD := $(TARGET_PREFIX)-gcc
TARGET_SIZE := $(TARGET_PREFIX)-size
TARGET_OBJCOPY := $(TARGET_PREFIX)-objcopy
HEXDUMP ?= hexdump
DATA2MEM = /opt/Xilinx/14.7/ISE_DS/ISE/bin/lin64/data2mem
PROJROOT = ../../..
TOPLEVEL = ~/riscv/ise/bonfire/papilio_pro_dram_toplevel.bit
PLATFORMDIR=../platform
#LINKDEF?=wildfboot.ld
LINKDEF_DRAM=bonfire_dram.ld
LINKDEF?=$(PLATFORMDIR)/$(PLATFORM)/firmware.ld
BOOTLINK=wildfboot.ld
TARGET_CFLAGS += -march=$(ARCH) -mabi=$(ABI) -Wall -Og -g -fomit-frame-pointer -fno-inline-functions-called-once \
-ffreestanding -fno-builtin -mstrict-align \
-Wall -Werror=implicit-function-declaration \
-DBONFIRE -D$(PLATFORM) -D$(DEBUGFLAG) -I$(PLATFORMDIR) -I$(PLATFORMDIR)/$(PLATFORM) -I../riscv
TARGET_LDFLAGS_SYSCALL += -march=$(ARCH) -mabi=$(ABI) \
-Wl,--gc-sections -Wl,-T$(LINKDEF_DRAM)
OBJECTS = gdb_traps.o console.o debug_test.o trap.o
include Makefile.include
all: gdbtest.bin
clean:
rm *.o
rm *.bin
rm *.lst
%.o : %.S
$(TARGET_CC) $(TARGET_CFLAGS) -c $<
%.o : %.c
$(TARGET_CC) $(TARGET_CFLAGS) -c $<
%.bin : %.elf
$(TARGET_OBJCOPY) -S -O binary $< $@
cp $@ $(UPLOAD_DIR)
$(TARGET_PREFIX)-objdump -S -d $< >$(basename $@).lst
$(TARGET_PREFIX)-objdump -s $< >$(basename $@).dmp
$(TARGET_PREFIX)-size $<
%.hex : %.elf
$(TARGET_OBJCOPY) -S -O $< $(basename $@).bin
$(HEXDUMP) -v -e '1/4 "%08x\n"' $(basename $@).bin >$@
$(TARGET_PREFIX)-objdump -S -d $< >$(basename $@).lst
$(TARGET_PREFIX)-objdump -s $< >$(basename $@).dmp
$(TARGET_PREFIX)-size $<
gdbtest.elf : $(OBJECTS)
$(TARGET_LD) -o $@ $(TARGET_LDFLAGS_SYSCALL) $(OBJECTS) -lg -lm -lgloss