cancel
Showing results for 
Search instead for 
Did you mean: 

FORTH Compiler for STM32 devices

jjonethal
Associate II
Posted on October 29, 2015 at 10:36

If you want a development system on chip,

incremental software updates, test driven interactive developments this is worth a look:

Mecrisp Stellaris Forth compiler updated with support for a number of STM32 controllers

stm32f030f4, stm32f051, stm32f100, stm32f103, stm32f303, stm32f401, stm32f407, stm32f411, stm32f429, stm32L053c8, stm32L152

others comming soon

http://mecrisp.sourceforge.net/

#compiler #forth #interpreter #forth-mecrisp-stellaris
16 REPLIES 16
jjonethal
Associate II
Posted on October 29, 2015 at 10:38

Here is the Website :

http://mecrisp.sourceforge.net/

jjonethal
Associate II
Posted on October 29, 2015 at 10:50

Mecrisp Stellaris FORTH current version is here:

https://sourceforge.net/projects/mecrisp/files/

Posted on October 30, 2015 at 23:43

I downloaded and tried it on a STM32L053 DISCO... basic FORTH funcionality OK (push some numbers, pop them, add them, that's about all I can do in FORTH interactively 🙂 )

Some struggling with getting a terminal wait after each line when uploading the ''programs'', but finally both examples (blinky and e-paper example) worked as expected.

Nice toy, thanks for the links! 😉

JW

PS. Oh, yes, and it's entirely written in that inhuman ARM Thumb-2 assembler, the author is CRAZY... :D

jjonethal
Associate II
Posted on November 02, 2015 at 20:13

There will be also a version with optimizer -RA- version that reduces much of the stack juggeling. Awesome work in assembly.

There is currently active development on many different STM32 cortex parts.

Next i will add a port for the new STM32L476 discovery board.

It's not only a toy. You can do serious stuff with it. Some stm devices support incremental flash updates. It took me a while to figure out all the stuff in that package. Disassembler, dumper, assembler, all on chip.

Im using teraterm with an upload script that supports include

https://raw.githubusercontent.com/jjonethal/mecrisp-stellaris/jjo-wip/stm32f303/upload_include.ttl

jjonethal
Associate II
Posted on November 06, 2015 at 10:49

in forth all words and numbers have to be separated by spaces.

Here some forth function example:

new function : ''var3=var1+var2''

indeed var3=var1+var2 is only one word. only space separates words.

1 variable var1

2 variable var2

0 variable var3

: var3=var1+var2 var1 @ var2 @ + var3 ! ;

: - create a new word

; - end current function

@ - get a word from address on stack

! - store a word to address

compiletoflash - burn all following functions to flash

compiletoram - put all following functions to ram

eraseflash - remove my functions from flash

. - the point prints and removes the top value from stack

.s - show me the datastack

this is what the compiler make from that:

1 variable var1  ok.

  ok.

2 variable var2  ok.

  ok.

0 variable var3  ok.

  ok.

  ok.

  ok.

: var3=var1+var2 var1 @ var2 @ + var3 ! ;  ok.

  ok.

see var3=var1+var2

20001056: F241  movw r0 #1000

20001058: 0000

2000105A: F2C2  movt r0 #2000

2000105C: 0000

2000105E: 6843  ldr r3 [ r0 #4 ]

20001060: 6A02  ldr r2 [ r0 #20 ]

20001062: 189B  adds r3 r3 r2

20001064: 63C3  str r3 [ r0 #3C ]

20001066: 4770  bx lr

 ok.

jjonethal
Associate II
Posted on November 06, 2015 at 11:04

new version RA-1.3a with optimizer online:

http://sourceforge.net/projects/mecrisp/files/mecrisp-stellaris-ra-1.3a-experimental.tar.gz/download

Kind Regards Jean

jjonethal
Associate II
Posted on November 18, 2015 at 18:45

Hi everyone,

a new version of Mecrisp Forth has been published:

http://sourceforge.net/projects/mecrisp/files/mecrisp-stellaris-ra-1.5-experimental.tar.gz/download

now with support for the STM32L476 Disco board. Nice board

with lots of components. Some demo code is also included.

Terminal works via STLINK USB interface with 115200 baud.

Have fun

Jean
Posted on November 18, 2015 at 18:58

What exactly is your association with this project?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
jjonethal
Associate II
Posted on November 19, 2015 at 20:07

i did some adaptions to the mecrisp forth to let it run on my stm32 boards. So i did the

stm32f411 nucleo  and the stm32l476 discovery adaptions.

I'm using it for my hobby projects and to get in touch with new components.

After playing around with it for a while i've found it pretty fun to code with it.

It's open source, put the disassembler on board you can always have a look

what's going on behind the scene. Matthias Koch is the brain behind this little gem.

Give it a try.