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

Subversion Repositories ion

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

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

Line No. Rev Author Line
1 184 ja_rd
#-- Bring toolchain config parameters from the common makefile
2 191 ja_rd
include ../common/makefile
3 2 ja_rd
 
4 184 ja_rd
# Link script to be used: run from BRAM
5 181 ja_rd
LINK_SCRIPT = $(SRC_DIR)/common/bram.lds
6 176 ja_rd
 
7
#-- Configure the application --------------------------------------------------
8
 
9
# Simulation length in cycles; long enough to let the program run to completion.
10 111 ja_rd
SIM_LENGTH = 90000
11 176 ja_rd
 
12 66 ja_rd
# FPGA Block RAM parameters
13
BRAM_START = 0xbfc00000
14
CODE_BRAM_SIZE = 2048
15
# External RAM parameters (size in words)
16
XRAM_SIZE = 1024
17 176 ja_rd
XRAM_START = 0x00000000
18 2 ja_rd
 
19 176 ja_rd
 
20
# 1.- Put the code in internal BRAM and the data in external SRAM.
21
# 2.- Do not use any of the standard libraries and use libsoc instead.
22
 
23
LFLAGS = -T$(LINK_SCRIPT) -L $(LIB_PATH) \
24
         -Ttext $(BRAM_START) -Tdata $(XRAM_START) \
25
         -nodefaultlibs -nostdlib -ereset -I elf32-big
26
CFLAGS = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
27
         -msoft-float -mips1 -G0
28
AFLAGS = --defsym XRAM_BASE=$(XRAM_START)
29
 
30
 
31
OBJS = bootstrap.o opcode_emu.o c_startup.o hello.o
32
 
33
 
34
#-- Targets & rules ------------------------------------------------------------
35
 
36
hello: hello.code hello.data
37
        @# This comment prevents use of implicit rule so our rules are used instead.
38
        @# This will save us a few harmless linker warnings.
39
 
40
hello.axf: $(OBJS)
41
        $(LD) $(LFLAGS) -Map hello.map -s -N -o hello.axf $(OBJS) -lsoc
42
        -@$(DUMP) -m mips --disassemble hello.axf > hello.lst
43
 
44
hello.code: hello.axf
45 66 ja_rd
# Extract object code to be placed in code space
46 176 ja_rd
        $(COPY) -I elf32-big -O binary hello.axf hello.code
47
 
48
hello.data: hello.axf
49 66 ja_rd
# Extract object code to be placed in data space
50 176 ja_rd
        $(COPY) -I elf32-big -j.data -j.bss -O binary hello.axf hello.data
51 49 ja_rd
 
52 123 ja_rd
 
53 176 ja_rd
 
54
bootstrap.o: $(SRC_DIR)/common/bootstrap.s
55
        $(AS) $(AFLAGS) -o bootstrap.o $(SRC_DIR)/common/bootstrap.s
56
 
57
c_startup.o: $(SRC_DIR)/common/c_startup.s
58
        $(AS) $(AFLAGS) -o c_startup.o $(SRC_DIR)/common/c_startup.s
59
 
60
opcode_emu.o: $(SRC_DIR)/common/opcode_emu.s
61
        $(AS) $(AFLAGS) -o opcode_emu.o $(SRC_DIR)/common/opcode_emu.s
62
 
63
hello.o: hello.c
64
        $(CC) $(CFLAGS) -o hello.o hello.c
65
 
66
 
67
 
68
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
69
 
70 229 ja_rd
#-- Create VHDL package with data and parameters for simulation
71 193 ja_rd
sim: hello demo
72 229 ja_rd
        $(VHDL_OBJ_PKG) --project="Hello World" \
73
                --package sim_params_pkg \
74
                --bin hello.code --name obj_code --bram_size $(CODE_BRAM_SIZE) \
75
                --bin hello.data --name sram_init --xram_size $(XRAM_SIZE)\
76
                --name prom_init --flash_size 0 \
77
                --output $(TB_DIR)/sim_params_pkg.vhdl \
78
                -s $(SIM_LENGTH) --log_trigger=0xbfc00000 \
79 2 ja_rd
 
80 176 ja_rd
#-- Create VHDL file for simulation test bench using TB0 template
81 229 ja_rd
#-- This will instantiate the CPU without any caches or memory controller and
82
#-- will run the program off of an initialized ROM connected to the code
83
#-- interface.
84
#-- NOTE: This target has not been used in some time and may be broken. It's
85
#-- here because it can still be useful in an emergency.
86 176 ja_rd
sim_bram: hello
87 123 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
88
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
89 191 ja_rd
                -s $(SIM_LENGTH) -v $(SRC_DIR)/mips_tb0_template.vhdl \
90
                -o $(TB_DIR)/mips_tb2.vhdl -e mips_tb2
91 49 ja_rd
 
92 229 ja_rd
#-- Create VHDL package with data and parameters for simulation and syntesis
93 176 ja_rd
demo: hello
94 229 ja_rd
        $(VHDL_OBJ_PKG) --project="Hello World" \
95
                --package obj_code_pkg \
96
                --bin hello.code --name obj_code --bram_size $(CODE_BRAM_SIZE) \
97
                --output $(DEMO_DIR)/../SoC/bootstrap_code_pkg.vhdl
98 176 ja_rd
 
99
 
100
#-- And now the usual housekeeping stuff ---------------------------------------
101
 
102
.PHONY: clean
103
 
104
clean:
105
        -$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin

powered by: WebSVN 2.1.0

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