
On Tue, Apr 11, 2006 at 09:17:12AM +0200, Matej Kupljen wrote:
I posted a new version of config.mk on August 24. Please see this post: http://sourceforge.net/mailarchive/message.php?msg_id=12736269
This config.mk tries to solve the big/little endian toolchain problems. It works for me, but Wolfgang did not include it in the official tree. Maybe you can test it, if it works for you.
Yes it works... even if I made some little modifications. Here my proposal:
v=$(shell \ $(AS) --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}') MIPSCFLAGS=$(shell \ if [ "$v" -lt "14" ]; then \ echo "-mcpu=4kc"; \ else \ echo "-march=4kc -mtune=4kc"; \ fi)
MIPSCFLAGS += -mabicalls
# Check the default ENDIANNESS of the cross compiler e=$(shell \ TMPDIR=`mktemp -d`; \ trap 'rm -fr ${TMPDIR}' 0 1 2 3 15; \
$${TMPDIR}/foo.c; \
${CROSS_COMPILE}gcc -c $${TMPDIR}/foo.c -o $${TMPDIR}/foo.o; \ readelf -h $${TMPDIR}/foo.o | \ sed -n 's/.*Data:.* ([^ ][^ ]*) endian/\1/p'; \ )
ifneq ($e,"little") MIPSLDFLAGS += -EL else MIPSLDFLAGS += -EB endif
PLATFORM_CPPFLAGS += $(MIPSCFLAGS) PLATFORM_LDFLAGS += $(MIPSLDFLAGS)
As you can see I call AS with "$(AS)" and not with "$(CROSS_COMPILE)as" since variable "AS" is already defined and I added "MIPSCFLAGS" and "MIPSLDFLAGS" where I specify "-EL" or "-EB".
Please, note also that "-Wa,-allow_branch_to_undefined" is no more necessary due my patch "http://sourceforge.net/mailarchive/message.php?msg_id=13328221".
Also I suggest this patch for the examples directory:
diff --git a/examples/Makefile b/examples/Makefile index 62c4e6d..30ce77d 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -100,10 +100,6 @@ SREC += eepro100_eeprom.srec BIN += eepro100_eeprom.bin eepro100_eeprom endif
-ifeq ($(BIG_ENDIAN),y) -EX_LDFLAGS += -EB -endif - OBJS = $(SREC:.srec=.o)
LIB = libstubs.a @@ -129,7 +125,7 @@ $(LIB): .depend $(LIBOBJS) $(AR) crv $@ $(LIBOBJS)
%: %.o $(LIB) - $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \ + $(LD) -g $(PLATFORM_LDFLAGS) -Ttext $(LOAD_ADDR) \ -o $@ -e $(<:.o=) $< $(LIB) \ -L$(gcclibdir) -lgcc %.srec: %
since endianess should be defined each time by "PLATFORM_LDFLAGS" instead of "EX_LDFLAGS".
Ciao,
Rodolfo