Skip to content

Commit

Permalink
Merge pull request #425 from TG9541/standard
Browse files Browse the repository at this point in the history
Standard
  • Loading branch information
TG9541 authored Apr 8, 2021
2 parents 94d0063 + 349a14c commit dde829e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ STM8 eForth is an interactive Forth system for the full range of [STM8 8-bit MCU

The original STM8 eForth was written by [Dr. C.H. Ting's eForth](http://www.forth.org/svfig/kk/07-2010.html) for the STM8S Discovery. With the kind permission of Dr. Ting the code presented here is under [MIT license](https://github.com/TG9541/stm8ef/blob/master/LICENSE.md). Bugs were fixed, code size reduced, standards compatibility improved and many features were added (e.g. compilation to Flash memory, autostart code, interrupt handling - see [overview](https://github.com/TG9541/stm8ef#stm8-eforth-feature-overview)).

The [binary release](https://github.com/TG9541/stm8ef/releases) provides ready-to-run Forth binaries for a range of target boards or devicesi, a library and STM8 register definitions. Build and test automation in the [uCsim STM8 simulator](https://travis-ci.org/TG9541/stm8ef) in Travis-CI provides is used for quality control. Binary releases also contain the tested source code of STM8 eForth core and libraries so that downstream projectes can use the [modular build support](https://github.com/TG9541/stm8ef-modular-build) to add new targets with specific hardware support, memory layout or a tailored vocabulary.
The [binary release](https://github.com/TG9541/stm8ef/releases) provides ready-to-run Forth binaries for a range of target boards or devices, a library and STM8 register definitions. Build and test automation in the [uCsim STM8 simulator](https://travis-ci.org/TG9541/stm8ef) in Travis-CI provides is used for quality control. Binary releases also contain the tested source code of STM8 eForth core and libraries so that downstream projectes can use the [modular build support](https://github.com/TG9541/stm8ef-modular-build) to add new targets with specific hardware support, memory layout or a tailored vocabulary.

[![STM8EF Wiki](https://user-images.githubusercontent.com/5466977/28994765-3267d78c-79d6-11e7-927f-91751cd402db.jpg)](https://github.com/TG9541/stm8ef/wiki)

## About Forth

Forth works by defining new words with phrases of existing words - "Hello World" in Forth is this:
Forth works by defining new words with "phrases" consisting of existing words - "Hello World" in Forth is this:

```Forth
: hello ." Hello World!" ;
: hello ." Hello World!" ;
```

Forth is a "low level" language that offers a high level of abstraction:
Expand All @@ -32,7 +32,7 @@ Forth is so simple that you can learn the basics in a snap, e.g. in the [STM8 eF

STM8 eForth itself is coded in STM8 assembler but it uses the SDCC tool chain. Combining Forth with C is possible.

STM8 eForth is highly configurable: a Forth binary that allows compiling new words to Flash fits in 4 to 5.5K ROM (a minimal interactive system fits in 3.5K). Due to the extraordinary code density a very-low-cost 8K device, e.g. [STM8S003F3P6](https://www.st.com/resource/en/datasheet/stm8s003f3.pdf) or [STM8L051F3P6](https://www.st.com/resource/en/datasheet/stm8l051F3.pdf) has sufficent space for non-trivial applications. If more is needed, low-cost 32K devices with many GPIOs or a richer set of peripherals can be used, e.g. [STM8S005C6](https://www.st.com/resource/en/datasheet/stm8s005c6.pdf) or [STM8L052C6](https://www.st.com/resource/en/datasheet/stm8l052c6.pdf).
STM8 eForth is highly configurable: a Forth binary that allows compiling new words to Flash ROM or RAM requires less than 4K. A binary with an extended vocabulary needs no more than about 5.5K. Due to the extraordinary code density a very-low-cost 8K device, e.g. [STM8S003F3P6](https://www.st.com/resource/en/datasheet/stm8s003f3.pdf) or [STM8L051F3P6](https://www.st.com/resource/en/datasheet/stm8l051F3.pdf) has sufficent space for non-trivial applications. If more is needed a low-cost 32K device with a rich set of peripherals can be used, e.g. [STM8S005C6](https://www.st.com/resource/en/datasheet/stm8s005c6.pdf) or [STM8L052C6](https://www.st.com/resource/en/datasheet/stm8l052c6.pdf).

The Forth console uses the STM8 U(S)ART or a simulated serial interface for communicating with the console (3-wire full-duplex or 2-wire half-duplex are supported). For console access and programming [e4thcom](https://wiki.forth-ev.de/doku.php/en:projects:e4thcom) is recommended but any serial terminal will work. The console can be configured, even at runtime, to use other types of [character I/O](https://github.com/TG9541/stm8ef/wiki/STM8-eForth-Board-Character-IO), e.g. keyboard and display.

Expand Down
22 changes: 22 additions & 0 deletions docs/words.md
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,16 @@
; this should be sufficent to replace COMPILE and [COMPILE]
```

```
; COMPILE ( -- )
; Ersatz using POSTPONE
```

```
; [COMPILE] ( -- )
; Ersatz using POSTPONE
```

```
; , ( w -- )
; Compile an integer into
Expand All @@ -906,6 +916,12 @@
; Compile a byte into code dictionary.
```

```
; A, ( A -- )
; Compile a byte in A into code dictionary.
; GENALIAS ACOMMA "A,"
```

```
; CALL, ( ca -- )
; Compile a subroutine call.
Expand Down Expand Up @@ -968,6 +984,12 @@
; indefinite loop structure.
```

```
; COMPILIT ( -- )
; Compile call to inline literall target address into code dictionary.
; GENALIAS COMPILIT "COMPILIT"
```

```
; AGAIN ( a -- )
; Terminate a BEGIN-AGAIN
Expand Down
2 changes: 0 additions & 2 deletions inc/bgtask.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
.ifne HAS_BACKGROUND
RamWord BGADDR ; address of background routine (0: off)
RamWord TICKCNT ; "TICKCNT" 16 bit ticker (counts up)

BSPPSIZE = BG_STACKSIZE ; Size of data stack for background tasks
.endif

;****** timer macro ******
Expand Down
5 changes: 2 additions & 3 deletions inc/defconf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;--------------------------------------------------------
RELVER1 = 2 ; Revision digit 1
RELVER0 = 8 ; Revision digit 0
PRE_REL = 1 ; Pre Release digit 0 (0: release)
PRE_REL = 0 ; Pre Release digit 0 (0: release)

TERM_LINUX = 1 ; LF terminates line

Expand Down Expand Up @@ -41,8 +41,7 @@
BG_USE_TIM3 = 0 ; Use TIM3 for the Background Task (instead of TIM2)
BG_TIM_REL = 0x26DE ; Reload value for Background Task timer (default for 5ms @ HSI 16MHz/8)
BG_RUNMASK = 0 ; BG task runs if "(BG_RUNMASK AND TICKCNT) equals 0"
BG_STACKSIZE = 32 ; Default size in bytes of data stack for background tasks
BSPPSIZE = 0 ; BG task data stack size (bytes) for memory calculation
BSPPSIZE = 32 ; Default size in bytes of data stack for background tasks

HAS_CPNVM = 0 ; Can compile to Flash, always interpret to RAM
HAS_DOES = 0 ; DOES> extension
Expand Down

0 comments on commit dde829e

Please sign in to comment.