OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [examples/] [isrdemo/] [makefiles/] [make_example] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
include util.mak
2
 
3
CC=riscv64-unknown-elf-gcc
4
CPP=riscv64-unknown-elf-gcc
5
OBJDUMP=riscv64-unknown-elf-objdump
6
 
7
CFLAGS= -c -fPIC -g -O2
8
LDFLAGS=-static -T app.ld -nostartfiles
9
INCL_KEY=-I
10
DIR_KEY=-B
11
 
12
 
13
# include sub-folders list
14
INCL_PATH=\
15
        $(TOP_DIR)common \
16
        $(TOP_DIR)isrdemo/src
17
 
18
# source files directories list:
19
SRC_PATH = \
20
        $(TOP_DIR)isrdemo/src
21
 
22
LIB_NAMES = \
23
        gcc \
24
        stdc++ \
25
        c \
26
        m
27
 
28
VPATH = $(SRC_PATH)
29
 
30
SOURCES = \
31
        main \
32
        isr_example \
33
        helloworld
34
 
35
OBJ_FILES = $(addsuffix .o,$(SOURCES))
36
EXECUTABLE = isrdemo
37
DUMPFILE = $(EXECUTABLE).dump
38
HEXFILE = $(EXECUTABLE).hex
39
 
40
all: example
41
 
42
.PHONY: $(EXECUTABLE)
43
 
44
 
45
example: $(HEXFILE) $(EXECUTABLE) $(DUMPFILE)
46
 
47
$(HEXFILE): $(EXECUTABLE)
48
        echo elf2raw64 $(addprefix $(ELF_DIR)/,$<) -h -f 262144 -o $(addprefix $(ELF_DIR)/,$(EXECUTABLE).hex)
49
        elf2raw64 $(addprefix $(ELF_DIR)/,$<) -h -f 262144 -l 8 -o $(addprefix $(ELF_DIR)/,$(EXECUTABLE).hex)
50
 
51
$(EXECUTABLE): $(OBJ_FILES)
52
        echo $(CPP) $(LDFLAGS) $(addprefix $(OBJ_DIR)/,$(OBJ_FILES)) -o $(addprefix $(ELF_DIR)/,$@) $(addprefix -l,$(LIB_NAMES))
53
        $(CPP) $(LDFLAGS) $(addprefix $(OBJ_DIR)/,$(OBJ_FILES)) -o $(addprefix $(ELF_DIR)/,$@) $(addprefix -l,$(LIB_NAMES))
54
        $(ECHO) "\n  helloworld has been built successfully.\n"
55
 
56
$(DUMPFILE): $(EXECUTABLE)
57
        echo $(OBJDUMP) --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data $(addprefix $(ELF_DIR)/,$<) > $(addprefix $(ELF_DIR)/,$@)
58
        $(OBJDUMP) --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data $(addprefix $(ELF_DIR)/,$<) > $(addprefix $(ELF_DIR)/,$@)
59
 
60
%.o: %.cpp
61
        echo $(CPP) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
62
        $(CPP) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
63
 
64
%.o: %.c
65
        echo $(CC) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
66
        $(CC) $(CFLAGS) $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
67
 
68
%.o: %.S
69
        echo $(CC) $(CFLAGS) -D__ASSEMBLY__=1 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
70
        $(CC) $(CFLAGS) -D__ASSEMBLY__=1 $(addprefix $(INCL_KEY),$(INCL_PATH)) $< -o $(addprefix $(OBJ_DIR)/,$@)
71
 
72
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.