Author: wmb
Date: Thu Jan 20 00:32:43 2011
New Revision: 2127
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2127
Log:
Makefile frobbing to make the Darwin Makefile correspond to the Linux Makefile.
Modified:
cpu/arm/openmoko/build/Makefile
cpu/x86/Darwin/Makefile
cpu/x86/Linux/Makefile
Modified: cpu/arm/openmoko/build/Makefile
==============================================================================
--- cpu/arm/openmoko/build/Makefile Thu Jan 20 00:28:37 2011 (r2126)
+++ cpu/arm/openmoko/build/Makefile Thu Jan 20 00:32:43 2011 (r2127)
@@ -18,12 +18,15 @@
tags: ${ROMNAME}.tag
@${BASEDIR}/forth/lib/toctags ${BASEDIR} ${TAGFILES}
-${ROMNAME}.rom: FORCE build ${CLIENTPROGS} ${HOSTDIR}/forth
+${ROMNAME}.rom: FORCE build ${CLIENTPROGS} ${HOSTDIR}/forth ${HOSTDIR}/armforth
./build $@
${HOSTDIR}/forth:
@make -C ${HOSTDIR} forth
+${HOSTDIR}/armforth:
+ @make -C ${HOSTDIR} armforth
+
../../build/inflate.bin:
@make -C ../../build inflate.bin
Modified: cpu/x86/Darwin/Makefile
==============================================================================
--- cpu/x86/Darwin/Makefile Thu Jan 20 00:28:37 2011 (r2126)
+++ cpu/x86/Darwin/Makefile Thu Jan 20 00:32:43 2011 (r2127)
@@ -2,67 +2,87 @@
BP=../../..
-CFLAGS = -g -m32 -DTARGET_X86
+# Flags for the OS and CPU
+MFLAGS = -m32
+
+OPT = -O
+CFLAGS = -g $(MFLAGS) -DTARGET_X86
+LFLAGS = $(MFLAGS)
# Extra CFLAGS needed by Darwin hosts. GCC doesn't define __unix__ here,
# so we must include it ourselves.
CFLAGS += -D__unix__=1 -Wimplicit-function-declaration
-#CFLAGS += -DUSE_XCB
+SIMCFLAGS += -D__unix__=1 -Wimplicit-function-declaration
WRTAIL = forth/wrapper
WRDIR = ${BP}/${WRTAIL}
+
+ifdef OMIT_ZIP
+ZIPDIR = ${WRDIR}
+ZIPOBJS = nullzip.o
+INFLATEBIN =
+else
ZIPTAIL = ${WRTAIL}/zip
ZIPDIR = ${BP}/${ZIPTAIL}
-# Apple's GCC is a bit brain-dead. It's probably best to install gcc43 and
-# binutils from macports. See http://macports.macforge.net for how to install
-# and use macports. At the very least, binutils from macports seems to be
-# required.
-
-# The default compiler on Mac OS X (as of 10.5 anyway) does not honor -fpic.
-# GCC will warn about -fpic not being supported, assumes you meant -fPIC,
-# and switches to that. That should be okay, but if you're concerned about it
-# I'm providing this already defined override for ${CC}. To use it, just
-# uncomment it, or pass CC= on the command line. This is here to make things
-# easier for us lazy people.
-#CC = /opt/local/bin/gcc-mp-4.3
-
-# Unfortunately, Mac OS X does not ship with objcopy. This means that one must
-# install binutils from macports, so we override the OBJCOPY variable here
-# and just use that instead of calling 'objcopy' itself.
-OBJCOPY = /opt/local/bin/gobjcopy
-
ZIPOBJS = zipmem.o deflate.o trees.o bits.o util.o inflate.o
-
-OBJS = wrapper.o logger.o ${ZIPOBJS}
-
-all: forth x86forth ../build/inflate.bin
-
-# Use forth when you just need to run Forth but don't care what
-# native instruction set it is on.
-# Use x86forth when you need to compile new dictionaries that will
-# run on x86 systems.
-forth: ${OBJS}
- ${CC} -m32 -o $@ ${OBJS}
- @ln -sf forth x86forth
+INFLATEBIN = ../../build/inflate.bin
# Compile with -O0 because with GCC4, higher optimization levels cause the
# functions to be reordered so the "inflate" entry point is no longer at
# the beginning.
inflate.o: ${ZIPDIR}/inflate.c
- ${CC} -c -m32 -O0 -fpic $< -o $@
+ ${CC} -c ${MFLAGS} -O0 -fpic $< -o $@
# Well, we're not going to get objcopy in a generic OS X environment, so
# let's just fake it.
../build/inflate.bin: inflate.o
- # ${OBJCOPY} -O binary $< $@
dd if=$< of=$@ bs=256 skip=1
+endif
+
+OBJS = wrapper.o logger.o ${ZIPOBJS}
+
+all: forth x86forth ${INFLATEBIN}
+
+# Use forth when you just need to run Forth but don't care what
+# native instruction set it is on.
+# Use x86forth when you need to compile new dictionaries that will
+# run on x86 systems.
+forth: ${OBJS}
+ ${CC} $(MFLAGS) -o $@ ${OBJS}
+ @ln -sf forth x86forth
%.o: ${WRDIR}/%.c
- ${CC} -c ${CFLAGS} -I${ZIPDIR} $< -o $@
+ ${CC} -c ${OPT} ${CFLAGS} $< -o $@
%.o: ${ZIPDIR}/%.c
- ${CC} -c ${CFLAGS} -I${ZIPDIR} $< -o $@
+ ${CC} -c ${OPT} ${CFLAGS} -I${ZIPDIR} $< -o $@
+
+# ARM simulator wrapper build rules
+
+ARMDIR = ${BP}/cpu/arm
+ARMCFLAGS = -g ${MFLAGS} -DARMSIM -DTARGET_ARM -DARM -DSIMNEXT
+ARMSIMOBJS = wrapsim.o armsim.o logger.o ${ZIPOBJS}
+ARMTRACEOBJS = wrapsim.o armsim.trace.o logger.o ${ZIPOBJS}
+
+# Extra CFLAGS needed by Darwin hosts. GCC doesn't define __unix__ here,
+# so we must include it ourselves.
+ARMCFLAGS += -D__unix__=1 -Wimplicit-function-declaration
+
+%.o: ${ARMDIR}/%.c
+ ${CC} -c ${ARMCFLAGS} $< -o $@
+
+wrapsim.o: ${WRDIR}/wrapper.c
+ ${CC} -c ${ARMCFLAGS} -c $< -o $@
+
+armsim.trace.o: $(ARMDIR)/armsim.c
+ ${CC} -c ${ARMCFLAGS} -DTRACE=1 -c $< -o $@
+
+armforth: ${ARMSIMOBJS}
+ ${CC} ${ARMSIMOBJS} -o $@
+
+armforth.trace: ${ARMTRACEOBJS}
+ ${CC} ${ARMTRACEOBJS} -o $@
clean:
- @rm -f forth x86forth *.o *~ inflate.bin
+ @rm -f forth x86forth armforth *.o *~ inflate.bin
Modified: cpu/x86/Linux/Makefile
==============================================================================
--- cpu/x86/Linux/Makefile Thu Jan 20 00:28:37 2011 (r2126)
+++ cpu/x86/Linux/Makefile Thu Jan 20 00:32:43 2011 (r2127)
@@ -2,7 +2,12 @@
BP=../../..
-CFLAGS = -O -g -m32 -DTARGET_X86
+# Flags for the OS and CPU
+MFLAGS = -m32
+
+OPT = -O
+CFLAGS = -g $(MFLAGS) -DTARGET_X86
+LFLAGS = $(MFLAGS)
# Uncomment these lines to include X windows support to the wrapper
# via libxcb. The libxcb development package (headers, etc) must be
@@ -13,11 +18,19 @@
WRTAIL = forth/wrapper
WRDIR = ${BP}/${WRTAIL}
+
+ifdef OMIT_ZIP
+ZIPDIR = ${WRDIR}
+ZIPOBJS = nullzip.o
+INFLATEBIN =
+else
ZIPTAIL = ${WRTAIL}/zip
ZIPDIR = ${BP}/${ZIPTAIL}
ZIPOBJS = zipmem.o deflate.o trees.o bits.o util.o inflate.o
+endif
+
OBJS += wrapper.o logger.o ${ZIPOBJS}
all: forth x86forth ../build/inflate.bin
@@ -27,11 +40,11 @@
# Use x86forth when you need to compile new dictionaries that will
# run on x86 systems.
forth: ${OBJS}
- ${CC} -m32 -o $@ ${OBJS} ${LIBS}
+ ${CC} ${MFLAGS} -o $@ ${OBJS} ${LIBS}
@ln -sf forth x86forth
inflate.lo: ${ZIPDIR}/inflate.c
- ${CC} -c -m32 -Wall -fno-stack-protector -ffreestanding -D_FORTIFY_SOURCE=0 -DNEED_BCOPY -O3 -fpic $< -o $@
+ ${CC} -c $(MFLAGS) -Wall -fno-stack-protector -ffreestanding -D_FORTIFY_SOURCE=0 -DNEED_BCOPY -O3 -fpic $< -o $@
inflate.o: inflate.lo
${LD} -melf_i386 -T inflate.ld $< -o $@
@@ -40,15 +53,15 @@
objcopy -O binary $< $@
%.o: ${WRDIR}/%.c
- ${CC} -c ${CFLAGS} $< -o $@
+ ${CC} -c ${OPT} ${CFLAGS} $< -o $@
%.o: ${ZIPDIR}/%.c
- ${CC} -c ${CFLAGS} -I${ZIPDIR} $< -o $@
+ ${CC} -c ${OPT} ${CFLAGS} -I${ZIPDIR} $< -o $@
# ARM simulator wrapper build rules
ARMDIR = ${BP}/cpu/arm
-ARMCFLAGS = -g -m32 -DARMSIM -DTARGET_ARM -DARM -DSIMNEXT
+ARMCFLAGS = -g ${MFLAGS} -DARMSIM -DTARGET_ARM -DARM -DSIMNEXT
ARMSIMOBJS = wrapsim.o armsim.o logger.o ${ZIPOBJS}
ARMTRACEOBJS = wrapsim.o armsim.trace.o logger.o ${ZIPOBJS}
Author: wmb
Date: Wed Jan 19 23:48:49 2011
New Revision: 2122
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2122
Log:
Copied ppc/fixvoc.fth to arm/fixvoc.fth to eliminate ARM build dependency on PPC subtree.
Added:
cpu/arm/fixvoc.fth
Modified:
cpu/arm/kernel.bth
Added: cpu/arm/fixvoc.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/fixvoc.fth Wed Jan 19 23:48:49 2011 (r2122)
@@ -0,0 +1,52 @@
+purpose: Fixup vocabularies at the end of kernel metacompilation
+\ See license at end of file
+
+only forth meta also forth also definitions
+\ Nasty kludge to resolve the to pointer to the does> clause of vocabulary
+\ within "forth". The problem is that the code field of "forth" contains
+\ a call instruction to the does> clause of vocabulary. This call is a
+\ forward reference which cannot be resolved in the same way as compiled
+\ addresses.
+
+: used-t ( definer-acf child-acf -- )
+ [ also meta ] token!-t [ previous ]
+;
+
+: fix-vocabularies ( -- )
+ [""] <vocabulary> also symbols find previous ( acf true | str false )
+ 0= abort" Can't find <vocabulary> in symbols"
+ dup resolution@ >r ( acf ) ( Return stack: <vocabulary>-adr )
+ dup first-occurrence@ ( acf occurrence )
+ \ Don't let fixall muck with this entry later
+ 0 rot >first-occurrence ! ( occurrence )
+ begin another-occurrence? while ( occurrence )
+ dup [ meta ] token@-t [ forth ] swap ( next-occurrence occurrence )
+ \ Calculate the longword offset to the vocabulary does> clause
+ r@ swap used-t
+ repeat
+ r> drop
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2007 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Modified: cpu/arm/kernel.bth
==============================================================================
--- cpu/arm/kernel.bth Wed Jan 19 23:47:46 2011 (r2121)
+++ cpu/arm/kernel.bth Wed Jan 19 23:48:49 2011 (r2122)
@@ -59,7 +59,7 @@
\ : : : lastacf .name cr ;
fload ${BP}/cpu/arm/target.fth
fload ${BP}/forth/kernel/forward.fth
-fload ${BP}/cpu/ppc/fixvoc.fth
+fload ${BP}/cpu/arm/fixvoc.fth
fload ${BP}/forth/kernel/metacompile.fth
fload ${BP}/cpu/arm/metarel.fth