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

svn at openfirmware.info svn at openfirmware.info
Fri Jan 16 10:06:43 CET 2009


Author: wmb
Date: 2009-01-16 10:06:43 +0100 (Fri, 16 Jan 2009)
New Revision: 1073

Modified:
   cpu/arm/basefw.bth
   cpu/arm/build/
   cpu/arm/pl011-diaguart.fth
   cpu/arm/tools.bth
   cpu/arm/versatilepb/build/
   cpu/arm/versatilepb/build/Makefile
   cpu/arm/versatilepb/qemubase.bth
Log:
ARM - improved the build scaffolding by adding tag file generation and fixing
a bug in the .bth files that caused build failures in some environments, and
added UART initialization code for the PL011 diagnostic UART driver.


Modified: cpu/arm/basefw.bth
===================================================================
--- cpu/arm/basefw.bth	2009-01-14 09:28:37 UTC (rev 1072)
+++ cpu/arm/basefw.bth	2009-01-16 09:06:43 UTC (rev 1073)
@@ -5,8 +5,10 @@
 command: &armforth &dictionary &this
 build-now
 
-\ ' $report-name is include-hook
+" basefw.tag" r/w create-file drop  tag-file !
 
+\  ' $report-name is include-hook
+
 create include-help			\ Include help facility
 
 alias cfill fill
@@ -79,6 +81,10 @@
 [then]
 
 [ifndef] no-heads
+resident   dispose   0 0 set-transize   \ true is suppress-transient
+
+tag-file @ fclose  tag-file off
+
 .( --- Saving basefw.dic --- )  cr " basefw.dic" $save-forth
 [then]
 


Property changes on: cpu/arm/build
___________________________________________________________________
Modified: svn:ignore
   - armbuild
build

   + armbuild
build
*.tag


Modified: cpu/arm/pl011-diaguart.fth
===================================================================
--- cpu/arm/pl011-diaguart.fth	2009-01-14 09:28:37 UTC (rev 1072)
+++ cpu/arm/pl011-diaguart.fth	2009-01-16 09:06:43 UTC (rev 1073)
@@ -1,12 +1,68 @@
+purpose: Diagnostic console driver for ARM PL011 PrimeCell UART
 
-: inituarts  ( -- )  ;
+\ The following value is correct for UART0 on the VersatilePB board
+\ Override the value after loading this file for different boards
+h# 101f1000 value pl011-base
 
-: ukey?  ( -- flag )  uart-base h# 18 + l@  h# 10 and  0=  ;
+d# 7372800 value uartclk  \ Override as necessary
+d# 115200 value diaguart-baud
+
+: pl011@  ( offset -- value )  pl011-base + l@  ;
+: pl011!  ( value offset -- )  pl011-base + l!  ;
+
+: pl011-set-baud  ( baud -- )
+   d# 16 *                   ( 16xbaud )
+
+   uartclk over /mod         ( 16xbaud rem quot )
+   h# 24 pl011!              ( rem r: 16xbaud )
+
+   \ The fractional divisor goes from 0 to 63.  We rescale the
+   \ remainder so the implied denominator is 64, with rounding.
+   d# 128 rot */ 1+ 2/       ( frac r: 16xbaud )
+   h# 28 pl011!              ( )
+;
+: init-pl011  ( -- )
+   h#   0 h# 30 pl011!  \ Disable while programming
+   0          4 pl011!  \ Clear errors
+   0      h# 48 pl011!  \ Disable DMA
+   0      h# 38 pl011!  \ Clear interrupt mask bits
+   h# 7ff h# 44 pl011!  \ Clear pending interrupts
+   diaguart-baud pl011-set-baud
+   h#  70 h# 2c pl011!  \ 8 bits, FIFOs enabled, no parity
+   h# f01 h# 30 pl011!  \ RTS, DTR, RXE, TXE, UARTEN (re-enable)
+;
+
+: ukey?  ( -- flag )  h# 18 pl011@  h# 10 and  0=  ;
 : ukey  ( -- char )
    begin  ukey?  until
-   uart-base l@  h# ff and
+   0 pl011@  h# ff and
 ;
 : uemit  ( char -- )
-   begin  uart-base h# 18 + l@  h# 20 and  0=  until
-   uart-base l!
+   begin  h# 18  pl011@  h# 20 and  0=  until
+   0 pl011!
 ;
+
+
+\ 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

Modified: cpu/arm/tools.bth
===================================================================
--- cpu/arm/tools.bth	2009-01-14 09:28:37 UTC (rev 1072)
+++ cpu/arm/tools.bth	2009-01-16 09:06:43 UTC (rev 1073)
@@ -9,6 +9,8 @@
 \ ' noop is include-hook
 \ : rn  (cr 2dup type 15 spaces  ;  ' rn is include-hook
 
+" tools.tag" r/w create-file drop  tag-file !
+
 fload ${BP}/forth/lib/fwsetup.fth
 
 transient
@@ -19,6 +21,10 @@
 fload ${BP}/cpu/arm/loadmach.fth  \ CPU and OS-specific extensions
 
 [ifndef] no-heads
+resident   dispose   0 0 set-transize   \ true is suppress-transient
+
+tag-file @ fclose  tag-file off
+
 .( --- Saving tools.dic --- )  " tools.dic" $save-forth cr
 [then]
 


Property changes on: cpu/arm/versatilepb/build
___________________________________________________________________
Added: svn:ignore
   + *.rom
*.tag
tags
core
build


Modified: cpu/arm/versatilepb/build/Makefile
===================================================================
--- cpu/arm/versatilepb/build/Makefile	2009-01-14 09:28:37 UTC (rev 1072)
+++ cpu/arm/versatilepb/build/Makefile	2009-01-16 09:06:43 UTC (rev 1073)
@@ -1,11 +1,17 @@
 OS := $(shell uname)
 
 BASEDIR= `(cd ../../../..; pwd;)`
+TAGFILES= ../../build/*.tag *.tag
 CLIENTDIR=../../../../clients
 CLIENTPROGS=
 
-all: qemubase.rom
+all: qemubase.rom tags
 
+qemubase.tag: qemubase.rom
+
+tags: qemubase.tag
+	@${BASEDIR}/forth/lib/toctags ${BASEDIR} ${TAGFILES}
+
 qemubase.rom: FORCE build ${CLIENTPROGS}
 	./build $@
 

Modified: cpu/arm/versatilepb/qemubase.bth
===================================================================
--- cpu/arm/versatilepb/qemubase.bth	2009-01-14 09:28:37 UTC (rev 1072)
+++ cpu/arm/versatilepb/qemubase.bth	2009-01-16 09:06:43 UTC (rev 1073)
@@ -10,39 +10,25 @@
 command: &armforth &dictionary &this
 build-now
 
+" qemubase.tag" r/w create-file drop  tag-file !
+
 \ ' $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
+h# 101f1000 to pl011-base  \ UART0 base address on VersatilePB board
 
-\ Setup the console I/O vectors for a simple UART
-: install-uart-io  ( -- )
-   inituarts
+fload ${BP}/forth/lib/sysuart.fth	\ Set console I/O vectors to UART
 
-   ['] 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
+   init-pl011  install-uart-io
 ;
 
 \ This is some glue code to convert the machine setup that QEMU gives us
@@ -65,6 +51,8 @@
 end-code
 
 
+tag-file @ fclose  tag-file off
+
 fload ${BP}/cpu/arm/saverom.fth  \ Save the dictionary for standalone startup
 
 .( --- Saving qemubase.rom --- )  cr " qemubase.rom" $save-rom




More information about the openfirmware mailing list