Mecrisp Forth for the STM32WB

Interactive and extensible language. Built-in lexical analysis (tokenizer, parser), needs less than 32 KiB Flash and 4 KiB RAM.

The competitor is MicroPython, but it needs more than 250 KiB of Flash.

But what about uLisp? It is also small and self-contained.

CMSIS-SVD for STM32WB

SVD 2 Forth

Install the STM32CubeIDE and get the STM32WBxx_CM4.svd from the folder:

Version 1.6: stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.productdb.debug_1.1.0.201910081157/resources/cmsis/STMicroelectronics_CMSIS_SVD
Version 1.7: stm32cubeide_1.2.0/plugins/com.st.stm32cube.ide.mcu.productdb.debug_1.2.0.201912201802/resources/cmsis/STMicroelectronics_CMSIS_SVD

Install the Mecrisp-Stellaris and copy the STM32WBxx_CM4.svd into common/svd2forth-v3. Edit the Makefile

common/svd2forth-v3> diff Makefile Makefile~
5c5
< FOLDED_SVD            = STM32WBxx_CM4.svd
---
> FOLDED_SVD            = STM32L07x.svd

Edit the shell script raw-svd-clean.sh. Replace gsed with sed.

Generate the Forth and Assembler source files:

common/svd2forth-v3> make everything
common/svd2forth-v3> make mem

STM32WB Nucleo Board

stm32wb-nucleo.jpg

https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html

Schematic Nucleo Board MB1355

Schematic Nucleo Dongle MB1293

Build

Linux packages:

  • cross-arm-binutils
  • cross-arm-none-gcc9
  • cross-arm-none-newlib-devel

  • stlink
  • stlink-gui
  • stm32flash
  • openocd

/opt/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=SWD -ob displ

Debug

There is good architecture diagram from STM32MPU Wiki (consider only the Cortex-M4 parts):

700px-GDB_openOCD_focus_graph.png

OpenOCD

OpenOCD 0.10.0 does not support STM32WB, therefore I built the OpenOCD from the sources.

$ git clone https://git.code.sf.net/p/openocd/code openocd-code

But openSUSE' jimtcl Package conflicts with the configure script, to prevent this:

$ mv /usr/bin/jimsh /usr/bin/jimsh-unused

The usual configure/make/install:

$ ./configure
$ make
# make install

The stm32wbx.cfg is derived from st_nucleo_l4.cfg.

$ openocd -f /usr/local/share/openocd/scripts/board/st_nucleo_wb.cfg
Open On-Chip Debugger 0.10.0+dev-01031-gff6d0704 (2020-01-19-11:35)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : STLINK V2J34M25 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.221593
Info : stm32wbx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections

Test the server from another terminal:

$ telnet localhost 4444
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> shutdown
shutdown command invoked
Connection closed by foreign host.

-- Peter Schmid - 2019-12-29

Comments

  • 700px-GDB_openOCD_focus_graph.png:
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatfs 1b.fs r1 manage 0.7 K 2020-01-12 - 10:21 PeterSchmid  
PNGpng 700px-GDB_openOCD_focus_graph.png r1 manage 103.5 K 2020-01-19 - 16:11 PeterSchmid  
Unknown file formatsvd STM32WBxx_CM4.svd r1 manage 1536.1 K 2019-12-31 - 18:11 PeterSchmid  
Unknown file formats STM32WBxx_CM4.svd.equates.s r1 manage 447.3 K 2020-01-12 - 10:21 PeterSchmid  
Unknown file formatfs bitfields.fs r1 manage 526.9 K 2020-01-12 - 10:21 PeterSchmid  
Unknown file formatfs memmap.fs r1 manage 132.7 K 2020-01-12 - 10:21 PeterSchmid  
Unknown file formatcfg st_nucleo_wb.cfg r1 manage 0.3 K 2020-01-19 - 15:32 PeterSchmid  
JPEGjpg stm32wb-nucleo.jpg r1 manage 85.8 K 2019-12-30 - 16:51 PeterSchmid  
Edit | Attach | Watch | Print version | History: r34 | r15 < r14 < r13 < r12 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r13 - 2020-01-19 - PeterSchmid
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback