Library

All words are CMSIS-SVD compilant (svd2forth-v2), so if you use it as well, then these words should work for you. Hopefully.

Words here will be for development, otherwise they should be in Projects or Examples

Note

Using the e4thcom terminal I pull in all the words I want under a ‘dev’ word when I start a new project.

: f0-dev ( my dev support programs )
#require f0-id.fs
#require dict.fs
#require memstat.fs
#require stack-check.fs
#require f0-legends.fs
#require project.memap.fs  (this is the svd2forth memap I created for this particular project)
;

f0-id.fs

Reads the chip ID of a Cortex Mo

Tested on a Cortex M0, may not work with other STM32 models

id

chip serial is: 540291894 1094080273 4915248

Download: chip-id.fs

dict.fs

A 40 word dictionary pager

Dict just pages the Dictionary words in a 40 word high single column. Press enter or the space bar to continue.

Download: dict.fs

dict

--- Mecrisp-Stellaris Dictionary, press any key to continue ---
stack-check.fs
sc
--- Mecrisp-Stellaris Core ---
2dup
2drop
2swap
2nip
2over
2tuck
...

memstat.fs

Prints Flash and Ram usage

Download: memstat.fs

mem

mem (bytes)
FLASH.. TOTAL: 65472 USED: 42416 FREE: 23056
RAM.... FREE: 7280

stack-check.fs

Checks the Data Stack for leftover items, warns you if the stack > 0, then clears the Stack. Use it at the end of loops etc.

Download: stack-check.fs

stackcheck

*** Stack fault: there were ** 3 ** items left on the stack
Stack cleared
ok.

f0-legends.fs

In svd2forth-v3 (not yet ready for release) I’ve separated the register legends from the memory map to allow customised legends for any MCU model. These provide a lot more information with the autogenerated register prints. These are hand edited in a simple text file, so if you have a favorite STM32Fxx MCU, you will be able to make them yourself.

A “rcc.” snippet. You can easily see that all GPIO’s are enabled as is USART2, but not USART1.

rcc.

 RCC_AHBENR $005E0000
                   I   I I I I                         F
               T   O   O O O O                         L   S
               S   P   P P P P                     C   I   R   D
               C   F   D C B A                     R   T   A   M
               E   E   E E E E                     C   F   M   A
               N   N   N N N N                     E   E   E   E
              |2| |2| |2|1|1|1|                    N   N   N   N
 ~~~~~~~~~~~~~|4|~|2|~|0|9|8|7|~~~~~~~~~~~~~~~~~~~|6|~|4|~|2|~|0
 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

 RCC_APB2ENR $00000000
                   D       T T T   U                           S
                   B       I I I   A   S T                     Y
                   G       M M M   R   P I                     S
                   M       1 1 1   T   I M   A                 C
                   C       7 6 5   1   1 1   D                 F
                   E       E E E   E   E E   C                 G
                   N       N N N   N   N N   E                 E
                  |2|     |1|1|1| |1| |1|1|  N                 N
 ~~~~~~~~~~~~~~~~~|2|~~~~~|8|7|6|~|4|~|2|1|~|9|~~~~~~~~~~~~~~~|0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

 RCC_APB1ENR $00020000
                             U
                   I I       A     S     W     T
   C D P           2 2       R     P     W     I       T     T T
   E A W           C C       T     I     D     M       I     I I
   C C R           2 1       2     2     G     1       M     M M
   E E E           E E       E     E     E     4       6     3 2
   N N N           N N       N     N     N     E       E     E E
  |3|2|2|         |2|2|     |1|   |1|   |1|    N       N     N N
 ~|0|9|8|~~~~~~~~~|2|1|~~~~~|7|~~~|4|~~~|1|~~~|8|~~~~~|4|~~~|1|0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Table Of Contents

Previous topic

Svd2forth-v2

Next topic

Example Forth Programs

This Page