avrforth

overview

avrforth is a 16-bit subroutine threaded forth kernel for atmel's avr series of microcontrollers. Current development is done for the at90can128 (my cansynth board, to be exact), but it will run on most any mega device with minimal adjustments.

avrforth borrows some ideas from Terry Loveall's 4word. It is a colorless colorforth. The interpreter only interprets. Words must be compiled explicitly using the ] operator. Numeric input is handled by $, which parses the next word as a hexidecimal number.

avrforth uses null-terminated strings internally against tradition. I may switch to counted strings if they prove easier to deal with.

avrforth supports using the entire 128k instruction address space of the atmega128 and at90can128 for code.

avrforth has an interactive interpreter. It interprets input from the uart and compiles directly to flash. avrforth does not require separate memory to store program tokens.

avrforth has an integrated assembler. Assembly code words can be added without recompiling the kernel.

avrforth is public domain.

requirements

You need a host forth system to assemble avrforth. Development is done with gforth. You also need a utility to program the flash and a terminal program to communicate with the kernel through the avr's uart. I use avrdude and picocom for those tasks.

installation

a quick run through...

edit configuration options Configure the target device, programmer, and programmer port in makefile. Edit the options in config.f. assemble make should be enough here. upload kernel make upload upload highlevel words send blocks/core.f to the target device using the terminal program of your choice. In order to give avrforth enough time to program the flash, set your terminal program to pause after each line until it receives a newline back. 'make highlevel' will send all blocks.

Now you can send more program code or type commands interactively at the console.

documentation

Documentation has been pretty sparse but is getting better. Email me if there is anything in particular you need to know about.

control control structures

task management

usart serial port

adc a/d converter

spi serial peripheral interface

can controller area network

twi two wire serial interface

timer 8bit and 16bit timers

xmem external memory

pll usb pll

usb core usb controller

usb-device device mode usb functions

download