|
Shi
|
Shi adds a couple of non-ANS words to Forth.
h!
Like ! but stores a halfword (16bit value).
h@
Like @ but fetches a halfword (16bit value).
inline
Make the most recent definition an inline word.
>text?, >data?
text? and data? can be used to check if Shi is currently compiling to ram or flash memory.
>text, >data
By default (and after initialization) Shi compiles to ram (data). It is possible to compile definitions to flash (text) by wrapping them in a >text ... >data block.
The actual flash write takes place once the block ends with >data. Until then everything between >text and >data is stored in data. Implementing the flash write is the users responsibility. Shi anticipates a callback with the symbol shi_write_text which takes 3 arguments:
A reference implementation for the STM32 F4-Discovery board can be found in the ./src/test folder. After the call to shi_write_text data gets cleared till the beginning of the current block.