Autres articles / Other articles

MyFFshell: the FORTH compilation at very high speed

published: 3 December 2020 / updated 3 December 2020

Lire cette page en français

 


First of all, a big THANK YOU to Jan LANGEVAD for developing MyFFshell.

The MyFFshell.exe program

The FlashForth site, flashforth.com, in the section Interacting with FlashForth also offers a Shell type program. Boredom is that ff-shell.py is only available on Linux and requires installing PYTHON.

MyFFshell.exe runs on Windows and is stand-alone.


Download MyFFshell.exe

You can download MyFFshell.exe by clicking here v3.3.

Once downloaded, install the program in the directory of your choice.

MyFFshell.exe does not require any installation. The program can be started immediately.

Windows Defender is likely to issue a warning. Disregard this warning.

The strong points of MyFFshell

First strong point: the program works under WINDOWS. It does not require any extension and is autonomous.

Second strong point: MyFFshell.exe can be placed in the directory of your choice. He throws himself and is available in seconds.

Third highlight: MyFFshell waits for the end of line signal transmitted by FlashForth before to transmit a new line of FORTH code. This option, activated by default, speeds up the transmission of FORTH code.

Fourth strong point: MyFFshell removes comments before transmitting the FORTH code. This option, activated by default, speeds up the transmission of the FORTH code.

Fifth strong point: MyFFshell accepts two directives include and EOF allowing to nest the transmission of multiple files. Let's see these guidelines in detail.

The INCLUDE and EOF directives

Before explaining the role of these directives, let's go back to how to program with FlashForth...

If you are just using TeraTerm (or some other terminal software), each time you recompile code, it is necessary to proceed to the copy/paste phase of the FORTH code. If these are small pieces of code, in general 10 to 30 lines, we can accept the maneuver. But when we start to process programs occupying several pages, it can become disabling.

It's even worse when the FORTH code is spread over multiple files:

The solution, the least worse, will consist in grouping the portions of code in a single file. But transmitting a very large file at one time still takes a while.

The include directive can be included in a working file like this:

\ include "strings.txt" 

This directive must be placed after "\" which marks the beginning of a FORTH comment. Normal compilation will ignore what is placed after "\".

But MyFFshell will detect this directive and will open this new file and transmit its content to the ARDUINO card. Calls by include can be nested:

La directive eof est intégrée ainsi:

\ eof 
\ don't compile line after eof 

The eof directive is detected by MyFFshell which will interrupt the transmission of the file being transmitted and goes up in the file call hierarchy the case appropriate.

A single working file can contain multiple include directives. A file can contain a single eof directive.

How to use MyFFshell.exe

Connect the ARDUINO card to a USB port on your PC.

Stop the execution of the terminal program if necessary.

Start the execution of the file MyFFshell.exe. The first action is to choose the serial port by clicking on Serial-Setup:

Once the serial port has been selected (here COM8 in the screenshot), click on Connect.

If the link is correctly established with the ARDUINO card, you should have the echo of this transmission:

This window can be used as a terminal to take control of the ARDUINO card.

To transmit a file, click on File -> SourceFile Window.

In this new window, click on File -> Open a source / text file.

Select the file to send, here test.txt in our screenshot:

Once the file is selected, click on Send all text to processor:

In our test.txt file we have put a include directive and a eof directive.

If the compiler encounters an error and issues the message "COMPILE ONLY", the myFFshell program will mark a pause to report the error.