GFHumiston@Hotmail.com
Posts: 1
Joined: Tue Dec 27, 2011 4:21 am

Re: FORTH Language for RPi ?

Tue May 01, 2012 3:03 am

Is anyone aware of a FORTH Language distro in the works for RPi ?

GFHumiston@Hotmail.com

User avatar
jbeale
Posts: 3754
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: FORTH Language for RPi ?

Tue May 01, 2012 3:38 am

Not aware of anything specifically for RasPi yet, but I don't see any problem with porting one of the many freely-available versions. Also, there are some Java and JavaScript based Forths which (AFAIK) would not require porting at all. See:

http://www.forth.org/compilers.html


User avatar
gordon@drogon.net
Posts: 2023
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: FORTH Language for RPi ?

Tue May 01, 2012 9:31 am

Well there's GForth for a start - a standard package in Debian - many others, I'm sure.

And not a Pi, but cheaper is the Fignition board - amazing. I saw it being demoed by its creator at the weekend - outputs to composite video done entirely in software on an 8-bit Amel microcontroller.

ok - after sudo apt-get install gforth:gordon @ dot: gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
1 2 3 * + . 7 ok
: hi ." Hello, world" ; ok
hi Hello, world ok


So there you are - just remember, its running bog-standard (Debian) Linux, so if there's a package for it, then it's almost certian it'll run on the Raspberry Pi. (Although it's not a dedicated Forth "distro" as such)

Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: FORTH Language for RPi ?

Tue May 01, 2012 9:38 am

If you wanted an actual distribution -- ie a standalone Forth environment, then the hard part would be writing the USB and SD card drivers. Those will not exist for any existing Forth distribution and you will probably have to use the Linux drivers as the sole documentation. Porting Forth is trivially easy in comparision.

If all you want is the Forth language running under Linux, then see above.

User avatar
cheery
Posts: 219
Joined: Wed Jan 25, 2012 9:39 pm

Re: FORTH Language for RPi ?

Tue May 01, 2012 2:58 pm

You could roll your own easily, by porting JONESFORTH. Forth is unique of all others due to its simplicity.

Standalone Forth environment isn't far away if you can get one written at all. Find yourself a copy of ARM Architecture Reference Manual, ARM1176ZF-S Technical Reference Manual, and BCM2835 ARM Peripherals.

Have seen the kernel.img in the SD card image? On bootup it'll be loaded into the address 0x00000000. The image starts with an exception vector table (0x00-0x20). Fill the vector table with branches into correct handlers.0x00 Reset
0x04 Undefined Instruction
0x08 Hypervisor Call (Software Interrupt)
0x0C Prefetch Abort
0x10 Data Abort
0x14 Hyp Trap? (not sure what this is)
0x18 IRQ interrupt
0x1C FIQ interrupt

...the hard part would be writing the USB and SD card drivers...


You won't necessarily need those for a toy implementation. And I guess it's same problem for writing any standalone running thing for raspberry.

pablooliveira
Posts: 1
Joined: Thu Feb 21, 2013 1:03 pm

Re: FORTH Language for RPi ?

Thu Feb 21, 2013 1:12 pm

Sorry to resurrect such an old topic. But my Embedded System's students ported this semester Jones Forth to Raspberry PI. Their port is available at https://github.com/M2IHP13-admin/JonesForth-arm and seems pretty stable.

The port uses the linux new EABI for input/output, but it could be a fun project to make a bare-metal standalone version in Raspberry-PI :)

Pablo.

skiddaw
Posts: 9
Joined: Sat Oct 29, 2011 6:19 pm

Re: FORTH Language for RPi ?

Fri Mar 01, 2013 1:59 am

I've just had printed the 4tH Forth 'compiler' by J.L Bezemer, better known as The Beez: http://thebeez.home.xs4all.nl/4tH/
Google group: https://groups.google.com/forum/?fromgr ... h-compiler
I do have 4tH running on a 'Pi but as yet I'm still struggling with the installation. 4tH is a COMPILER but it will work interactively.
I'm also interested in the GPIO c-libraries such as http://abyz.co.uk/rpi/pigpio/pigpio-v1.tar but I'm a ways from getting anything talking, if at all. I was quite elated when the 'Pi went online and also found My Book network drive.

arieverbeek
Posts: 15
Joined: Mon Jan 28, 2013 2:40 pm
Location: Houten The Netherlands

Re: FORTH Language for RPi ?

Sun Mar 03, 2013 6:49 pm

Hello,

I'am using Gforth with GPIO libraries which you can find here : https://github.com/harrypower/Rpi_Gforth_GPIO.
It has also a assembler/disassembler for arm.
The only trouble I have with the assembler and the Forth is you can only access the virtual memory, so you need the c-libraries for GPIO-access.
A question I have is is there a way to access the GPIO register direct from Forth?

Bye,
Arie

mmi
Posts: 85
Joined: Sun Feb 24, 2013 3:53 am
Location: Bavaria-Germany

Re: FORTH Language for RPi ?

Thu Mar 14, 2013 4:14 am

I think the easiest way to access the GPIO ports from *any* program language is to use the kernels "export", "unexport" interface in the "/sys/class/gpio" directory. It should be accessable by normal file operations also in Forth.

I currently don't have a link, but there is at least one example written in c somewhere - so you can see how it works in detail. And there should be a way to get access to GPIO not only by root. But for very fast GPIO operations (like pwm)
another solution has to be found.

good luck!

8thdev
Posts: 26
Joined: Fri Jul 31, 2015 2:23 pm
Contact: Website Twitter

Re: FORTH Language for RPi ?

Mon Nov 09, 2015 6:03 am

Just to answer the OP: "8th" supports the RPi as well as desktop and mobile systems.

StephenPelc
Posts: 1
Joined: Wed Dec 02, 2020 8:27 am

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 8:34 am

VFX Forth for ARM Linux runs on all Pis from Zero to 4B. GPIO access code is provided. VFX Forth is free of charge for non-commercial use. You can get it from
http://www.mpeforth.com

User avatar
PeterO
Posts: 6095
Joined: Sun Jul 22, 2012 4:14 pm

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 2:04 pm

Five year necro AND a broken link for a first post ! :(
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 28358
Joined: Sat Jul 30, 2011 7:41 pm

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 2:19 pm

Fixed the link, and post is valid even if late!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
karrika
Posts: 1312
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 3:43 pm

VFX Forth with graphics libraries...

Writing Forth is fun. Reading code written by someone else - not so.

Imho this is a write-only language. Documentation was not the strong side of Forth.

If I remember correctly they used Forth on some satellites. Uploading code to run is extremely sparse as you compile it on the fly. The technique of "threaded interpretive languages" is also interesting reading for anybody interested in the development of programming languages.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13675
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 3:50 pm

Forth was one of the first languages that early computer hobbyists could run on their home-brew systems, as they could write their own implementation of it. FIG-FORTH was an alternative to "tiny basic", and was extensively documented.

blippy
Posts: 123
Joined: Fri Nov 03, 2017 3:07 pm

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 5:30 pm

I had been toying with a Forth here:
https://github.com/blippy/circle/tree/m ... /m01-forth

It is a very numpty implementation so far. Still, Forth on "bare metal", not bad. Actually, it is a fork of rst's excellent Circle OS, with a forth project that I added.

Code: Select all

forth.cpp 
is just a link in that repo for my testing purposes, but if anyone is interested, I could re-instate the file properly.

I haven't done a complete retest to ensure that it works, but I am fairly confident that it should compile and run fine.

User avatar
karrika
Posts: 1312
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 6:16 pm

mahjongg wrote:
Wed Dec 02, 2020 3:50 pm
Forth was one of the first languages that early computer hobbyists could run on their home-brew systems, as they could write their own implementation of it. FIG-FORTH was an alternative to "tiny basic", and was extensively documented.
Lol. My masters thesis was to write a multi-processor OS entirely in Forth. It consisted of a 16 bit 8086 as a database master and a few Z80 processors running on slices on the 8086 address space. This may have been around 1978 I believe.

If I would look at the code today there is no chance that I could fix anything in it. Perhaps the language was well documented. But once you start to develop your own operations in it it kind of starts to grow.

blippy
Posts: 123
Joined: Fri Nov 03, 2017 3:07 pm

Re: FORTH Language for RPi ?

Wed Dec 02, 2020 7:18 pm

karrika wrote:
Wed Dec 02, 2020 6:16 pm
My masters thesis was to write a multi-processor OS entirely in Forth. It consisted of a 16 bit 8086 as a database master and a few Z80 processors running on slices on the 8086 address space.
That sounds like quite an ambitious project for a masters (MPhil, I take it?).

Return to “Other programming languages”