1 |
2 |
ja_rd |
#-------------------------------------------------------------------------------
|
2 |
|
|
# This makefile does not contain any targets, only definitions used by the
|
3 |
|
|
# makefiles of all the code samples.
|
4 |
|
|
# It is meant to be included and not used standalone.
|
5 |
|
|
#-------------------------------------------------------------------------------
|
6 |
|
|
# KNOWN PROBLEMS AND WORKAROUNDS
|
7 |
|
|
#
|
8 |
|
|
# 1.- LINK PROBLEM IF FLAG '-G0' NOT USED
|
9 |
|
|
# If flag '-G0' is not used on gcc, linker fails with 'relocation
|
10 |
|
|
# truncated to fit: R_MIPS_GPREL16' error message.
|
11 |
|
|
# This only happens when you use global or static veriables, initialized
|
12 |
|
|
# or not.
|
13 |
|
|
# (See explaination in the project docs about $gp indexed addressing in
|
14 |
|
|
# MIPS architectures and the -G0 flag).
|
15 |
|
|
#
|
16 |
|
|
# SUSPECTED CAUSE:
|
17 |
|
|
# I'm sure there is something wrong with my linker script.
|
18 |
|
|
# With the default link scripts this does not happen. Yet we need to use
|
19 |
|
|
# a script so that we can split code and data (including read-only) to
|
20 |
|
|
# different sections (and later to different ram blocks).
|
21 |
|
|
#
|
22 |
|
|
# WORKAROUND:
|
23 |
|
|
# Use -G0 flag so that _gp indexing is disabled. There is a performance
|
24 |
|
|
# hit, though. In effect we're telling the compiler to NOT use $gp for
|
25 |
|
|
# indexed access to any global variables.
|
26 |
|
|
# This is only necessary for the 'bare' target (no external ram and no
|
27 |
|
|
# cache) and will have to be fixed for regular targets (by using a
|
28 |
|
|
# standard link script or fixing mine).
|
29 |
|
|
#-------------------------------------------------------------------------------
|
30 |
|
|
# SYSTEM PARAMETERS
|
31 |
|
|
#
|
32 |
|
|
# All you can define here is the size of the VHDL RAM tables.
|
33 |
|
|
# Some other system parameters are defined in the linker script (ion*.lds).
|
34 |
|
|
#-------------------------------------------------------------------------------
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
### Toolchain config ###########################################################
|
38 |
|
|
|
39 |
|
|
ifeq ($(LANG),)
|
40 |
|
|
#**** Customize for Windows/Cygwin
|
41 |
|
|
|
42 |
|
|
# Some common file commands (Cygwin/sh version, use your own)
|
43 |
|
|
CP = cp
|
44 |
|
|
RM = RM
|
45 |
|
|
DWIN32 = -DWIN32
|
46 |
|
|
LINUX_PWD =
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
# MIPS GCC cross-toolchain: CodeSourcery -- replace with your own
|
50 |
|
|
|
51 |
|
|
BIN_MIPS = C:/desarrollo/SourceryGpp/bin
|
52 |
|
|
GCC_MIPS = $(BIN_MIPS)/mips-sde-elf-gcc.exe $(CFLAGS)
|
53 |
|
|
AS_MIPS = $(BIN_MIPS)/mips-sde-elf-as
|
54 |
|
|
LD_MIPS = $(BIN_MIPS)/mips-sde-elf-ld
|
55 |
|
|
DUMP_MIPS = $(BIN_MIPS)/mips-sde-elf-objdump
|
56 |
|
|
COPY_MIPS = $(BIN_MIPS)/mips-sde-elf-objcopy
|
57 |
|
|
TO_VHDL = python ../bin2hdl.py
|
58 |
|
|
|
59 |
|
|
else
|
60 |
|
|
#**** Customize for Linux
|
61 |
|
|
|
62 |
|
|
# MIPS GCC cross-toolchain: BuildRoot toolchain in my home directory -- replace with your own
|
63 |
|
|
# NOTE: we will not use gcc builtin functions or libc
|
64 |
|
|
|
65 |
|
|
BIN_MIPS = /home/jaruiz/desarrollo/uClinux/MIPS/buildroot/buildroot-2010.11/output/staging/usr/bin
|
66 |
|
|
GCC_MIPS = $(BIN_MIPS)/mips-unknown-linux-uclibc-gcc $(CFLAGS)
|
67 |
|
|
AS_MIPS = $(BIN_MIPS)/mips-unknown-linux-uclibc-as
|
68 |
|
|
LD_MIPS = $(BIN_MIPS)/mips-unknown-linux-uclibc-ld
|
69 |
|
|
DUMP_MIPS = $(BIN_MIPS)/mips-unknown-linux-uclibc-objdump
|
70 |
|
|
COPY_MIPS = $(BIN_MIPS)/mips-unknown-linux-uclibc-objcopy
|
71 |
|
|
TO_VHDL = python ../bin2hdl.py
|
72 |
|
|
|
73 |
|
|
endif
|
74 |
|
|
|
75 |
|
|
### System parameters ##########################################################
|
76 |
|
|
|
77 |
|
|
# Default size of code BRAM in 32-bit words
|
78 |
|
|
CODE_SIZE = 1024
|
79 |
|
|
# Default size of data BRAM in 32-bit words
|
80 |
|
|
DATA_SIZE = 256
|
81 |
|
|
|
82 |
|
|
### Build options ##############################################################
|
83 |
|
|
|
84 |
|
|
# Don't use gcc builtin functions, and try to target MIPS-I architecture
|
85 |
|
|
# (See comment above about -G0 flag)
|
86 |
|
|
CFLAGS = -O2 -Wall -c -s -fno-builtin -mips1 -G0
|
87 |
|
|
# Use project 'bare cpu' linker script and build elf-bigendian object file
|
88 |
|
|
LFLAGS = -T../ion_noxram.lds -I elf32-big -eentry
|
89 |
|
|
# Pass BRAM sizes to VHDL conversion script
|
90 |
|
|
VHDL_FLAGS = --code_size $(CODE_SIZE) --data_size $(DATA_SIZE)
|
91 |
|
|
|
92 |
|
|
### Project directories ########################################################
|
93 |
|
|
|
94 |
|
|
# VHDL test bench directory, where VHDL output files will be created
|
95 |
|
|
TB_DIR = ../../vhdl/tb
|
96 |
|
|
# VHDL DE-1 board demo root directory, for vhdl output
|
97 |
|
|
DEMO_DIR = ../../vhdl/demo
|
98 |
|
|
# Root test code source directory, where python script and vhdl templates are
|
99 |
|
|
SRC_DIR = ..
|