GNUmakefile 1.27 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

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

LDIRT += handler[123].o rom.elf rom.sim

# SUBDIRS used for testing
SUBDIRS = psk

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 $(BBROOT)/hw/chip/vsim; sim.cpu +vcs+lic+wait +cbus_mon +cpu_mon +io_mon

exports install:

include $(COMMONRULES)

copy_sim:
	cp -f rom.sim $(BBROOT)/hw/chip/vsim/tests/brom.dat