Forth 7 Cross Compilers
Performance through simplicity
Last update: 9 April 2020
shop and support
All compilers have PowerNet, file system and USB.
ARM/Cortex includes Sockpuppet interface to C.
ARM/Cortex has hardware floating point support for Cortex-M4F, Cortex-M7 and ARM.
Segger J-Link integration for ARM/Cortex
Interactive Compilation, Debug and Test
MPE Forth 7 cross compilers are tools with a wide range of features designed to emphasise rapid production of embedded systems. They are available in Windows, Linux and Mac OS X versions. They all feature fast compilation, interactive debug and test even for single chip targets, and on-line source management. Forth 7 compilers have the features described below.
- Only one download for full version with source
- Available for Windows, Mac OS X and Linux x86/x86_64
- VFX code generator
- USB virtual serial port (CDC) and memory stick (MSC) drivers
- FAT file system (FAT-12/16/32)
- PowerView embedded GUI
- PowerNet TCP/IP stack
Windows 7/8/10, Linux or Mac OS X. The Windows compilers will probably work under XP SP3 and Vista, but we cannot guarantee this.
The full Forth 7 cross compiler manual is available for download from here. CPU and target manuals are available on request.
shop and support
On this page:
Cross compiler features
Target CPU list
Forth 7 Cross Compiler
For the release notes, see here.
Compilers are available in four subscription levels, Basic, Standard, Professional, and Ultimate. Basic compilers may not be used commercially but are free of charge.
For MSP430 and ARM Cortex targets a lightweight Lite kernel for direct compilation to Flash is also supplied. The Forth Lite kernel may be incompatible with the normal ROM PowerForth kernel. See the Lite compiler page for more details.
|VFX code generator||Y|
|All target code in source form||Y|
|Full-featured standalone PowerForth target||Y|
|Small standalone Lite target||ARM/Cortex and MSP430|
|Cross reference tools||Y|
|Unlimited code size||Y|
|State machine compiler||Y|
|Floating point math||Y|
|32 bit targets|
|PowerFiler Unix-like file system||Y|
|FAT 12/16/32 file system, SD/MMC||Y|
|USB driver, core and classes||Y|
|PowerView embedded GUI||Y|
|PowerNet TCP/IP stack||Y|
AIDE is currently only available for Windows. The AIDE front end integrates a number of useful tools as standard:
- ForthEd2 multi-file editor
LOCATEto ForthEd2 or external editor.
- PowerTerm teminal emulator for serial communications
includes multiple independently addressable console windows for debugging multitasked applications.
- Tool Capture window
Displays compiler progress and results.
- Text macro system for build management
Eases multiple product versions and moving code.
- Image converter
Bitmap to LCD panel format conversions
- Users can add additional tools at any time using the tool configuration system.
AIDE is entirely written in Forth and full source code is delivered.
The cross compilers are native VFX Forth applications that use a fast symbol search system for optimum performance and features. For large applications, we regularly find that the compiler can generate 500kb/second or more of binary. In the main, compilation speed is limited by disk performance.
Forth was designed as an interactive language, which is one reason why Forth permits embedded systems to be constructed and debugged very rapidly. Many designers like to retain that facility on their targets, so MPE compilers permit you to do this. The standalone target contains a complete Forth compiler and interpreter which can be used for debugging, and can also be used for communications, runtime configuration scripts, remote monitoring and even for accepting software updates in the field.
Where memory is at a premium, use the Umbilical Forth option. The normal Forth interactivity is retained, but is provided by the cross compiler, so avoiding the need for the full Forth compiler and interpreter on the target. This reduces the memory requirements of a fully interactive Forth to about 2k bytes for 8 and 16 bit CPUs. In this mode all the host tools are available as if on the target, making Umbilical Forth ideal for single chip target development.
VFX Code Generator
Compilers for suitable target CPUs use MPE’s VFX optimising code generator, which provides excellent code quality and code density. The VFX technology eliminates redundant memory moves caused by stack manipulations, and merges many common Forth operations. As well as Forth-specific techniques, VFX code generators include standard compiler techniques common in other languages. Inlining of procedures below a user definable size is also supported.
The VFX code generator produces code that is between 5 and 15 times faster than traditional Forth direct threaded code, somewhat dependent of course on the CPU architecture. We have not written an interrupt routine in assembler for many years! A separate paper is available that has figures for several benchmarks. The MPE cross compiler benchmark code may also be downloaded (approx 40kb).
VFX compilers also include a disassembler that is very useful for checking code generation efficiency, and for making performance analyses and decisions.
The cross compiler provides facilities enabling you to see the source code of any target word at any time, and to find out where it is used in the code. Typing LOCATE <name> will display the source code for that word or put you in an editor at the start of the definition. XREF <name> will give you a list of all the words that use <name> – a cross-reference. XREF-ALL cross references all the words you have defined, whereas XREF-UNUSED produces a list of any words that have been defined but are unused.
If you have to build several versions of a project, use the text macro facilities built into AIDE and the cross compilers. These allow you to change directories, file names and text globally within a project.
When you have a substantial project, you can use the DocGen system to produce code manuals for your project. For safety-critical applications, DocGen/SC can be used to integrate documentation and test code in a form suitable for FDA approval. Contact the MPE office for more details of DocGen/SC.
All compilers include an integrated cross assembler. There is no need to place assembly code in separate files. The assemblers are fast, easy to use, and are fully integrated into the cross compiler. The assemblers support macros, conditional structures, named labels with forward referencing and local labels.
A disassembler within the cross compiler allows you to inspect the generated code.
Library Files With Multi-Pass Reference Resolution
Library files are source files that can be scanned at the end of compilation. If a procedure in a library file satisfies a forward reference, the procedure is compiled and the reference resolved. A group of library files is scanned until no more references can be resolved.
This procedure allows you to minimise the size of your code by only including words if they are actually needed.
User Definable Communications Links And Memory Drivers
For Umbilical Forth development, the compiler needs a communications link to the target. The protocol for this link has been factored in such a way that you can add your own drivers to the compiler.
The compilers provide output of memory SECTIONs to files or to memory drivers, the most common of which is a Flash or EPROM emulator driver. You can add your own memory drivers if you need to, for example to drive a JTAG programmer or in-circuit emulator. Output file formats are binary, Intel Hex (16 or 32 bit), Motorola S19/28/37 and ELF.
Flexible Target Memory Management
As microcontrollers gain more peripheral blocks and mixes of on-chip memory, efficient applications must make best use of these areas. The compilers allow you to define any number of areas of memory called SECTIONs, which may be for code (CDATA), memory that is initialised at power up (IDATA), or uninitialised memory (UDATA).
$0000 $7FFF CDATA SECTION UE31
$8000 $9FFF IDATA SECTION UE31I
$C000 $DFFF UDATA SECTION UE31U
$F000 $FFFF UDATA SECTION EEPROM
Targets that require more memory than the CPU normally addresses, for example when a 9S12/68HC12 or 8051 needs to access more than 64k bytes of memory, can define banks of memory that are split into pages.
$A000 $BFFF CDATA BANK ROMBANK
1 PAGES ROMB1
2 PAGES ROMB2
$E000 $EFFF UDATA BANK RAMBANK
$100 PAGES RAMB1
$200 PAGES RAMB2
The flexible and efficient memory definition scheme provides complete control of target memory.
Standard Hardware Configurations
Each compiler comes complete with configuration files for one or more commercially available hardware systems such as manufacturers’ evaluation boards or MPE’s own hardware products. Configuration for custom hardware is usually just a matter of redefining the memory map of the processor.
If you want the easiest possible start up route, MPE has a hardware porting service that will configure the compiler for your own hardware and will supply you with a tested configuration file.
Supported ARM and Cortex boards.
The fast and efficient MPE multitasker provides the usual task management facilities, including semaphores, interprocess messaging and event handling.
TIMEBASE time and delay management system
Using a single periodic clock interrupt, you can generate delays, wake/suspend tasks, timeouts and periodic execution very simply, using phrases such as:
' <action> <ms> AFTER \ once after <ms> ms ' <action> <ms> EVERY \ every <ms> ms
Timers can be cancelled at any time.
All targets are supported by software floating point packs with full trig support. With the release of the Forth-2012 standard, new packs are available for 32 bit targets. The existing code is still available for both 16 and 32 bit targets.
Some targets, e.g. ARM and Cortex-M4, which have IEEE F.P. support in hardware also contain floating point packs for the floating point instructions. Hardware floating point packs are only provided with the Professional versions of the cross-compiler.
A task-safe heap system for memory management is supplied. The 32 bit implementation is optimised for performance, and the 16 bit implementation is optimised for code size.
PowerView Embedded GUI (32 bit targets)
PowerView provides facilities for displaying menus, buttons, text and images on monochrome or colour screens. Sample drivers are provided for LCD panels.
A set of PC hosted tools are provided (with source code) for converting standard PC images into the format required for your screen.
FAT File System (32 bit targets)
FATfiler is a FAT 12/16/32 file system designed for use with current devices such as SD/MMC cards, CompactFlash cards and USB memory sticks. Such devices can simply be transferred from the embedded system and plugged into a PC. When a device is initialised FATfiler automatically detects the FAT type and configures itself. The ANS Forth file wordset is provided.
You can configure the filing system for disk caching and for the required sector read/write interface. For the common case where SD/MMC cards are being driven from an SPI port, a common SD/MMC interface layer is provided. SPI drivers are provided in many cases in the CPU specific driver code. A driver layer is also provided for testing on VFX Forth for Windows.
Layered USB System v2 (32 bit targets)
Version 2 of the MPE USB driver system has been tested with Windows, Linux and Mac OS X. The example hardware and USB class drivers have been overhauled for use with DMA hardware. An example composite device is provided.
Your embedded system can use a USB virtual serial port. Version 2 of the USB driver code includes a Communications Device Class (CDC) driver for serial emulation over USB. You can even use this as the Forth console. No additional host drivers are required.
Your embedded system can be a memory stick. The USB code has been structured so that the hardware drivers are independent of the USB core layer and the class layer. The Mass Storage Class (MSC, memory stick) driver requires no additional operating system drivers.
Datalogging applications can be written using the FATfiler file system above. When the time comes, just connect it to a PC using a USB connection and copy the files to the PC.
You can also merge the CDC and MSC drivers into a composite device that will provide both a disk and a serial port to any host PC.
PowerFile (32 bit targets)
PowerFile is an embedded file system based around Unix file systems. PowerFile has recently been updated to be smaller and faster. It includes an ANS Forth wordset that controls a complete filing system with sample drivers for serial EEPROM and Compact Flash or IDE drives.
A single configuration file permits nearly all aspects of PowerFile to be configured. The filing system is suitable for use most applications, including data logging and web servering. A simple interface API links it to almost any form of mass storage, whether it be Flash memory, SD/HC, CF, hard-disk, serial Data Flash or EEPROM.
PowerNet TCP/IP stack (32 bit targets)
Professional editions for 32 bit targets only
A Forth implementation of popular IP based network protocols. Includes TCP, UDP, IP, DHCP, SNTP, SMTP, a multi-threaded server architecture with Telnet, FTP and HTTP Web servers. Client-side facilities have not been neglected. See the PowerNet page for more information.
One user desribes the web server performance as “like s**t off a shovel”.
The PowerNet TCP/IP stack and web server has been reworked to reduce memory usage. It runs comfortably on the new generation of single chip ARMs and ColdFires. A full installation with Ethernet, Telnet and web server can be configured in less than 16k bytes of RAM.
Client-side code has not been neglected. Example files show you how to connect to a remote web server, transfer data to and fro, and even to download and program a new firmware image. Example client configuration code shows you how to simplify production configuration.
N.B. The combination of PowerNet, PowerView and FATfiler permits the construction of fully web-enabled controllers that have low memory requirements and low power consumption.
Finite State Machines
Finite State Machines (FSMs) are a convenient way of describing state driven systems that are otherwise difficult to program. The MPE FSM implementation allows for multitasked operation and nested state machines.
This package has been used for defining communications protocols in safety critical systems such as lifts (elevators) and train (railroad) control.
PID – Process Control Loops
Initially developed for an MPE client, this implementation of a PID controller with deadband handling is now part of the target code.
Fuzzy Logic package
Flash memory drivers
Extended precision integers
Unix LSECONDS and date/time conversion
I2C and SPI host and device examples
Embedded Forth benchmark suite
and many more …
The CAN fieldbus is popular in many industries requiring high reliability. This implementation was developed by a client for railway control systems, and is released as a cross compiler extension. Please contact us directly for more information.
Cross Compiler Target CPUs
Forth 7 compilers with VFX code generators
ARM, most Cortex-A (with FP) and Cortex-M0/M1/M3/M4/M7, ARM/StrongARM/XScale, 386/486/Pentium, H8S, H8/300H and H8/Tiny, Coldfire, 9S12/68HC12, MSP430 and 8051.
|CPU family||Comments||Order code|
|Cortex-M0/M1/M3/M4/M7, most Cortex-A and ARM7/9/XScale||Cortex-M is the ARM architecture for embedded devices. Cortex devices have higher clock speeds and performance with lower energy needs than the old ARM7 devices. One nice feature of the Cortex is that there is no assembler start-up code – it’s all high-level Forth.
Cortex devices: Freescale Kinetis, NXP LPC11xx/13xx/17xx, Nuvoton NUC1xx, STM32F0xx/1xx/4xx, TI/Luminary Stellaris.
Cortex-A7, including RPi 3/4.
ARM7/9 devices: NXP/Philips, Atmel, Analog Devices, ST, Intel, Sharp, Samsung, Oxford Semi, Crystal.
Note that this compiler only supports ARM devices from ARM7TDMI onwards, and does not include support for 26-bit PC mode, devices without the LDRH/STRH instructions, or big-endian mode. The legacy ARM compiler with this support is still available.
Upgrades from the ARM compiler to ARM/Cortex are available.
|MSP430||Excellent very low power 16-bit CPU with an instruction set that makes small CPUs fun again. Integrated access to the TI JTAG facilities by USB (including Launchpads).||XCMSP430/71|
|H8S/X, H8/300H and H8/Tiny||Good code, good performance and excellent value for money 32-bit CPU with wonderful but sometimes quirky peripherals.
Renesas are being particularly aggressive with the pricing of the H8/Tiny parts, allowing you to use a mature 32 bit CPU for the cost of most suppliers’ 8 bit parts.
Current compilers provide better code generation and support for the Renesas RSK H8/36079 evaluation board for the H8/Tiny series.
|Coldfire||Great performance for the money.
Target code has been updated for recent devices such as the M522xx devices. The VFX code generator has been further tuned for this family and the results are impressive.
|386/486/Pentium||Fabulous code generation from the VFX compiler, benefiting from the VFX Forth developments.||XC386/71|
|68HC12/9S12||High speed upgrade to 68HC11; superb maths performance and excellent peripherals. Probably the best 8-bit CPU currently available.||XC68HC12/70|
|8051/C5xx||Suitable for all 8051 derivatives such as Intel, NXP/Philips, Atmel, Cygnal, Siemens, Dallas, Analog Devices etc.||XC8051/70|
If the CPU family you are looking for is not here, please ask. We have a number of compilers that were developed as custom targets, and have not yet been documented to production standard.
shop and support
Legacy target CPUs
Because embedded projects can have very long lifetimes, we do not abandon compilers that are no longer under active development. Instead, they are kept available (usually with full source code) under our normal subscription terms. The technical support level will depend on whether we can remember anything about this particular target and still have hardware for it. Consultancy is always available.