Forth Lesson 22

From OLPC
Jump to navigation Jump to search
Mitch Bradley's Forth and
Open Firmware Lessons:

Using Forth Under Linux

You can run Forth under Linux and use it to inspect I/O devices.

On XO-1.75

Get http://dev.laptop.org/~wmb/armforth, http://dev.laptop.org/~wmb/armtools.dic, and http://dev.laptop.org/~wmb/mmap.fth . Copy them into your home directory on an XO-1.75 .

Then do:

 $ sudo -s
 # ./armforth armtools.dic mmap.fth -
 ok

Now you can use mmap to get access to I/O devices.

 ok hex
 ok d4019000 1000 mmap  constant gpio-base
 ok gpio-base 154 + l@ .

For pinmux (MFPR) access:

 ok d401e000 1000 mmap  constant mfpr-base
 ok mfpr-base 2b8 + l@ .