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

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [adventure/] [makefile] - Blame information for rev 177

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

Line No. Rev Author Line
1 177 ja_rd
#-- Set up the toolchain -------------------------------------------------------
2 90 ja_rd
 
3 177 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 90 ja_rd
 
11 177 ja_rd
 
12
#-- Set up the code structure --------------------------------------------------
13
 
14
# Root test code source directory, where python script and vhdl templates are
15
SRC_DIR = ..
16
# VHDL test bench directory, where VHDL output files will be created
17
TB_DIR = ../../vhdl/tb
18
# VHDL DE-1 board demo root directory, for vhdl output
19
DEMO_DIR = ../../vhdl/demo
20
# Path to local libraries
21
LIB_PATH = $(SRC_DIR)/common/libsoc
22
 
23
#-- Configure the VHDL simulation environment ----------------------------------
24
 
25
# Simulation length in cycles; long enough to let the program run to completion.
26 143 ja_rd
SIM_LENGTH = 400000000
27 90 ja_rd
 
28 177 ja_rd
 
29
#-- Configure the memory map ---------------------------------------------------
30
# FIXME this info is redundant with the linker script
31
 
32 90 ja_rd
# FPGA Block RAM parameters
33
BRAM_START = 0xbfc00000
34
CODE_BRAM_SIZE = 2048
35
# External RAM parameters (size in words)
36 177 ja_rd
XRAM_SIZE = 200000
37 90 ja_rd
XRAM_START = 0x00000000
38 177 ja_rd
# External FLASH parameters (size in words)
39
# Note te size is for simulation only
40
FLASH_START = 0xb0000000
41
FLASH_SIM_SIZE = 65536
42 90 ja_rd
 
43 177 ja_rd
#-- Configure the code ---------------------------------------------------------
44 90 ja_rd
 
45 177 ja_rd
# Options for 'boot' code running from BRAM at 0xbfc00000:
46
# 1.- Put the code in internal BRAM and the data in external SRAM.
47
# 2.- Do not use any of the standard libraries and use libsoc instead.
48
LFLAGS_BOOT = -L $(LIB_PATH) -Ttext $(BRAM_START) -Tdata $(XRAM_START) \
49
         -nodefaultlibs -nostdlib -ereset -I elf32-big -defsym entry=$(FLASH_START)
50
CFLAGS_BOOT = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
51
         -msoft-float -mips1 -G0
52
AFLAGS_BOOT = --defsym RUN_FROM_BRAM=1 --defsym XRAM_BASE=$(XRAM_START)
53 90 ja_rd
 
54
 
55 177 ja_rd
# Options for 'main' code running from FLASH at 0xb0000000:
56
# 1.- Put the code in FLASH and the data in external SRAM.
57
# 2.- Do not use any of the standard libraries and use libsoc instead.
58
LFLAGS_MAIN = -Tflash.lds -L $(LIB_PATH) \
59
         -nodefaultlibs -nostdlib -eentry -I elf32-big
60
CFLAGS_MAIN = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
61
         -msoft-float -mips1 -G0
62
AFLAGS_MAIN = --defsym XRAM_BASE=$(XRAM_START)
63 90 ja_rd
 
64 177 ja_rd
# Object files for main program
65
OBJS = c_startup.o main.o actions1.o actions2.o init.o misc.o \
66
        score.o adv_baremetal.o
67
SRCS = actions1.c actions2.c main.c init.c misc.c score.c adv_baremetal.c
68 90 ja_rd
 
69
 
70 177 ja_rd
#-- Targets & rules ------------------------------------------------------------
71 90 ja_rd
 
72 177 ja_rd
adventure: adventure.bin bootstrap
73
        @# This comment prevents use of implicit rule so our rules are used instead.
74
        @# This will save us a few harmless linker warnings.
75 90 ja_rd
 
76 177 ja_rd
adventure.bin: adventure.axf
77
        # Extract object code to be placed in code space
78
        $(COPY) -I elf32-big -O binary adventure.axf adventure.bin
79
 
80
adventure.axf: $(OBJS)
81
        $(LD) $(LFLAGS_MAIN) -Map adventure.map -s -N -o adventure.axf $(OBJS) -lsoc
82
        -@$(DUMP) -m mips --disassemble adventure.axf > adventure.lst
83 90 ja_rd
 
84 177 ja_rd
c_startup.o: $(SRC_DIR)/common/c_startup.s
85
        $(AS) $(AFLAGS_MAIN) -o c_startup.o $(SRC_DIR)/common/c_startup.s
86
 
87
 
88
actions1.o:         misc.h main.h share.h funcs.h
89
main.o:             misc.h adv_baremetal.h
90
actions2.o:         misc.h main.h share.h funcs.h
91
init.o:             misc.h main.h share.h funcs.h
92
misc.o:             misc.h main.h
93
score.o:            misc.h main.h share.h
94
adv_baremetal.o:    adv_baremetal.h
95
 
96
 
97
#-- Compilation of 'boot' code to be run from BRAM
98
 
99
bootstrap.o: $(SRC_DIR)/common/bootstrap.s
100
        $(AS) -defsym XRAM_BASE=$(XRAM_START) -o bootstrap.o $(SRC_DIR)/common/bootstrap.s
101
 
102
opcode_emu.o: $(SRC_DIR)/common/opcode_emu.s
103
        $(AS) $(AFLAGS) -o opcode_emu.o $(SRC_DIR)/common/opcode_emu.s
104
 
105
bootstrap.axf: bootstrap.o opcode_emu.o
106
        $(LD) $(LFLAGS_BOOT) -Map bootstrap.map -s -N -o bootstrap.axf bootstrap.o opcode_emu.o
107
        -@$(DUMP) -I elf32-big --disassemble bootstrap.axf > bootstrap.lst
108
 
109
bootstrap: bootstrap.axf
110
        $(COPY) -I elf32-big -j .text -j .rodata -O binary bootstrap.axf bootstrap.code
111
        $(COPY) -I elf32-big -j .sbss -j .data -j .bss -O binary bootstrap.axf bootstrap.data
112
 
113
 
114
#-- Let's make some implicit rules explicit for clarity (well, 'clarity')
115
 
116
%.o: %.c
117
        $(CC) $(CFLAGS_MAIN) $< -o $@
118
 
119
 
120
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
121
 
122
 
123
 
124 90 ja_rd
# Create VHDL file for simulation test bench using TB2 template
125 177 ja_rd
sim: bootstrap adventure
126 143 ja_rd
        $(TO_VHDL) --code bootstrap.code --log_trigger=b0000000 \
127 90 ja_rd
                --flash adventure.bin --flash_size $(FLASH_SIM_SIZE) \
128
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
129
                -s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
130
                -o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
131
 
132
 
133
# Create VHDL file for hardware demo
134 177 ja_rd
demo: bootstrap adventure
135 90 ja_rd
        $(TO_VHDL) --code bootstrap.code \
136
        --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
137
        -v $(SRC_DIR)/mips_mpu1_template.vhdl \
138
        -o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
139 177 ja_rd
 
140
 
141
#-- And now the usual housekeeping stuff ---------------------------------------
142
 
143
.PHONY: clean
144
 
145
clean:
146
        -$(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.