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

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [adventure/] [makefile] - Diff between revs 143 and 177

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 143 Rev 177
Line 1... Line 1...
# External memory test -- build simulation and execution VHDL modules
#-- Set up the toolchain -------------------------------------------------------
 
 
 
BIN_MIPS = C:/dev/embedded/SourceryGpp/mips-elf-11-03.52/bin
 
CC = $(BIN_MIPS)/mips-sde-elf-gcc.exe $(CFLAGS)
 
AS = $(BIN_MIPS)/mips-sde-elf-as
 
LD = $(BIN_MIPS)/mips-sde-elf-ld
 
DUMP = $(BIN_MIPS)/mips-sde-elf-objdump
 
COPY = $(BIN_MIPS)/mips-sde-elf-objcopy
 
TO_VHDL   = python ../bin2hdl.py
 
 
 
 
 
#-- Set up the code structure --------------------------------------------------
 
 
 
# Root test code source directory, where python script and vhdl templates are
 
SRC_DIR = ..
 
# VHDL test bench directory, where VHDL output files will be created
 
TB_DIR = ../../vhdl/tb
 
# VHDL DE-1 board demo root directory, for vhdl output
 
DEMO_DIR = ../../vhdl/demo
 
# Path to local libraries
 
LIB_PATH = $(SRC_DIR)/common/libsoc
 
 
# Get common makefile stuff (toolchain & system config)
#-- Configure the VHDL simulation environment ----------------------------------
include ..\\common\\makefile
 
 
 
# We'll run the simulation for long enough to complete the test
# Simulation length in cycles; long enough to let the program run to completion.
SIM_LENGTH = 400000000
SIM_LENGTH = 400000000
 
 
 
 
 
#-- Configure the memory map ---------------------------------------------------
 
# FIXME this info is redundant with the linker script
 
 
# FPGA Block RAM parameters
# FPGA Block RAM parameters
BRAM_START = 0xbfc00000
BRAM_START = 0xbfc00000
CODE_BRAM_SIZE = 2048
CODE_BRAM_SIZE = 2048
# External RAM parameters (size in words)
# External RAM parameters (size in words)
XRAM_SIZE = 200000
XRAM_SIZE = 200000
XRAM_START = 0x00000000
XRAM_START = 0x00000000
#
# External FLASH parameters (size in words)
 
# Note te size is for simulation only
FLASH_START = 0xb0000000
FLASH_START = 0xb0000000
FLASH_SIM_SIZE = 65536
FLASH_SIM_SIZE = 65536
 
 
 
#-- Configure the code ---------------------------------------------------------
 
 
LFLAGS_BOOTSTRAP = -Ttext $(BRAM_START) -Tdata $(XRAM_START) -eentry -I elf32-big
# Options for 'boot' code running from BRAM at 0xbfc00000:
#LFLAGS_FLASH = -Ttext $(FLASH_START) -Tdata $(XRAM_START) -eentry -I elf32-big
# 1.- Put the code in internal BRAM and the data in external SRAM.
LFLAGS_FLASH = -Tflash.lds -eentry -I elf32-big
# 2.- Do not use any of the standard libraries and use libsoc instead.
 
LFLAGS_BOOT = -L $(LIB_PATH) -Ttext $(BRAM_START) -Tdata $(XRAM_START) \
 
         -nodefaultlibs -nostdlib -ereset -I elf32-big -defsym entry=$(FLASH_START)
 
CFLAGS_BOOT = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
 
         -msoft-float -mips1 -G0
 
AFLAGS_BOOT = --defsym RUN_FROM_BRAM=1 --defsym XRAM_BASE=$(XRAM_START)
 
 
 
 
 
# Options for 'main' code running from FLASH at 0xb0000000:
 
# 1.- Put the code in FLASH and the data in external SRAM.
 
# 2.- Do not use any of the standard libraries and use libsoc instead.
 
LFLAGS_MAIN = -Tflash.lds -L $(LIB_PATH) \
 
         -nodefaultlibs -nostdlib -eentry -I elf32-big
 
CFLAGS_MAIN = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
 
         -msoft-float -mips1 -G0
 
AFLAGS_MAIN = --defsym XRAM_BASE=$(XRAM_START)
 
 
 
# Object files for main program
 
OBJS = c_startup.o main.o actions1.o actions2.o init.o misc.o \
 
        score.o adv_baremetal.o
 
SRCS = actions1.c actions2.c main.c init.c misc.c score.c adv_baremetal.c
 
 
 
 
 
#-- Targets & rules ------------------------------------------------------------
 
 
 
adventure: adventure.bin bootstrap
 
        @# This comment prevents use of implicit rule so our rules are used instead.
 
        @# This will save us a few harmless linker warnings.
 
 
 
adventure.bin: adventure.axf
 
        # Extract object code to be placed in code space
 
        $(COPY) -I elf32-big -O binary adventure.axf adventure.bin
 
 
clean:
adventure.axf: $(OBJS)
        -$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin
        $(LD) $(LFLAGS_MAIN) -Map adventure.map -s -N -o adventure.axf $(OBJS) -lsoc
 
        -@$(DUMP) -m mips --disassemble adventure.axf > adventure.lst
 
 
 
c_startup.o: $(SRC_DIR)/common/c_startup.s
 
        $(AS) $(AFLAGS_MAIN) -o c_startup.o $(SRC_DIR)/common/c_startup.s
 
 
adventure: actions1.c actions2.c main.c init.c misc.c score.c adv_baremetal.c
 
        $(AS_MIPS) -o startup.o $(SRC_DIR)/common/startup.s
 
        $(GCC_MIPS) $(CFLAGS) -o baremetal.o $(SRC_DIR)/common/baremetal.c
 
        $(GCC_MIPS) $(CFLAGS) -o actions1.o actions1.c
 
        $(GCC_MIPS) $(CFLAGS) -o main.o main.c
 
        $(GCC_MIPS) $(CFLAGS) -o actions2.o actions2.c
 
        $(GCC_MIPS) $(CFLAGS) -o init.o init.c
 
        $(GCC_MIPS) $(CFLAGS) -c -g -Wa,-a,-ad -o init.o init.c > init.lst
 
        $(GCC_MIPS) $(CFLAGS) -o misc.o misc.c
 
        $(GCC_MIPS) $(CFLAGS) -o score.o score.c
 
        $(GCC_MIPS) $(CFLAGS) -o adv_baremetal.o adv_baremetal.c
 
        $(LD_MIPS) $(LFLAGS_FLASH) -Map adventure.map -s -N -o adventure.axf startup.o \
 
            main.o actions1.o actions2.o init.o misc.o score.o baremetal.o adv_baremetal.o
 
        -@$(DUMP_MIPS) -m mips --disassemble adventure.axf > adventure.lst
 
# Extract object code to be placed in code space
 
        $(COPY_MIPS) -I elf32-big -O binary adventure.axf adventure.bin
 
 
 
 
actions1.o:         misc.h main.h share.h funcs.h
 
main.o:             misc.h adv_baremetal.h
 
actions2.o:         misc.h main.h share.h funcs.h
 
init.o:             misc.h main.h share.h funcs.h
 
misc.o:             misc.h main.h
 
score.o:            misc.h main.h share.h
 
adv_baremetal.o:    adv_baremetal.h
 
 
 
 
 
#-- Compilation of 'boot' code to be run from BRAM
 
 
 
bootstrap.o: $(SRC_DIR)/common/bootstrap.s
 
        $(AS) -defsym XRAM_BASE=$(XRAM_START) -o bootstrap.o $(SRC_DIR)/common/bootstrap.s
 
 
 
opcode_emu.o: $(SRC_DIR)/common/opcode_emu.s
 
        $(AS) $(AFLAGS) -o opcode_emu.o $(SRC_DIR)/common/opcode_emu.s
 
 
 
bootstrap.axf: bootstrap.o opcode_emu.o
 
        $(LD) $(LFLAGS_BOOT) -Map bootstrap.map -s -N -o bootstrap.axf bootstrap.o opcode_emu.o
 
        -@$(DUMP) -I elf32-big --disassemble bootstrap.axf > bootstrap.lst
 
 
 
bootstrap: bootstrap.axf
 
        $(COPY) -I elf32-big -j .text -j .rodata -O binary bootstrap.axf bootstrap.code
 
        $(COPY) -I elf32-big -j .sbss -j .data -j .bss -O binary bootstrap.axf bootstrap.data
 
 
bootstrap: bootstrap.s
 
        $(AS_MIPS) -defsym XRAM_BASE=$(XRAM_START) -o bootstrap.o bootstrap.s
#-- Let's make some implicit rules explicit for clarity (well, 'clarity')
        $(LD_MIPS) $(LFLAGS_BOOTSTRAP) -Map bootstrap.map -s -N -o bootstrap.axf bootstrap.o
 
        -@$(DUMP_MIPS) -I elf32-big --disassemble bootstrap.axf > bootstrap.lst
%.o: %.c
        $(COPY_MIPS) -I elf32-big -j .text -j .rodata -O binary bootstrap.axf bootstrap.code
        $(CC) $(CFLAGS_MAIN) $< -o $@
        $(COPY_MIPS) -I elf32-big -j .sbss -j .data -j .bss -O binary bootstrap.axf bootstrap.data
 
 
 
 
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
 
 
 
 
 
 
# Create VHDL file for simulation test bench using TB2 template
# Create VHDL file for simulation test bench using TB2 template
adventure_sim: bootstrap adventure
sim: bootstrap adventure
        $(TO_VHDL) --code bootstrap.code --log_trigger=b0000000 \
        $(TO_VHDL) --code bootstrap.code --log_trigger=b0000000 \
                --flash adventure.bin --flash_size $(FLASH_SIM_SIZE) \
                --flash adventure.bin --flash_size $(FLASH_SIM_SIZE) \
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
                --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
                -s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
                -s $(SIM_LENGTH) -v $(SRC_DIR)\\mips_tb2_template.vhdl \
                -o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
                -o $(TB_DIR)\\mips_tb2.vhdl -e mips_tb2
 
 
 
 
# Create VHDL file for hardware demo
# Create VHDL file for hardware demo
adventure_demo: bootstrap adventure
demo: bootstrap adventure
        $(TO_VHDL) --code bootstrap.code \
        $(TO_VHDL) --code bootstrap.code \
        --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
        --code_size $(CODE_BRAM_SIZE) --data_size $(XRAM_SIZE) \
        -v $(SRC_DIR)/mips_mpu1_template.vhdl \
        -v $(SRC_DIR)/mips_mpu1_template.vhdl \
        -o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
        -o $(DEMO_DIR)/mips_mpu.vhdl -e mips_mpu
 
 
 
 
 
#-- And now the usual housekeeping stuff ---------------------------------------
 
 
 
.PHONY: clean
 
 
 
clean:
 
        -$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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