URL
https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk
Subversion Repositories riscv_vhdl
[/] [riscv_vhdl/] [trunk/] [examples/] [bootarm/] [makefiles/] [make_boot] - Rev 5
Compare with Previous | Blame | View Log
include util.mak
CC=arm-none-eabi-gcc
CPP=arm-none-eabi-gcc
OBJDUMP=arm-none-eabi-objdump
CFLAGS= -c -g -static -std=gnu99 -O0 -fno-common -fno-builtin-printf -marm -mfloat-abi=soft -mcpu=cortex-r5
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 elf2raw32 $(addprefix $(ELF_DIR)/,$<) -h -f 8192 -l 8 -b 0x00000000 -o $(addprefix $(ELF_DIR)/,$(EXECUTABLE).hex)
elf2raw32 $(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)/,$@)