GNUmakefile
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
include $(ROOT)/usr/include/make/commondefs
include $(ROOT)/usr/include/make/PRdefs
OBJCOPY = mips-linux-objcopy
REMOVE_SECTS = -R .reginfo -R .note -R .comment -R .mdebug
TARGETS = rom.bin
ifndef DEV_SHORTCUT
ASFILES = entry.s bootu.s bootc.s handler.s
else
ASFILES = dev.s
endif
CFILES = skload.c sha1.c
OPTIMIZER=
#LCOPTS += -mcpu=4300 -mips3 -Os
#LCOPTS += -mips3 -Os
#LASOPTS += -mips3 -Os
LCOPTS += -mcpu=4300 -mips3 -O2
LASOPTS += -mcpu=4300 -mips3 -O2
ifdef DEV_SHORTCUT
LCOPTS += -DDEV_SHORTCUT
endif
ifdef _DEBUG
LCOPTS += -D_DEBUG
LASOPTS += -D_DEBUG
endif
ifndef DEV_SHORTCUT
LLDOPTS += -Wl,-T rom.lk -N
else
LLDOPTS += -Ttext 0xbfc00000 -N
endif
TMPFILE = j.j
LDIRT += handler[123].o $(TMPFILE) rom.elf rom.sim
# SUBDIRS used for testing
SUBDIRS = psk
VSIMDIR = $(BBROOT)/hw/chip/vsim
SIMOSBIN = $(BBROOT)/sw/bbplayer/simos/cpus/simbb/SIMOS-X86/simos
default : $(TARGETS)
rom.bin: $(OBJECTS)
ln -s -f handler.o handler1.o
ln -s -f handler.o handler2.o
ln -s -f handler.o handler3.o
$(CCF) -o rom.elf $(OBJECTS) $(LDFLAGS)
rm -f handler1.o handler2.o handler3.o
$(OBJCOPY) -O binary -S $(REMOVE_SECTS) rom.elf rom.bin
od -v -w4 -An -tx1 rom.bin | tr -d " " > rom.sim
test: default copy_sim
$(SUBDIRS_MAKERULE)
cd $(VSIMDIR); sim.cpu +vcs+lic+wait +cbus_mon +cpu_mon +io_mon
# NOTE: init.simos file must have line:
# set PARAM(FILES.FPROMFile) "romsimos.elf"
# Also, will need to use <CTL>-C in shell make is run from
# to kill simos.
testsimos: default
$(SUBDIRS_MAKERULE)
$(OBJCOPY) -j .bss --add-section .text=./rom.bin rom.elf $(TMPFILE)
$(OBJCOPY) --set-section-flags .text=alloc,load,readonly,code \
--adjust-section-vma .text=0xbfc00000 $(TMPFILE) romsimos.elf
export SIMOS_FLASH=psk/psk.nand; export SIMOS_VIRAGE2=psk/vram2.sim; \
echo r | $(SIMOSBIN)
exports install headers:
$(INSTALL) -m 444 -F /usr/include/PR -src boot.h bbboot.h
include $(COMMONRULES)
copy_sim:
cp -f rom.sim $(VSIMDIR)/tests/brom.dat