Close

STM8L101F3L3: first STM8 eForth prompt

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

ThomasThomas 09/19/2020 at 14:350 Comments

Thanks to OpenOCD and GDB: STM8L101 now works!

Besides resolving the problem of actually flashing this chip (I never managed to do that with STM8FLASH), and finding the right configuration for OpenOCD (see the previous log entry), setting the SP to a valid address for this chip (1.5K RAM!) resulted in a prompt (GDB again proved helpfull).

For now I'm using the following target.inc:

;       STM8L101F3 device and memory layout configuration

        TARGET = STM8L051F3     ; let's use this for now - to be fixed later

        RAMEND =        0x05FF  ; "RAMEND" system (return) stack, growing down
        EEPROMBASE =    0x1000  ; "EESTART" EEPROM start address (not really)
        EEPROMEND =     0x10FF  ; "EEEND" 256 bytes EEPROM (see datasheet...)
        FLASHEND =      0x9FFF  ; "FLASHEND" 8K devices

        FORTHRAM =      0x0030  ; Start of RAM controlled by Forth
        UPPLOC  =       0x0060  ; UPP (user/system area) location for 1K RAM
        CTOPLOC =       0x0080  ; CTOP (user dictionary) location for 1K RAM
        SPPLOC  =       0x0550  ; SPP (data stack top), TIB start
        RPPLOC  =       RAMEND  ; RPP (return stack top)

Here is a initialization code snippet of boardcore.inc that enables TX push-pull:

;       BOARDINIT  ( -- )
;       Init board GPIO (except COM ports)

BOARDINIT:
        ; Board I/O initialization: enable USART TX->PC3, RX->PC2
        MOV     CLK_PCKENR1,#0x21
        BSET    PC_DDR,#3
        BSET    PC_CR1,#3
        RET

There are some points that need to be worked on (e.g. BG, EEPROM, RAM layout) and many things are untested. All the important bits works, e.g. writing to NVM!

This means that I'll have to review many docs that state that it's unlikely that STM8 eForth will ever support this chip.

Discussions