Skip to content

New Features, New boards, More STM8L, Some Fixes

Compare
Choose a tag to compare
@TG9541 TG9541 released this 27 May 09:07
· 405 commits to master since this release
138a8ec

New Features

STM8 eForth can now use the REPL in non-interactive applications. This means that the power of the Forth interpreter can be used, e.g. for implementing text based communication protocols. A set of new features can be combined to this end. Thanks to @VK6TT for the idea!

IDLE Feature

#187 adds a basic IDLE feature. Here is an example:

#require 'IDLE
\ this is "$0066 CONSTANT 'IDLE" (independent of the revision)
VARIABLE TALLY
: testidle TALLY ( -- ) 
  \ idle code must be stack neutral!
  @ 1+ DUP TALLY ! $F000 AND 0= OUT!
;
' testidle 'IDLE !  \   set IDLE execution vector to word testidle

When the console waits for input, testidle makes the board outputs (e.g. LED). An STM8 with 16MHz clock flashes the LED about 34 times per minute. This means that one IDLE loop iteration takes about 8.65µs = 34s/60/65536.

EVALUATE Feature

#185 adds a basic EVALUATE for STM8 eForth. The feature required a minuscule core change that was addressed in #183 (Enable EVALUATE-like feature by using indirect addressing for TIB).

EVALUATE enables interpretation (or compilation!) of code by Forth programs. Consider the following example:

#require EVALUATE
: myString ( -- a )
   $" 2 7 *" 
   ;
: test ( -- )
   myString COUNT EVALUATE
   ;

test . evaluates myString and prints 14 ok. Use cases comprise the implementation of communication protocols, algorithmic auto-configuration, or compiling source code stored in the embedded system.

If used carefully (no concurrent compilation with REPL!), EVALUATE can also be executed in an idle task (solved with Issue #185).

Dictionary entries in the EEPROM

Although the STM8 core can't execute code from the EEPROM it can still be used to store STM8 eForth Aliases. By using the EEPROM for eForth core dictionary entries, Forth applications on low-density device can use up to 500 bytes additional Flash ROM.

With e4thcom the feature is really easy to use :

\ EEPROM MODE Example:
#include EEALIAS

\ define ALIAS words in EEPROM MODE
#require SPACES
#require DIGIT
#require DNEGATE

\ all words defined, return to normal mode, and WIPE RAM
EECLOSE

Please refer to the ALIAS Wiki entry for details.

STM8S High Density Support

Issue #173 adds initial support for STM8S High Density devices. Controllers like STM8S207xB provide up to 32K Flash, 6K RAM, and 2K EEPROM for Forth applications. There are no plans to support compiling Forth code to Flash memory beyond 0x10000. However, up to 96K Flash memory area can be used for C code or for data storage.

Improved STM8L Support

@plumbum greatly improved STM8L support:

  • support for the STM8L152C6 (e.g. STM8L Discovery), including LCD control
  • SPI master code for STM8L
  • driver code for the STM8L RTC (real time clock)

New Boards

All newly added boards are the result of community support: direct contribution, or gentle nudging ;-)

XH-M194

The XH-M194 is a timer relay board with the following features:

  • STM8S105S4T6 (16K Flash, 2K RAM, 1K EEPROM, 44pin)
  • 6 relays 12V/250VAC w/ 6 red status LEDs
  • 6 green status LEDs
  • 4 digit digital clock-style 7S-LED display
  • 6 keys
  • DS1302 RTC, half-duplex SPI, backup battery holder
  • 12V AC/DC power supply

Please refer to the XH-M194 Wiki entry and to XH-M194/board.fs. Issue #128 tracked the implementation.

XY-LPWM

@plumbum added board support for the XY-LPWM, a board with the following features:

  • STM8L003F3P6
  • 2x4 digits LCD display based on HT1621B (with driver code)
  • 4 keys
  • pads for UART RX/TX
  • PWM output

Please note that most likely the Nuvoton µC will have to be replaced by an STM8S003F3P6 or an STM8S103F3P6, and that the docs are not yet complete. However, the board has a full UART port, and it's a generally a good choice for experimenting with STM8 eForth.

XY-PWM (HW-0515)

@plumbum added board support for the board XY-PWM (alias HW-0515), which has the following features:

  • STM8L003F3P6
  • 3 digits LED display
  • 3 keys
  • pads for UART RX/TX
  • 2xPWM output
  • Micro USB connector for power supply

Initial docs are in the XY-PWM/README.md are not yet complete. As the board has a UART port and an easy power supply it's a very good choice for experimenting with STM8 eForth.

STM8L-Discovery

@plumbum added core support for the STM8L152C6, and board support for the STM8L-Discovery, including LCD driver code. Please refer to the STM8L-DISCOVERY/README.md.

Improvements and Other Changes

  • Issue #180 SPI register constants fixed PD8544 (Nokia 3310) LCD code
  • Issue #189 Enable UART simulation on Port E
  • Issue #192 Export arbitrary RAM locations in forth.asm as constants
  • Issue #194 improve behavior of serial interface w/ shared LED-Display (e.g. DCDC, W1401)
  • Issue #200 codeload.py supports multiple symbols \res export in one line (4ethcom compatibility)
  • Issue #212 align SPIon parameters in spi.fs with stml.fs
  • code size tweaks