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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [Makefile.inc] - Blame information for rev 361

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 349 julius
######################################################################
2
####                                                              ####
3
#### Common makefile for inclusion by others                      ####
4
####                                                              ####
5
######################################################################
6
####                                                              ####
7
#### Copyright (C) 2010 Authors and OPENCORES.ORG                 ####
8
####                                                              ####
9
#### This source file may be used and distributed without         ####
10
#### restriction provided that this copyright statement is not    ####
11
#### removed from the file and that any derivative work contains  ####
12
#### the original copyright notice and the associated disclaimer. ####
13
####                                                              ####
14
#### This source file is free software; you can redistribute it   ####
15
#### and/or modify it under the terms of the GNU Lesser General   ####
16
#### Public License as published by the Free Software Foundation; ####
17
#### either version 2.1 of the License, or (at your option) any   ####
18
#### later version.                                               ####
19
####                                                              ####
20
#### This source is distributed in the hope that it will be       ####
21
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
22
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
23
#### PURPOSE.  See the GNU Lesser General Public License for more ####
24
#### details.                                                     ####
25
####                                                              ####
26
#### You should have received a copy of the GNU Lesser General    ####
27
#### Public License along with this source; if not, download it   ####
28
#### from http://www.opencores.org/lgpl.shtml                     ####
29
####                                                              ####
30
######################################################################
31
 
32 360 julius
DESIGN_NAME=orpsoc
33 349 julius
 
34
OR32_TOOL_PREFIX=or32-elf-
35
 
36
OR32_LD=$(OR32_TOOL_PREFIX)ld
37
OR32_AS=$(OR32_TOOL_PREFIX)as
38
OR32_CC=$(OR32_TOOL_PREFIX)gcc
39
OR32_AR=$(OR32_TOOL_PREFIX)ar
40
OR32_RANLIB=$(OR32_TOOL_PREFIX)ranlib
41
OR32_OBJDUMP=$(OR32_TOOL_PREFIX)objdump
42
OR32_OBJCOPY=$(OR32_TOOL_PREFIX)objcopy
43
 
44
VECTORS_OBJ ?=../support/crt0.o
45
SUPPORT_LIB ?=../support/$(DESIGN_NAME)_support.a
46
DESIGN_DEFINES_HEADER=../include/design-defines.h
47
SUPPORT_FILES ?=$(SUPPORT_LIB)
48
 
49
# Machine flags - uncomment one or create custom combination of flags
50
# All software div, mul and FPU
51
#MACH_FLAGS ?=-msoft-mul -msoft-div -msoft-float
52
# FPGA default - only hardware multiply
53
#MACH_FLAGS ?=-mhard-mul -msoft-div -msoft-float
54
# All hardware flags
55
#MARCH_FLAGS ?=-mhard-mul -mhard-div -mhard-float
56
# Hardware integer arith, soft float
57
MARCH_FLAGS ?=-mhard-mul -mhard-div -msoft-float
58
 
59
 
60
OR32_CFLAGS ?=-g -nostdlib -O2 -I../include $(MARCH_FLAGS)
61
OR32_LDFLAGS ?=-lgcc -T../support/or32.ld -e 256
62
 
63
# This path must be correct!
64 360 julius
DESIGN_VERILOG_DEFINES=../../rtl/verilog/include/$(DESIGN_NAME)-defines.v
65
DESIGN_PROCESSED_VERILOG_DEFINES=../include/$(DESIGN_NAME)-defines.h
66 349 julius
 
67 360 julius
OR1200_VERILOG_DEFINES=../../rtl/verilog/include/or1200_defines.v
68 349 julius
OR1200_PROCESSED_VERILOG_DEFINES=../include/or1200-defines.h
69
 
70 361 julius
PROCESSED_DEFINES=$(DESIGN_PROCESSED_VERILOG_DEFINES) $(OR1200_PROCESSED_VERILOG_DEFINES)
71 349 julius
 
72 361 julius
 
73 349 julius
ELF_DEPENDS+=$(VECTORS_OBJ) $(PROCESSED_DEFINES) $(SUPPORT_FILES)
74
 
75
# Set V=1 when calling make to enable verbose output
76
# mainly for debugging purposes.
77
ifeq ($(V), 1)
78
Q=
79
else
80
Q ?=@
81
endif
82
 
83
# Our local utilities
84
UTILS_BIN2HEX=../utils/bin2hex
85
$(UTILS_BIN2HEX):
86
        $(Q)$(MAKE) -C ../utils bin2hex
87
 
88
UTILS_BIN2VMEM=../utils/bin2vmem
89
$(UTILS_BIN2VMEM):
90
        $(Q)$(MAKE) -C ../utils bin2vmem
91
 
92
 
93
# Rule to generate C header file from Verilog file with `defines in it
94
$(DESIGN_PROCESSED_VERILOG_DEFINES): $(DESIGN_VERILOG_DEFINES)
95
        $(Q)echo; echo "\t### Creating software defines header from verilog defines ###";
96
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
97
        $(Q)echo "#ifndef _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
98
        $(Q)echo "#define _"$(DESIGN_NAME)"_DEFINES_H_" >> ../include/$@
99
        $(Q)cat $< | sed s://.*::g | sed 's/'\`'/'#'/g' >> ../include/$@
100
        $(Q)echo "#endif" >> ../include/$@
101
        $(Q)echo; echo >> ../include/$@
102
 
103
# This works (doesn't error), but for now we have to remove all of the numbers
104
# in verilog format, eg. 8'b0010_0000 or 32'h0000_0f00, or 32'd256 etc. as it's
105
# not so straight forward to convert these
106
$(OR1200_PROCESSED_VERILOG_DEFINES): $(OR1200_VERILOG_DEFINES)
107
        $(Q)echo; echo "\t### Creating OR1200 software defines header from verilog defines ###";
108
        $(Q)echo "//This file is autogenerated from "$<" do not change!" > ../include/$@
109
        $(Q)echo "#ifndef _OR1200_DEFINES_H_" >> ../include/$@
110
        $(Q)echo "#define _OR1200_DEFINES_H_" >> ../include/$@
111
        $(Q)cat $< | sed s://.*::g | grep -v \'[dhb] | sed 's/'\`'/'#'/g' >> ../include/$@
112
        $(Q)echo "#endif" >> ../include/$@
113
        $(Q)echo; echo >> ../include/$@
114
 
115
# Default make
116
%.flashin: %.bin $(UTILS_BIN2HEX)
117
        $(Q)$(UTILS_BIN2HEX) $< 1  -size_word > $@
118
 
119
%.vmem: %.bin $(UTILS_BIN2VMEM)
120
        $(Q)$(UTILS_BIN2VMEM) $< > $@
121
 
122
%.elf: %.c $(ELF_DEPENDS)
123
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
124
 
125
%.elf: %.S $(ELF_DEPENDS)
126
        $(Q)$(OR32_CC) $^ $(OR32_CFLAGS) $(OR32_LDFLAGS) -o $@
127
 
128
%.o: %.S
129
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
130
 
131
%.o: %.c
132
        $(Q)$(OR32_CC) $(OR32_CFLAGS) -c $< -o $@
133
 
134
# Recompile the support lib if we detect any of the drivers having changed
135
SUPPORT_LIB_SRCS=$(shell ls ../support/*.[cS])
136
SUPPORT_LIB_SRCS +=$(shell ls ../include/*.h)
137
 
138
$(SUPPORT_LIB): $(SUPPORT_LIB_SRCS)
139
        $(Q)echo; echo "\t### Building software support library ###"; echo
140
        $(Q)$(MAKE) -C ../support $(DESIGN_NAME)_support.a
141
 
142
$(VECTORS_OBJ):
143
        $(Q)$(MAKE) -C ../support crt0.o
144
 
145
# This relies on the local clean rule of each makefile
146
clean-all: distclean
147
 
148
clean-support:
149
        $(Q)$(MAKE) -C ../support clean
150
 
151
# List of software directories, exclude include/
152
SWDIRS=$(shell ls ../ | grep -v include)
153
 
154
distclean:
155
        $(Q)for dir in $(SWDIRS); do if [ -d ../$$dir ]; then $(MAKE) -C ../$$dir clean; fi; done
156
        $(Q)rm -f $(PROCESSED_DEFINES)

powered by: WebSVN 2.1.0

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