Library

All words are CMSIS-SVD compilant and designed to run on Mecrisp-Stellaris.

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

Maths Library

Feb 2018, Andrew Palm, a mathematician, has created a square root, trig, and inverse trig functions for 64bit fixed point (s31.32) numbers library that should run on any Cortex M. Tested here on a STM32F051.

DOWNLOAD:fixpt-math-lib.fs

Note

If you haven’t used s31.32 fixed point numbers before, the (usual floating number) decimal point is replaced with a COMMA

Examples

4,0 sqrt f.
  2,00000000000000000000000000000000  ok.
3000,02398 sqrt 6 f.n
  54,772474  ok.
90,0 sin f.
  1,00000000000000000000000000000000  ok.
0,5 asin f.
  29,99999998090788722038269042968750  ok.
0,0 cos f.
  1,00000000000000000000000000000000  ok.
0,5 acos f.
  60,00000001909211277961730957031250  ok.
90,0 tan f.
  0,00000000023283064365386962890625  ok.
45,0 atan f.
  88,72696999576874077320098876953125  ok.
90,0 deg2rad f.
  1,57079633558169007301330566406250  ok.
1,57079633558169007301330566406250 rad2deg 6 f.n
  90,000000  ok.

Read Cortex M0 chip ID

Reads the chip ID of a Cortex Mo

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

Download: f0-device-electronic-signature.fs

Example

stm32id

Die xy coords: 2752589
Wafer Number: 14
Lot_num ascii encoded  [23:0]: 0x00413657  | A 6 W
Lot_num ascii encoded [55:24]: 0x20323336  |   2 3 6

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

Example

dict

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

Stack Check

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

Example

stackcheck

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