Forth on the arduino?

I am interested in learning forth as part of learning electronics and physical computing. I don't know much about it as of yet but I was wondering if anyone has run a forth such as amforth (http://amforth.sourceforge.net/) on the arduino. If no-one has, as I suspect, maybe someone could think briefly about how it might be done/why it's impossible/undesirable etc. I'm guessing that the biggest issue will be the bootloader code but like I say I'm a beginner so what do I know.

Thanks,
Charlieb

AMforth claims that it overwrites any bootloader. :frowning: Also, it's written in the Atmel assembler, which is NOT compatible with the gnu assembler (avr-as) that comes with arduino (all hidden deep in the tools.)

I would think it would be pretty easy to implement SOME forth that ran on the arduino hardware (which is not so complex as to place many limits on what software can run.) Getting something that works within the arduino SW environment would be a bit tougher.

Well that's a shame. I also found this one: http://claymore.engineer.gvsu.edu/~steriana/Software/pfavr/index.html. I am familiar enough with the arduino software (i.e. the Makefile) that I could probably upload it's hex or compile it from scratch but I am a little scared that it'll eat the bootloader since it doesn't say anything about it and I'm definitelly not familiar enough with the arduino to be programming it with a new bootloader.

PFAVR says that it requires, "13Kwords of FLASH and less than 32Kbytes of RAM" and that the, "ATmega64 and ATmega128 are really the only devices supported." I don't know if that's too much but if not perhaps it's a decent option.

I'm not concerned with being able to use the arduino gui since I don't anyway but it would be nice for it to support forth as well at some point for educational purposes since I hear forth is easier to learn than C (unless you already know C in which case it is a little alien to say the least!).

Sorry for my newbishness hopefully I'll be able to contribute something useful in the near future.

Cheers,
Charlieb

I am a little scared that it'll eat the bootloader since it doesn't say anything about it and I'm definitelly not familiar enough with the arduino to be programming it with a new bootloader.

My understanding is if you're only using a standard Arduino board and USB/serial connection you can't overwrite the bootloader because that would require an ISP programmer (and I think there's lock bits or fuses involved somewhere as well.).

PFAVR says that it requires, "13Kwords of FLASH and less than 32Kbytes of RAM" and that the, "ATmega64 and ATmega128 are really the only devices supported." I don't know if that's too much but if not perhaps it's a decent option.

I almost got caught out while reading this spec, but notice it says "13kwords" of Flash not bytes--therefore this definitely won't run on a ATMega168 (or the even lower specced ATMega8) because it only has 14 KiloBytes of Flash available (allowing for the bootloader) and 1 KiloBytes of RAM.

Sorry for my newbishness

No need to apologise, we've all got to start somewhere, and at least you're not asking us to do all your work for you. :slight_smile:

You probably want to look at the Arduino specification pages for the board variation you're using so you can check it against the requirements for any other Forth implementations you find.

--Phil.

Right you are. I was confusing the ATmega168 with the ATmega128 which have quite different specs it would seem. I guess I'll have to write my own at some point if I really want to use a forth on the arduino. That should be an interesting project to see if I can make it teeny enough.

Thanks for your help,
Charlieb

Bah. I guess I have to make one post without a link before I can post the link that's relevant here. Anyway, the amforth author has commented on the issue in the amforth forums.

I think it would be incredibly cool for FORTH to be able to run on the Arduino, given FORTH's deep history in embedded systems and its very hackable qualities.

The amforth author comments on the possibilities for FORTH on the Arduino:

http://objectmix.com/forth/385440-forth-arduino.html

Most to the point, a change to the Arduino bootloader might enable amforth to be used.