[openfirmware] r1072 - in cpu/arm: . versatilepb versatilepb/build

svn at openfirmware.info svn at openfirmware.info
Wed Jan 14 10:28:37 CET 2009


Author: wmb
Date: 2009-01-14 10:28:37 +0100 (Wed, 14 Jan 2009)
New Revision: 1072

Added:
   cpu/arm/pl011-diaguart.fth
   cpu/arm/versatilepb/
   cpu/arm/versatilepb/build/
   cpu/arm/versatilepb/build/Makefile
   cpu/arm/versatilepb/qemubase.bth
Modified:
   cpu/arm/saverom.fth
Log:
ARM - Added rudimentary OFW build for QEMU emulation of ARM VersatilePB board.


Added: cpu/arm/pl011-diaguart.fth
===================================================================
--- cpu/arm/pl011-diaguart.fth	                        (rev 0)
+++ cpu/arm/pl011-diaguart.fth	2009-01-14 09:28:37 UTC (rev 1072)
@@ -0,0 +1,12 @@
+
+: inituarts  ( -- )  ;
+
+: ukey?  ( -- flag )  uart-base h# 18 + l@  h# 10 and  0=  ;
+: ukey  ( -- char )
+   begin  ukey?  until
+   uart-base l@  h# ff and
+;
+: uemit  ( char -- )
+   begin  uart-base h# 18 + l@  h# 20 and  0=  until
+   uart-base l!
+;

Modified: cpu/arm/saverom.fth
===================================================================
--- cpu/arm/saverom.fth	2009-01-13 20:16:46 UTC (rev 1071)
+++ cpu/arm/saverom.fth	2009-01-14 09:28:37 UTC (rev 1072)
@@ -2,8 +2,8 @@
 \ See license at end of file
 
 \ Save an image of the target system in a file.
-: save-rom  ( str -- )
-   >r
+: $save-rom  ( filename$ -- )
+   2>r
    make-arm-header
 
    \ Turn off the relocation bitmap maintainer
@@ -14,7 +14,7 @@
    " stand-init-io" $find-name is init-io
    " stand-init"    init-save
 
-   aif-header  h# 80  r>  save-image
+   aif-header  h# 80  2r>  $save-image
 ;
 
 \ LICENSE_BEGIN

Added: cpu/arm/versatilepb/build/Makefile
===================================================================
--- cpu/arm/versatilepb/build/Makefile	                        (rev 0)
+++ cpu/arm/versatilepb/build/Makefile	2009-01-14 09:28:37 UTC (rev 1072)
@@ -0,0 +1,28 @@
+OS := $(shell uname)
+
+BASEDIR= `(cd ../../../..; pwd;)`
+CLIENTDIR=../../../../clients
+CLIENTPROGS=
+
+all: qemubase.rom
+
+qemubase.rom: FORCE build ${CLIENTPROGS}
+	./build $@
+
+../../${OS}/forth:
+	@make -C ../../${OS} forth
+
+../../build/inflate.bin:
+	@make -C ../../build inflate.bin
+
+build: ../../${OS}/forth
+	@ln -sf ../../${OS}/forth build
+
+clean:
+	rm -f *.dic *.log headers *~ *.elf *.di *.img builton.fth build *.rom *.version
+
+clean-all: clean
+	@make -C ../../build clean
+	@make -C ../../${OS} clean
+
+.PHONY: FORCE clean all clean-all

Added: cpu/arm/versatilepb/qemubase.bth
===================================================================
--- cpu/arm/versatilepb/qemubase.bth	                        (rev 0)
+++ cpu/arm/versatilepb/qemubase.bth	2009-01-14 09:28:37 UTC (rev 1072)
@@ -0,0 +1,94 @@
+purpose: Load file for OFW on ARM VersatilePB as emulated by QEMU
+\ See license at end of file
+
+\ Example QEMU command line:
+\   qemu-system-arm -M versatilepb -m 32 -kernel qemubase.rom -serial vc
+\ Then type "Ctrl-Alt 3" in the QEMU popup window to get the serial console
+\ The memory size (32 shown above) is not critical - 16 or greater works.
+
+dictionary: ${BP}/cpu/arm/build/basefw.dic
+command: &armforth &dictionary &this
+build-now
+
+\ ' $report-name is include-hook
+
+
+h# 8.0000 constant initial-heap-size
+
+: (initial-heap)  ( -- adr len )   limit  initial-heap-size  ;
+' (initial-heap) to initial-heap
+
+
+h# 101f1000 constant uart-base  \ UART0 base address on VersatilePB board
+
+fload ${BP}/cpu/arm/pl011-diaguart.fth	\ PL011 UART
+
+\ Setup the console I/O vectors for a simple UART
+: install-uart-io  ( -- )
+   inituarts
+
+   ['] lf-pstr          is newline-pstring
+   ['] ukey?            is key?
+   ['] ukey             is (key
+   ['] uemit            is (emit
+   ['] default-type     is (type
+   ['] emit1            is emit
+   ['] type1            is type
+   ['] crlf             is cr
+   ['] true             is (interactive?
+   ['] cancel           is light
+;
+
+\ Install the simple UART driver from the standalone I/O init chain
+: stand-init-io  ( -- )
+   stand-init-io
+   install-uart-io
+;
+
+\ This is some glue code to convert the machine setup that QEMU gives us
+\ to the setup that start-forth (see arm/boot.fth) wants.
+\ We get here via a call instruction at origin+8, which is inserted below
+
+code stand-cold-code    ( r0: 0  r1: board-id  r2: &kernel-args  lr: &aif_header+8c )
+   here  origin 8 +  put-call  \ Insert call instruction
+
+   \ Put the arguments in safe registers
+   sub   r6,lr,#0x8c        \ r6 points to header (lr set by code at origin)
+   mov   r7,#0              \ r7: functions
+   ldr   r8,[r2,#0x1c]      \ r8: memtop  - From Linux kernel args set by QEMU
+                            \  r9 is up
+   mov   r10,#0             \ r10: argc
+   mov   r11,r2             \ r11: argv (kernel args)
+   mov   r12,`initial-heap-size`  \ r12: initial-heap-size
+
+   b     'code start-forth  \ Branch to the generic startup code
+end-code
+
+
+fload ${BP}/cpu/arm/saverom.fth  \ Save the dictionary for standalone startup
+
+.( --- Saving qemubase.rom --- )  cr " qemubase.rom" $save-rom
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2009 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




More information about the openfirmware mailing list