Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tiny Forth on microcontroller

520 views
Skip to first unread message

Jean-Marc Delaplace

unread,
Feb 23, 2011, 5:02:12 PM2/23/11
to
Hi,
I am looking for a tiny implementation of Forth written in ANSI C and
that can run on a 16-bit microcontroller XC164 (C166/ST10-like).
I need a 16-bit word length, and a basic word set to allow programming
short sequences (about 1 block long) with minimal memory requirement.
I have tried MinForth that is close to my need but written for
computers, and that would require some work to port to a microcontroller
without an OS but with a basic cooperative multitasking kernel.
Do anyone have clue?
Thanks
Jean-Marc Delaplace

Charles Turner

unread,
Feb 23, 2011, 5:11:56 PM2/23/11
to
On 2011-02-23 17:02:12 -0500, Jean-Marc Delaplace said:

> I am looking for a tiny implementation of Forth written in ANSI C and
> that can run on a 16-bit microcontroller XC164 (C166/ST10-like).

How about pForth?

<http://www.softsynth.com/pforth/>


Jean-Marc Delaplace

unread,
Feb 26, 2011, 1:33:50 PM2/26/11
to
PForth looks interesting indeed, but I see that it requires "a few
hundred k's of RAM". This is too much for my application, where I can
only allocate say 10 kBytes, supposing that the dictionary is compiled
in ROM and the ram is only required for short application programs.
Is it possible to redimension the RAM for my purpose?
JMD

Jean-Marc Delaplace

unread,
Feb 26, 2011, 1:34:09 PM2/26/11
to
PForth looks interesting indeed, but I see that it requires "a few
hundred k's of RAM". This is too much for my application, where I can
only allocate say 10 kBytes, supposing that the dictionary is compiled
in ROM and the ram is only required for short application programs.
Is it possible to redimension the RAM for my purpose?
JMD

On 23 fév, 23:11, Charles Turner <vze26...@optonline.net> wrote:

Charles Turner

unread,
Feb 26, 2011, 4:54:01 PM2/26/11
to
On 2011-02-26 13:33:50 -0500, Jean-Marc Delaplace said:

> PForth looks interesting indeed, but I see that it requires "a few
> hundred k's of RAM". This is too much for my application, where I can
> only allocate say 10 kBytes

I'm guessing the lack of response here means there isn't any Forth
written for that chip. You might want to look at Frank Sargeant's
3-instruction Forth here:

<http://pygmy.utoh.org/forth.html>

or perhaps something like FlashForth for the MicroChip controller could
be a model:

<http://opencircuits.com/Programming_Languages#Forth_for_PICs>

Sounds like you'll be rolling your own.

HTH, Charles

Rod Pemberton

unread,
Feb 26, 2011, 6:40:17 PM2/26/11
to
"Jean-Marc Delaplace" <jeanmarc....@free.fr> wrote in message
news:4d6583e0$0$31605$426a...@news.free.fr...

I'm definately for C versions, but why would you want a C version?

Forth's in assembly are mostly Forth, with a small amount of assembly.
I.e., an "assembly" Forth may be easier to port and bootstrap.


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

If you search for small or tiny Forth's in C, these names come up:

eForth
MinForth
hforth
pforth
kforth
yforth


Rod Pemberton


Frank Sergeant

unread,
Mar 5, 2011, 3:33:14 PM3/5/11
to
Jean-Marc Delaplace <jeanmarc....@free.fr> writes:

> I am looking for a tiny implementation of Forth written in ANSI C and
> that can run on a 16-bit microcontroller XC164 (C166/ST10-like).

Would you consider changing processors?

> I need a 16-bit word length, and a basic word set to allow programming
> short sequences (about 1 block long) with minimal memory requirement.

I suppose a 32-bit word (being a super set of a 16-bit word) would also
be ok?

My current Riscy Pygness (Pygmy Forth for the ARM) runs on both the ARM
instruction set and (now) the ARM Cortex-M3 instruction set. It runs on
the LPC2xxx ARM family and on the LPC17xx and STM32 families of ARM
Cortex M3 chips. It should be easy to port to other ARM and Cortex-M3
families.

It needs less than 4 KB of Flash and very little RAM, yet uses a 32-bit
word and addresses the full 4 GB address space. It includes a
multitasker. So, maybe one size could fit all.


--
Frank
http://pygmy.utoh.org
http://pygmy.utoh.org/riscy

Charles Turner

unread,
Mar 5, 2011, 10:07:15 PM3/5/11
to
Sorry I mispelled your name, Frank!

;-)

Jean-Marc Delaplace

unread,
Mar 6, 2011, 11:56:32 AM3/6/11
to
For the time being I stick on the XE164, but I am considering for the
future moving to ARM. I will then remember Riscy Pygness. Thank you.
So far, I have found Ficl that is exactly designed for what I need,
except I have to do the port myself. I shall investigate.

rickman

unread,
Mar 8, 2011, 9:28:13 AM3/8/11
to
On Mar 6, 11:56 am, Jean-Marc Delaplace <jeanmarc.delapl...@free.fr>
wrote:

> For the time being I stick on the XE164, but I am considering for the
> future moving to ARM. I will then remember Riscy Pygness. Thank you.
> So far, I have found Ficl that is exactly designed for what I need,
> except I have to do the port myself. I shall investigate.
>
> Le 05/03/2011 21:33, Frank Sergeant a crit :
>
> > Jean-Marc Delaplace<jeanmarc.delapl...@free.fr>  writes:

>
> >> I am looking for a tiny implementation of Forth written in ANSI C and
> >> that can run on a 16-bit microcontroller XC164 (C166/ST10-like).
>
> > Would you consider changing processors?
>
> >> I need a 16-bit word length, and a basic word set to allow programming
> >> short sequences (about 1 block long) with minimal memory requirement.
>
> > I suppose a 32-bit word (being a super set of a 16-bit word) would also
> > be ok?
>
> > My current Riscy Pygness (Pygmy Forth for the ARM) runs on both the ARM
> > instruction set and (now) the ARM Cortex-M3 instruction set.  It runs on
> > the LPC2xxx ARM family and on the LPC17xx and STM32 families of ARM
> > Cortex M3 chips.  It should be easy to port to other ARM and Cortex-M3
> > families.
>
> > It needs less than 4 KB of Flash and very little RAM, yet uses a 32-bit
> > word and addresses the full 4 GB address space.  It includes a
> > multitasker.  So, maybe one size could fit all.

I've never been a fan of the proprietary MCUs because they usually
lock you into a single provider for the tools. Of course not all do
that, the Microchip PICs are supported by many tool vendors, for
example. But the ARM CPU chips are supported by nearly every tool
available and will become the mainstay of the future. The CM3 was
developed specifically with embedding in mind and does a great job.
It receives the lions share of vendors development time and money so
that the competing products will become the "poor stepchild".

The only significant issue with switching between CM3 vendors is the
support of peripherals. Each vendor adds their own designs to the core
CPU. It can be more work porting to all the peripherals than changing
the CPU port! But once that is done, users can very easily re-target
their applications to the various processors from the many, many
vendors. With the ARM this gives you such a huge selection of MCUs to
choose from that you won't miss any of the proprietary MCU families
again.

At least that is how I see it. But it is important to get the support
in place for the various product lines.

I wonder how widely used Forth will be, even if a good open source
tool is available for a wide line of embedded processors. I still
remember mentioning in a vendor workshop that I wanted to program an
ARM in Forth and he laughed calling it that, "old stuff". I think a
lot of people have no interest at all in a Forth tool. Forth alone
puts me in a small enough group that I don't want to work with devices
that limit marketability so that I become completely invisible to
customers.

Rick

0 new messages