 | Today I uploaded a much improved version of Riscy Pygness, the 32-bit Pygmy Forth for the ARM.
I received some good feedback on the previous version from several beta (well, perhaps alpha) testers, mainly in New Zealand and Germany. Thank you! I'm looking forward to further feedback on this new version.
The threading model has changed slightly, but still uses 16-bit tokens, and thus is very compact. It now runs interactively from any serial terminal, rather than requiring a special interpreter/terminal on the host. The dictionary can be extended interactively into RAM.
It is ColorForth-like in several ways, such as allowing multiple entry points in a word, changing tail calls into jumps (i.e. optimizing out the EXIT (i.e. ";") where possible, and simple recursion, e.g.
( Example of two entry points ) : 10STARS ( -) 10 : STARS ( # -) FOR STAR NEXT ;
( The exit is merged into AAA by changing the call into a jump) ( Ditto for BBB.) : XXX ... IF AAA ; THEN BBB ;
( Same for recursion ) : YYY ... IF ... ; THEN YYY ;
It runs on the Philips LPC2106 and similar ARM chips systems, such as the $60 Olimex board. I believe it will run on the New Micros Inc. tinyARM board, but I haven't tried it there yet. It should either "just run" on other members of the Philips LPC family of ARM chips, or require only minor changes, and should be easy to port to other ARM chips.
Below is the blurb I posted to the LPC list, with further details and links to the files.
--------------- Today I uploaded the newest version of Riscy Pygness (Pygmy Forth for the ARM) to
http://pygmy.utoh.org/riscy/
the file riscy2-20050108-1856.zip contains the full source code and also several binaries in Intel Hex format. Two of the hex files are available for separate download if you would rather take a quick look:
combo.hex (for a 14.7456 MHz LPC2106, e.g. the Olimex board, 115200 bps)
combotiny.hex (for a 10 MHz LPC2106, e.g. New Micros tinyARM, 9600 bps)
I run with the Olimex board and haven't tried the New Micros board yet. If you try it, please let me know how (and whether) it works.
This version runs from any serial terminal. The heads are stored on the target. The dictionary can be extended interactively into RAM.
If you have an LPC2106 board running at 14.7456 MHz (or probably at 10 MHz) you should be able to run the Forth interactively just by burning the hex file into the ARM and connecting a serial terminal to the first serial port. When it boots it says "Hi". Pressing Enter should make it respond with " ok". Typing
1 3 + .
Should print out 4
See the source code for all the words it knows.
The primitives are assembled using the Gnu ARM tool chain, which culminates in the file riscy.bin. So, if you want to change the primitives, you would need access to the Gnu tool chain.
The high-level Forth is compiled and merged with riscy.bin to produced combo.bin and combo.hex ready for downloading into the ARM. The compiler is written in Common Lisp. I use CLISP on Linux, but any Common Lisp should work with, at most, minor changes, either on Linux or Windows. The main load file is arm.lisp, which is very easy to read and/or modify, just look for the lines such as
(forth-compile-file "lpc.forth") (forth-compile-file "riscy.forth") Included with it is source code for
accessing MMC and SD flash disks (in SPI mode), including FAT16,
using the IAP routines to reprogram LPC flash,
multitasking
The license is MIT/BSD style so you are free to use it in any sort of project.
The threading model has changed somewhat compared to the previous version. Previously, code was limited to flash (i.e. the first 128 K bytes of address space). Now code anywhere in the 32-bit address space can be executed. This lets it compile interactively into RAM and also makes it easy to port to other ARM chips regardless of their memory maps. The "tokens" still take just 16 bits each, so a *lot* of code fits into the LPC flash.
So, to summarize,
to take a quick look, burn the hex file into the target and connect a serial terminal at the correct baud rate
to modify the high-level Forth (but use the existing primitives), install some sort of Common Lisp and edit arm.lisp to include the Forth files you want to compile.
to change even the primitives, install the Gnu ARM tool chain.
to use it as inspiration for MMC or SD or the IAP routines, for use with C or assembly, download the source code and read it. I'll be glad to try to answer questions if Forth is a foreign language.
The main web site leads to a Swiki (a Wiki that you are welcome to use to post comments, corrections, questions, etc.). It is read only by default, but you can log in with the name 'forth' and the password 'fourth' to have full access. If that login information changes, please email me and I'll send you the new login information.
-- Frank http://pygmy.utoh.org
|
|