diff -uNr riscy.orig/arm.lisp riscy/arm.lisp --- riscy.orig/arm.lisp 2005-01-08 15:35:50.000000000 -0700 +++ riscy/arm.lisp 2007-06-08 21:10:03.981892800 -0600 @@ -10,29 +10,40 @@ ;; (load "arm") ;; (interp) +(format t "loading LISP sources~%") (load "mem") (load "parse") (load "prim") (load "forth") ;(load "term") +(format t "loaded LISP sources~%") +(format t "loading packages~%") (use-package "MEM") (use-package "PARSE") (use-package "ARMPRIMITIVES") (use-package "ARMFORTH") ;(use-package "ARMTERM") (use-package "EXT") +(format t "loaded packages~%") +(format t "(reset-forth)~%") (reset-forth) +(format t "(load-primitives)~%") (load-primitives) +(format t "(import-symbol-table)~%") (import-symbol-table) +(format t "(build-forth-word-lists)~%") (build-forth-word-lists) +(format t "(hash-forth-word-lists)~%") (hash-forth-word-lists) (setf *ep* (address-of-raw-label "freeRAM")) ;; Now load the high-level Forth source code file(s). +(format t "compiling lpc.forth~%") (forth-compile-file "lpc.forth") +(format t "compiling riscy.forth~%") (forth-compile-file "riscy.forth") ;; Perhaps compile this one only if heads are stored on target diff -uNr riscy.orig/lpc2103.ld riscy/lpc2103.ld --- riscy.orig/lpc2103.ld 1969-12-31 17:00:00.000000000 -0700 +++ riscy/lpc2103.ld 2007-06-09 00:47:54.546441600 -0600 @@ -0,0 +1,29 @@ +/* Simple linker script for use with RiscyPygness + (Pygmy Forth for the ARM) to link the result of assembling + riscy.S + */ + +SECTIONS +{ + /* interrupt vectors start at zero */ + . = 0x0; /* start of flash */ + + .text : { *(.text) } + + /* constant data follows code but still in rom */ + .data : + { + *(.data) + *(.rom) + } + + /* . = 0x40000000; /* start of ram */ + . = 0x40000200; + /* start of ram but leave room for bootloader variables*/ + + .bss : + { + *(.bss) + *(.ram) + } +} diff -uNr riscy.orig/makefile riscy/makefile --- riscy.orig/makefile 2005-01-08 14:31:37.000000000 -0700 +++ riscy/makefile 2007-06-09 01:05:05.348662400 -0600 @@ -1,3 +1,7 @@ +# Cygwin note: files named .S must be renamed .asm before attempting build +# (since Windows doesn't know the difference between .s and .S) +# Also: to avoid problems with spaces in filenames, do: +# ln -s /cygdrive/c/Program\ Files/Coridium /usr/local/coridium # Quick reference: # Given a rule such as %.o: %.S which says how to make # the target object file (e.g. led1.o) from a preprocessable @@ -6,6 +10,9 @@ # $@ is the target file (e.g. led1.o) # $< is the source file (e.g. led1.S) +ARMTOOLS := /usr/local/coridium +#ARMTOOLS := /opt/ecos/gnutools/arm-elf + # Following line prevents make from deleting these intermediate files .PRECIOUS: %.o %.hex %.bin %.elf @@ -24,23 +31,30 @@ #LNKFLAGS = --verbose #LNKFLAGS = -Tlpc2106.ld -nostartfiles -Lgcc -L. -LNKFLAGS = -v -T lpc2106.ld -nostartfiles +LNKFLAGS = -v -T lpc2103.ld -nostartfiles -# Create an object file (*.o) by preprocessing an *.S file +# Create an object file (*.o) by preprocessing an *.S (or .asm) file # to create an assembly file (*.s) then assembling it. # Option -E says to preprocess only. -%.o: %.S - arm-elf-gcc -E -o $*.s $< - arm-elf-as $(ASMFLAGS) -ahls=$*.lst -o $@ $*.s + +%.as: %.asm # fix assembly file so gcc doesn't think it's a linker file + sed 's/@/#/g' $< > $@ + +%.s: %.as + $(ARMTOOLS)/bin/arm-elf-gcc -E -o $@ $< + +%.o: %.s $(ARMTOOLS)/bin/arm-elf-as + $(ARMTOOLS)/bin/arm-elf-as $(ASMFLAGS) -ahls=$*.lst -o $@ $*.s %.hex: %.bin - arm-elf-objcopy --input-target binary --output-target ihex $< $*.hex + $(ARMTOOLS)/bin/arm-elf-objcopy --input-target binary \ + --output-target ihex $< $*.hex -%.elf: %.o +%.elf: %.o $(ARMTOOLS)/bin/arm-elf-ld lpc2103.ld @ echo "...linking $@" - arm-elf-ld $(LNKFLAGS) -o $@ $< - arm-elf-objdump -h $@ > $*.lnkh - arm-elf-objdump -t $@ > $*.lnkt + $(ARMTOOLS)/bin/arm-elf-ld $(LNKFLAGS) -o $@ $< + $(ARMTOOLS)/bin/arm-elf-objdump -h $@ > $*.lnkh + $(ARMTOOLS)/bin/arm-elf-objdump -t $@ > $*.lnkt %.dl: %.hex lpc21isp -hex $< /dev/ttyS0 115200 14746 @@ -52,3 +66,14 @@ combo9600: lpc21isp -bin combo9600.bin /dev/ttyS0 9600 14746 +# make Cygwin links to tools where necessary +$(ARMTOOLS)/bin/arm-elf-%: $(ARMTOOLS)/arm-elf/bin/%.exe + ln -s $< $@ +lpc2103.ld: lpc2106.ld + cp $< $@ +combo.hex: arm.lisp + clisp arm +armmite: combo.hex + $(ARMTOOLS)/bin/load21xx 2103 $< com4 +ide: + cd $(ARMTOOLS)/bin && MakeItC & diff -uNr riscy.orig/prim.lisp riscy/prim.lisp --- riscy.orig/prim.lisp 2005-01-03 13:25:15.000000000 -0700 +++ riscy/prim.lisp 2007-06-08 21:07:36.730155200 -0600 @@ -158,8 +158,10 @@ ;; actual Forth words not appear in this list. However, the list does ;; not need to be complete and it does not hurt of junk words are in ;; the list. - '( "mstk" "pin_init" "dstk" "rstk" "foreground" + '( "mstk" "pin_init" "dstk" "rstk" "foreground" "delay" "crlf" "delayQ" "nxtTab" "token" + "_etext" "_bss_start" + ".text" ".bss" ; should these be here? "nxtexec" "FTOKENS" "RTOKENS" "jump_to_IAP" "fast" "slow" "endOfDictionary" "prim_cutoff" "FNAMES" "dstklimit" "rstklimit" "mstklimit" "RNAMES" "freeRAM")) @@ -251,16 +253,21 @@ (primitive-position -1) ; so first usage with #'incf (high-level-position -1)) ; will give zero (dolist (lab *raw-labels*) + (format t "processing raw label: ~A~%" lab) (unless (member (car lab) *non-forth-word-labels* :test #'equal) + (format t "assigning label to address~%") (let ((name (assembler-label-to-forth-word (car lab))) (address (cdr lab))) + (format t "assigned label to address~%") (if (< address cutoff) - (push ; then it a primitive + ; then it a primitive + (push (make-instance 'label :name name :address address :primitive t :flash t :position (incf primitive-position)) *flash-labels*) - (push ; then it not a primitive + ; then it not a primitive + (push (make-instance 'label :name name :address address :primitive nil :flash t :position (incf high-level-position))