> What’s New ? <
Plang2 Status¶
Although I haven’t been able to update the Doc’s here for several months I have continued working on my Plang (Peripheral Language) design.
Plang is designed to to do do the following to the uploaded file. It does not touch the programmers Forth source at all.
Completed @ 23 October 2023¶
Replace all CMSIS Register Names with their Absolute Addresses. This saves massive amounts of Flash space and the compiled result is identical to wasting all that space with Memmap Constants !
Auto insert Bitfield Operations based on intelligent text preprocessing of the CMSIS-SVD file. This saves writing repetitive code.
Remove all comments and blank lines from the upload which speeds up the compile time on slower MCU’s.
Substitute Constants with their values based on a list of programmer created in the constants.fs file
Create a Database of all Bitfields, Operations and Register absolute Addresses that can be rapidly searched.
Todo¶
Access the Database from the VIM MCU Helpfile.
Create a VIM mcu Helpfile featuring vertical register bitfield graphics (to save space) and other relevant info including the Reference Manual page number for auto opening the PDF at that page.
Realtime Register data values inserted in the VIM help page, straight from the MCU. This may be implemented via the SWD terminal instead.
Current Results¶
Running my thermometer.fs thru Plang2
Source: 11717 Bytes
Upload after Pre-Preprocessing: 3304 Bytes
Upload Reduced By: 8413 Bytes
Reduction: 354.00 %
Code Samples¶
Source¶
Hand coded using VIM with searching the database for the correct Bitfield syntax.
: enable-comparators ( -- )
COMP_CSR_COMP1EN> \ Select COMP1
COMP_CSR_COMP2EN> \ Select COMP2
+ COMP_CSR bis! \ Enable
;
: disable-comparators ( -- )
COMP_CSR_COMP1EN> \ Select COMP1
COMP_CSR_COMP2EN> \ Select COMP2
+ COMP_CSR bic! \ Disable
;
Upload¶
Generated when Make is run, and then auto-uploaded to the on-MCU Forth.
: enable-comparators
1
1 16 lshift
+ $4001001C bis!
;
: disable-comparators
1
1 16 lshift
+ $4001001C bic!
;
Plang Database Search¶
# ./plang -p COMP -b EN -S
Bitfield print (-B)
name stack operation ar bw bo description
------------------------- ---------- ------------------------------ -- -- -- ----------------------------------------
COMP_CSR_COMP1EN> ( -- 1 ) 1 rw 1 0 Comparator 1 enable
COMP_CSR_COMP2EN> ( -- x ) 1 16 lshift rw 1 16 Comparator 2 enable
COMP_CSR_WNDWEN> ( -- x ) 1 23 lshift rw 1 23 Window mode enable