SWDCOM Intro

Warning

SWDCOM is ALPHA software, beware of sharp corners!

_images/swdcom-terminal.jpg

See also

Swdcom Install for all the details including installation, connections etc.

See also

Swdcom Premade Binaries For those who don’t want to modify the kernel and compile their own.

Forth is one of the oldest programming languages in existence having been developed in the early 70’s. In those days a computer running Forth usually communicated with a serial device, perhaps a Teletype or later a Wyse dedicated electronic terminal to allow interactive development and program uploading.

The availability of the IBM PC in the early 80’s (and other readily available portable computers) allowed the use of terminal emulators such as Picocom, Minicom etc running on the PC itself instead of dedicated terminals.

In the authors opinion. Forth consoles using serial terminals with speeds of 9600 to 115200 baud and no flow control really haven’t been competitive with other embedded design languages such as C for probably 20 years, even taking Forths interactivity into account.

Quite simply, such terminals are impractical for modern embedded development with Forth.

Legacy USART Issues

Issue

Description

Slow Uploads

Most Forths don’t go above 115200 Baud

No Handshaking

Require ‘end of line delays’or RTS handshaking to prevent the Forth compiler ‘choking’ on uploaded source code

Dependencies

USARTS are dependent on the MCU system clock speed, change it and lose communications.

Dongle

An external ‘USB to 3.3v Serial Dongle’ is required for most ‘development boards’

Reset

Requires entering ‘reset’ into the Forth console or pressing the target reset button

Making Forth developer friendly in 2020

Swdcom, provides Single Wire Debug (SWD) communications that works with Linux, FreeBSD and OSX, plus offers upload times equal to or faster than the equivalent GCC with Stlink on the same PC. This looks like and works much like a traditional serial terminal but is much, much faster and usually works with just a USB cable.

Discovery and Nucleo Boards

SWDCOM works thru the USB SWD connector of a Discovery or Nucleo Board, nothing else is needed because the same connector also supplies target power.

Embedded MCU’s

The designer doesn’t need to add a serial port connector, the standard TWO SWD pins, apart from allowing flashing/gdb, also provide the SWDCOM terminal connectivity.

Swdcom advantages

Feature

Description..

Common Driver

Two sizes fits all; works across a range of the same class of mcu free from usart/pin dependencies. M0 or > M0

Fast Comms

faster than a equivalent 460800 Baud serial terminal.

Fast Upload

STM32F407 @ 168 MHz with ART-5WS, uploads = 239,4 Words per second

Pasting

of multiple line source into the Terminal is problem free.

256 chr Buffer

print 428 loops of the “The quick brown fox jumps over the lazy dog” to the terminal in under 10 uS on a STM32F051

Handshaking

Inbuilt ACK flow control, no compiler ‘choking’ issues, no RTS handshaking or end of line delays are needed.

Clock

Independent of System Clock Speed. Comms doesn’t stop when the clock is changed.

USB

Uses a single USB cable from the PC to most development boards or a usb/swd programmer for standalone mcus.

Reset

Resetting the target MCU is easily done by hitting CTRL+C on the PC keyboard.

GPIO’s

Enabling is NOT required for SWDCOM to work, so they are NOT pre-enabled as the Mecrisp-Stellaris default.

Swdcom is very fast

Due to its inbuilt flow control and large 256 character buffer.

What does Swdcom run on ?

FreeBSD, Linux, OSX and possibly other Unix based OSes.

Does Swdcom run on Microsoft Windows ?

Sorry, no, not as is tho using Linux tools etc it may work.

Does Swdcom run on anything but Mecrisp-Stellaris ?

Sorry, no. Even then it is currently only supported on certain Cortex-M0, M3 and M4 models in the supported hardware list but more models may be supported in future.

Suitable SWD-USB interfaces

If you don’t have a STM32F0 Discovery board, a STM32F0xx and a Suitable SWD-USB interface like this $5 Chinese one will do instead.

_images/swd-usb-interface-dongle.jpg

Or you can make your own with a $2 Blue Pill Make your own stlink programmer from a Blue Pill

Credits