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

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [hello/] [makefile] - Blame information for rev 182

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

Line No. Rev Author Line
1 176 ja_rd
#-- Set up the toolchain -------------------------------------------------------
2 2 ja_rd
 
3 176 ja_rd
BIN_MIPS = C:/dev/embedded/SourceryGpp/mips-elf-11-03.52/bin
4
CC = $(BIN_MIPS)/mips-sde-elf-gcc.exe $(CFLAGS)
5
AS = $(BIN_MIPS)/mips-sde-elf-as
6
LD = $(BIN_MIPS)/mips-sde-elf-ld
7
DUMP = $(BIN_MIPS)/mips-sde-elf-objdump
8
COPY = $(BIN_MIPS)/mips-sde-elf-objcopy
9
TO_VHDL   = python ../bin2hdl.py
10
 
11
 
12
#-- Set up the code structure --------------------------------------------------
13
 
14
# VHDL test bench directory, where VHDL output files will be created
15
TB_DIR = ../../vhdl/tb
16
# VHDL DE-1 board demo root directory, for vhdl output
17
DEMO_DIR = ../../vhdl/demo
18
# Root test code source directory, where python script and vhdl templates are
19
SRC_DIR = ..
20 182 ja_rd
# Path to local libraries
21 176 ja_rd
LIB_PATH = $(SRC_DIR)/common/libsoc
22 182 ja_rd
# Link script to be used
23 181 ja_rd
LINK_SCRIPT = $(SRC_DIR)/common/bram.lds
24 176 ja_rd
 
25
#-- Configure the application --------------------------------------------------
26
 
27
# Simulation length in cycles; long enough to let the program run to completion.
28 111 ja_rd
SIM_LENGTH = 90000
29 176 ja_rd
 
30 66 ja_rd
# FPGA Block RAM parameters
31
BRAM_START = 0xbfc00000
32
CODE_BRAM_SIZE = 2048
33
# External RAM parameters (size in words)
34
XRAM_SIZE = 1024
35 176 ja_rd
XRAM_START = 0x00000000
36 2 ja_rd
 
37 176 ja_rd
 
38
# 1.- Put the code in internal BRAM and the data in external SRAM.
39
# 2.- Do not use any of the standard libraries and use libsoc instead.
40
 
41
LFLAGS = -T$(LINK_SCRIPT) -L $(LIB_PATH) \
42
         -Ttext $(BRAM_START) -Tdata $(XRAM_START) \
43
         -nodefaultlibs -nostdlib -ereset -I elf32-big
44
CFLAGS = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
45
         -msoft-float -mips1 -G0
46
AFLAGS = --defsym XRAM_BASE=$(XRAM_START)
47
 
48
 
49
OBJS = bootstrap.o opcode_emu.o c_startup.o hello.o
50
 
51
 
52
#-- Targets & rules ------------------------------------------------------------
53
 
54
hello: hello.code hello.data
55
        @# This comment prevents use of implicit rule so our rules are used instead.
56
        @# This will save us a few harmless linker warnings.
57
 
58
hello.axf: $(OBJS)
59
        $(LD) $(LFLAGS) -Map hello.map -s -N -o hello.axf $(OBJS) -lsoc
60
        -@$(DUMP) -m mips --disassemble hello.axf > hello.lst
61
 
62
hello.code: hello.axf
63 66 ja_rd
# Extract object code to be placed in code space
64 176 ja_rd
        $(COPY) -I elf32-big -O binary hello.axf hello.code
65
 
66
hello.data: hello.axf
67 66 ja_rd
# Extract object code to be placed in data space
68 176 ja_rd
        $(COPY) -I elf32-big -j.data -j.bss -O binary hello.axf hello.data
69 49 ja_rd
 
70 123 ja_rd
 
71 176 ja_rd
 
72
bootstrap.o: $(SRC_DIR)/common/bootstrap.s
73
        $(AS) $(AFLAGS) -o bootstrap.o $(SRC_DIR)/common/bootstrap.s
74
 
75
c_startup.o: $(SRC_DIR)/common/c_startup.s
76
        $(AS) $(AFLAGS) -o c_startup.o $(SRC_DIR)/common/c_startup.s
77
 
78
opcode_emu.o: $(SRC_DIR)/common/opcode_emu.s
79
        $(AS) $(AFLAGS) -o opcode_emu.o $(SRC_DIR)/common/opcode_emu.s
80
 
81
hello.o: hello.c
82
        $(CC) $(CFLAGS) -o hello.o hello.c
83
 
84
 
85
 
86
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
87
 
88
#-- Create VHDL file for simulation test bench using TB2 template
89
sim: hello
90 34 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
91 176 ja_rd
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
92
                --log_trigger=0xbfc00000 \
93 49 ja_rd
                -s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
94
                -o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
95 2 ja_rd
 
96 176 ja_rd
#-- Create VHDL file for simulation test bench using TB0 template
97
sim_bram: hello
98 123 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
99
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
100
                -s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb0_template.vhdl \
101
                -o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
102 49 ja_rd
 
103 176 ja_rd
#-- Create VHDL file for hardware demo
104
demo: hello
105 34 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
106 49 ja_rd
        --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
107
        -v $(SRC_DIR)/mips_mpu1_template.vhdl \
108
        -o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
109 176 ja_rd
 
110
 
111
#-- And now the usual housekeeping stuff ---------------------------------------
112
 
113
.PHONY: clean
114
 
115
clean:
116
        -$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin

powered by: WebSVN 2.1.0

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