gertboard gforth interface

Here is a gforth interface for the gertboard functions from element14.com/ gertboard_sw_20130106.zip.
The gertboard functions must be installed as a library first:

Download gb.tar.gz

  tar zxvf gb.tar.gz
  cd gb
  make
  sudo make install
Installed files are /usr/local/lib/libgb.so and /usr/local/include/gb.h.
Version 01 defines gforth interfaces for all of the functions in gb_common.c, gb_pwm.c, and gb_spi.c, with gforth names like ggb_setup_io corresponding to the C function name setup_io. gforth words are also defined to retrieve the base addresses of the peripheral registers: ggb_gpio, ggb_pwm, ggb_clk, ggb_spi0, ggb_uart; and to access some gertboard macros: ggb_INP_GPIO, ggb_OUT_GPIO, ggb_SET_GPIO_ALT.

Installation (creates /usr/local/lib/libggb.so, /usr/local/include/ggb.h, and /usr/share/gforth/site-forth/ggb-01.fs):

  tar zxvf ggb-01.tar.gz
  cd ggb-01
  make
  sudo make install
After installation, start gforth as root:
  sudo gforth
  require ggb-01.fs
  ...
The first time you use the ggb-01 library, you may notice a startup delay as gforth will create ggb_01 C and object files in your ~/.gforth/libcc-named/ directory. Thereafter, there will be no startup delay as these files will be used automatically whenever you require ggb-01.fs.

Example using dtoa.fs which provides a dtoa command to test D/A conversion:

  sudo gforth dtoa.fs
  dtoa
ggb-01.tar.gz - download

src - browse files

References:
element14.com
http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ - Gforth Manual
  section 5.25 - C Interface