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

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [sdboot/] [makefile] - Blame information for rev 246

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 246 ja_rd
#-- Bring toolchain config parameters from the common makefile
2
include ../common/makefile
3
 
4
# Link script to be used: run from BRAM, use upper chunk of RAM, leaving
5
# the memory from 0x0 onwards free to be initialized with the binary file
6
# read from the SD card.
7
LINK_SCRIPT = $(SRC_DIR)/common/boot.lds
8
 
9
#-- Configure the application --------------------------------------------------
10
 
11
# Simulation length in cycles; long enough to let the program run to completion.
12
SIM_LENGTH = 90000
13
 
14
# FPGA Block RAM parameters (size in words)
15
# 16K is far too much BRAM; in a real world the bootloader would have to be
16
# squeezed into a smaller space or placed in flash. For our purposes this
17
# will do.
18
BRAM_START = 0xbfc00000
19
CODE_BRAM_SIZE = 4096
20
# External RAM parameters (size in words)
21
# We're using the top 16K of the main 512K RAM area; the rest will be filled
22
# with the code read from disk.
23
XRAM_SIZE = 4096
24
XRAM_START = 0x0007BFFC
25
 
26
# Here's where the FatFs source lives
27
FATFS = ../common/fatfs
28
 
29
# 1.- Put the code in internal BRAM and the data in external SRAM.
30
# 2.- Do not use any of the standard libraries and use libsoc instead.
31
 
32
LFLAGS = -T$(LINK_SCRIPT) -L $(LIB_PATH) \
33
         -Ttext $(BRAM_START) -Tdata $(XRAM_START) \
34
         -nodefaultlibs -nostdlib -ereset -I elf32-big
35
CFLAGS = -O2 -Wall -c -s -fno-builtin -nodefaultlibs -nostdlib \
36
         -msoft-float -mips1 -G0 -I $(FATFS)
37
AFLAGS = --defsym XRAM_BASE=$(XRAM_START)
38
 
39
 
40
OBJS = bootstrap.o opcode_emu.o c_startup.o sdboot.o \
41
       $(FATFS)/mmcbb.o $(FATFS)/ff.o
42
 
43
 
44
 
45
#-- Targets & rules ------------------------------------------------------------
46
 
47
sdboot: sdboot.code
48
        @# This comment prevents use of implicit rule so our rules are used instead.
49
        @# This will save us a few harmless linker warnings.
50
 
51
sdboot.axf: $(OBJS)
52
        $(LD) $(LFLAGS) -Map sdboot.map -s -N -o sdboot.axf $(OBJS) -lsoc
53
        -@$(DUMP) -m mips --disassemble sdboot.axf > sdboot.lst
54
 
55
sdboot.code: sdboot.axf
56
# Extract object code to be placed in code space
57
        $(COPY) -I elf32-big -O binary sdboot.axf sdboot.code
58
 
59
 
60
# Rules for the assembly source files
61
bootstrap.o: $(SRC_DIR)/common/bootstrap.s
62
        $(AS) $(AFLAGS) -o bootstrap.o $(SRC_DIR)/common/bootstrap.s
63
 
64
c_startup.o: $(SRC_DIR)/common/c_startup.s
65
        $(AS) $(AFLAGS) -o c_startup.o $(SRC_DIR)/common/c_startup.s
66
 
67
opcode_emu.o: $(SRC_DIR)/common/opcode_emu.s
68
        $(AS) $(AFLAGS) -o opcode_emu.o $(SRC_DIR)/common/opcode_emu.s
69
 
70
#-- Let's make some implicit rules explicit for clarity (well, 'clarity')
71
 
72
%.o: %.c
73
        $(CC) $(CFLAGS_MAIN) $< -o $@
74
 
75
 
76
 
77
#-- Targets that build the synthesizable vhdl; meant for direct invocation -----
78
 
79
#-- Create VHDL package with data and parameters for simulation
80
sim: sdboot demo
81
        $(VHDL_OBJ_PKG) --project="SD Bootloader" \
82
                --package sim_params_pkg \
83
                --bin sdboot.code --name obj_code --bram_size $(CODE_BRAM_SIZE) \
84
                --name prom_init --flash_size 0 \
85
                --output $(TB_DIR)/sim_params_pkg.vhdl \
86
                -s $(SIM_LENGTH) --log_trigger=0xbfc00000 \
87
 
88
#-- Create VHDL package with data and parameters for simulation and syntesis
89
demo: sdboot
90
        $(VHDL_OBJ_PKG) --project="SD Bootloader" \
91
                --package obj_code_pkg \
92
                --bin sdboot.code --name obj_code --bram_size $(CODE_BRAM_SIZE) \
93
                --output $(DEMO_DIR)/../SoC/bootstrap_code_pkg.vhdl
94
 
95
 
96
#-- And now the usual housekeeping stuff ---------------------------------------
97
 
98
.PHONY: clean
99
 
100
clean:
101
        -$(RM) *.o *.obj *.map *.lst *.hex *.exe *.axf *.code *.data *.bin
102
        -$(RM) $(FATFS)/*.o

powered by: WebSVN 2.1.0

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