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

Subversion Repositories ion

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

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
#-- Create VHDL file for simulation test bench using TB2 template
71 193 ja_rd
sim: hello demo
72 34 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
73 176 ja_rd
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
74
                --log_trigger=0xbfc00000 \
75 191 ja_rd
                -s $(SIM_LENGTH) -v $(SRC_DIR)/mips_tb2_template.vhdl \
76
                -o $(TB_DIR)/mips_tb2.vhdl -e mips_tb2
77 193 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
78
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
79
                --log_trigger=0xbfc00000 \
80
                -s $(SIM_LENGTH) -v $(SRC_DIR)/sim_params_template.vhdl \
81
                -o $(TB_DIR)/sim_params_pkg.vhdl -e mips_tb2
82 2 ja_rd
 
83 176 ja_rd
#-- Create VHDL file for simulation test bench using TB0 template
84
sim_bram: hello
85 123 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
86
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
87 191 ja_rd
                -s $(SIM_LENGTH) -v $(SRC_DIR)/mips_tb0_template.vhdl \
88
                -o $(TB_DIR)/mips_tb2.vhdl -e mips_tb2
89 49 ja_rd
 
90 176 ja_rd
#-- Create VHDL file for hardware demo
91
demo: hello
92 34 ja_rd
        $(TO_VHDL) --code hello.code --data hello.data \
93 49 ja_rd
        --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
94 191 ja_rd
        -v $(SRC_DIR)/code_rom_template.vhdl -n "Hello World" \
95
        -o $(DEMO_DIR)/code_rom_pkg.vhdl
96 176 ja_rd
 
97
 
98
#-- And now the usual housekeeping stuff ---------------------------------------
99
 
100
.PHONY: clean
101
 
102
clean:
103
        -$(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.