Stair-Stepping

Does your terminal output look like this ?

ok.
     ok.
          ok.
               ok.
                  reset Mecrisp-Stellaris RA 2.4.6 with M0 core for STM32F051 by Matthias Koch
                                                                                                ok.
                                                                                                     ok.
                                                                                                          ok.
                                                                                                               ok.
                                                                                                                    ok.
                                                                                                                         ok.
                                                                                                                              ok.

If it does, then you’re sufferring from ‘stair stepping”.

This happens when a Serial Terminal refuses to return the “Carriage” (Cursor) after a “New Line” NL (also known as a Line Feed LF) is received. In the ‘picture’ above (taken from my system) all that’s happening after I hit the Carriage Return key, is a New Line.

A special plea to the author, Matthias please add a cr to your release by default ?

The Solution ?

Fortunately because Mecrisp-Stellaris is Open Source, there are numerous solutions to this issue. Look at it as a exercise for the new Forth user ?

Use a Terminal that is configurable for it

Picocom is given as a example, but other serial terminals have options regardingf CR/LF also. Some like E4thcom (linux only) deal with this by design and is FAR BETTER for a quick fix, highly recommended if you run Linux.

Picocom

Picocom has a command line syntax that solves the problem. It runs under all Unixes and Mac etc.

picocom -b 115200 /dev/cuaU0 --imap lfcrlf,crcrlf --omap delbs,crlf --send-cmd "ascii-xfr -s -l200"

E4thcom

E4thcom fixes this issue for Mecrisp-Stellaris but only under Linux.

Add this code to your program in the INIT Word

This “hook” tells Mecrisp Stellaris to add a CR to the LF’s.

: emit-crlf ( c -- ) dup 10 = if 13 serial-emit then serial-emit ;
' emit-crlf hook-emit !



Mecrisp-Stellaris RA 2.4.6 with M0 core for STM32F051 by Matthias Koch
                                                                       ok.
                                                                            ok.
                                                                                 ok.
                                                                                    : emit-crlf ( c -- ) dup 10 = if 13 serial-emit then serial-emit ;  ok.
                                                                                                                                                             ok.
   ok.
      ' emit-crlf hook-emit !  ok.
 ok.
 ok.
 ok.

Modify your Mecrisp-Stellaris Kernel

Change a few commands in the Mecrisp-Stellaris source file “datastackandmacros.s”

Change occurances of:

"\Meldung\n"

to

"\Meldung\r\n"

And rebuild the distribution by running “release” in the root directory.