URL
https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk
Subversion Repositories riscv_vhdl
[/] [riscv_vhdl/] [trunk/] [examples/] [boot/] [makefiles/] [make_boot] - Rev 5
Compare with Previous | Blame | View Log
include util.mak
CC=riscv64-unknown-elf-gcc
CPP=riscv64-unknown-elf-gcc
OBJDUMP=riscv64-unknown-elf-objdump
FPU_ENABLED=0
CFLAGS= -c -g -static -std=gnu99 -O0 -fno-common -fno-builtin-printf
ifeq ($(FPU_ENABLED), 1)
CFLAGS += -march=RV64IMFD -DFPU_ENABLED
else
# CFLAGS += -march=RV64IMA
# CFLAGS += -msoft-float
endif
LDFLAGS=-T test.ld -nostdlib -nostartfiles
INCL_KEY=-I
DIR_KEY=-B
# include sub-folders list
INCL_PATH=\
$(TOP_DIR)../common \
$(TOP_DIR)src
# source files directories list:
SRC_PATH =\
$(TOP_DIR)src
LIB_NAMES =\
gcc \
c \
m
VPATH = $(SRC_PATH)
SOURCES = main \
trap \
crt
OBJ_FILES = $(addsuffix .o,$(SOURCES))
EXECUTABLE = bootimage
DUMPFILE = $(EXECUTABLE).dump
HEXFILE = $(EXECUTABLE).hex
LSTFILE = $(EXECUTABLE).lst
all: boot
.PHONY: $(EXECUTABLE) $(DUMPFILE)
boot: $(EXECUTABLE) $(DUMPFILE) $(HEXFILE)
$(HEXFILE): $(EXECUTABLE)
echo elf2raw64 $(addprefix $(ELF_DIR)/,$<) -h -f 8192 -l 8 -b 0x00000000 -o $(addprefix $(ELF_DIR)/,$(EXECUTABLE).hex)
elf2raw64 $(addprefix $(ELF_DIR)/,$<) -h -f 8192 -l 8 -b 0x00000000 -o $(addprefix $(ELF_DIR)/,$(EXECUTABLE).hex)
$(DUMPFILE): $(EXECUTABLE)
echo $(OBJDUMP) --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data $(addprefix $(ELF_DIR)/,$<) > $(addprefix $(ELF_DIR)/,$@)
$(OBJDUMP) --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data $(addprefix $(ELF_DIR)/,$<) > $(addprefix $(ELF_DIR)/,$@)
$(OBJDUMP) -S $(addprefix $(ELF_DIR)/,$<) > $(addprefix $(ELF_DIR)/,$(LSTFILE))
$(EXECUTABLE): $(OBJ_FILES)
echo $(CPP) $(LDFLAGS) $(addprefix $(OBJ_DIR)/,$(OBJ_FILES)) -o $(addprefix $(ELF_DIR)/,$@) $(addprefix -l,$(LIB_NAMES))
$(CPP) $(LDFLAGS) $(addprefix $(OBJ_DIR)/,$(OBJ_FILES)) -o $(addprefix $(ELF_DIR)/,$@) $(addprefix -l,$(LIB_NAMES))
$(ECHO) "\n Shared Library has been built successfully.\n"
#.cpp.o:
%.o: %.cpp
echo $(CPP) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
$(CPP) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
#.c.o:
%.o: %.c
echo $(CC) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
$(CC) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
%.o: %.S
echo $(CC) $(CFLAGS) -D__ASSEMBLY__=1 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
$(CC) $(CFLAGS) -D__ASSEMBLY__=1 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)