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

Subversion Repositories ion

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

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