1 |
2 |
csantifort |
# ----------------------------------------------------------------
|
2 |
|
|
# //
|
3 |
|
|
# Amber 2 core hardware test compilation Makefile //
|
4 |
|
|
# //
|
5 |
|
|
# This file is part of the Amber project //
|
6 |
|
|
# http://www.opencores.org/project,amber //
|
7 |
|
|
# //
|
8 |
|
|
# Description //
|
9 |
|
|
# Compiles a single hardware test and generates a .mem file //
|
10 |
|
|
# for use in Verilog simulations //
|
11 |
|
|
# //
|
12 |
|
|
# Author(s): //
|
13 |
|
|
# - Conor Santifort, csantifort.amber@gmail.com //
|
14 |
|
|
# //
|
15 |
|
|
#/ ///////////////////////////////////////////////////////////////
|
16 |
|
|
# //
|
17 |
|
|
# Copyright (C) 2010 Authors and OPENCORES.ORG //
|
18 |
|
|
# //
|
19 |
|
|
# This source file may be used and distributed without //
|
20 |
|
|
# restriction provided that this copyright statement is not //
|
21 |
|
|
# removed from the file and that any derivative work contains //
|
22 |
|
|
# the original copyright notice and the associated disclaimer. //
|
23 |
|
|
# //
|
24 |
|
|
# This source file is free software; you can redistribute it //
|
25 |
|
|
# and/or modify it under the terms of the GNU Lesser General //
|
26 |
|
|
# Public License as published by the Free Software Foundation; //
|
27 |
|
|
# either version 2.1 of the License, or (at your option) any //
|
28 |
|
|
# later version. //
|
29 |
|
|
# //
|
30 |
|
|
# This source is distributed in the hope that it will be //
|
31 |
|
|
# useful, but WITHOUT ANY WARRANTY; without even the implied //
|
32 |
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
|
33 |
|
|
# PURPOSE. See the GNU Lesser General Public License for more //
|
34 |
|
|
# details. //
|
35 |
|
|
# //
|
36 |
|
|
# You should have received a copy of the GNU Lesser General //
|
37 |
|
|
# Public License along with this source; if not, download it //
|
38 |
|
|
# from http://www.opencores.org/lgpl.shtml //
|
39 |
|
|
# //
|
40 |
|
|
# ----------------------------------------------------------------
|
41 |
|
|
|
42 |
|
|
# Assembly source files
|
43 |
|
|
DEP += ../../sw/include/amber_registers.h
|
44 |
|
|
|
45 |
|
|
TEST ?= add
|
46 |
|
|
AMBER_CROSSTOOL ?= amber-crosstool-not-defined
|
47 |
|
|
TOOLSPATH = ../../sw/tools
|
48 |
|
|
|
49 |
|
|
TGT = $(addsuffix .elf, $(basename $(TEST)))
|
50 |
|
|
MMP = $(addsuffix _memparams.v, $(basename $(TGT)))
|
51 |
|
|
SRC = $(addsuffix .S, $(basename $(TEST)))
|
52 |
|
|
MEM = $(addsuffix .mem, $(basename $(TGT)))
|
53 |
|
|
DIS = $(addsuffix .dis, $(basename $(TGT)))
|
54 |
|
|
OBJ = $(addsuffix .o, $(basename $(SRC)))
|
55 |
|
|
MAP = $(addsuffix .map, $(basename $(TGT)))
|
56 |
|
|
LDS = sections.lds
|
57 |
|
|
|
58 |
|
|
AS = $(AMBER_CROSSTOOL)-as
|
59 |
|
|
CC = $(AMBER_CROSSTOOL)-gcc
|
60 |
|
|
CXX = $(AMBER_CROSSTOOL)-g++
|
61 |
|
|
AR = $(AMBER_CROSSTOOL)-ar
|
62 |
|
|
LD = $(AMBER_CROSSTOOL)-ld
|
63 |
|
|
DS = $(AMBER_CROSSTOOL)-objdump
|
64 |
|
|
OC = $(AMBER_CROSSTOOL)-objcopy
|
65 |
|
|
ELF = ../../sw/tools/amber-elfsplitter
|
66 |
|
|
BMF = ../../sw/tools/amber-memparams.sh
|
67 |
|
|
|
68 |
|
|
ASFLAGS = -I../../sw/include
|
69 |
|
|
CFLAGS = -c -march=armv2a -mno-thumb-interwork -I../../sw/include
|
70 |
|
|
DSFLAGS = -C -S -EL
|
71 |
|
|
LDFLAGS = -Bstatic -Map $(MAP) --fix-v4bx
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
all: $(ELF) $(MMP) $(DIS)
|
75 |
|
|
|
76 |
|
|
$(MMP): $(MEM)
|
77 |
|
|
$(BMF) $(MEM) $(MMP)
|
78 |
|
|
|
79 |
|
|
$(MEM): $(TGT)
|
80 |
|
|
$(ELF) $(TGT) > $(MEM)
|
81 |
|
|
|
82 |
|
|
$(TGT): $(OBJ)
|
83 |
|
|
$(LD) $(LDFLAGS) -o $(TGT) -T $(LDS) $(OBJ)
|
84 |
|
|
|
85 |
|
|
$(OBJ): $(SRC) $(DEP)
|
86 |
|
|
$(CC) $(CFLAGS) -o $(OBJ) $(SRC)
|
87 |
|
|
|
88 |
|
|
$(DIS): $(TGT)
|
89 |
|
|
$(DS) $(DSFLAGS) $^ > $@
|
90 |
|
|
|
91 |
|
|
$(ELF):
|
92 |
|
|
$(MAKE) -C $(TOOLSPATH)
|
93 |
|
|
|
94 |
|
|
clean:
|
95 |
|
|
@rm -rfv *.o *.elf *.dis *.map *.mem *_memparams.v
|
96 |
|
|
|