GNUmakefile 1.96 KB
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