> 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

  1. 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 !

  2. Auto insert Bitfield Operations based on intelligent text preprocessing of the CMSIS-SVD file. This saves writing repetitive code.

  3. Remove all comments and blank lines from the upload which speeds up the compile time on slower MCU’s.

  4. Substitute Constants with their values based on a list of programmer created in the constants.fs file

  5. Create a Database of all Bitfields, Operations and Register absolute Addresses that can be rapidly searched.

Todo

  1. Access the Database from the VIM MCU Helpfile.

  2. 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.

  3. 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!
;