[fpc-devel] Freepascal in microcontrollers

Daniël Mantione daniel.mantione at freepascal.org
Wed Feb 27 12:21:38 CET 2008

Op Wed, 27 Feb 2008, schreef Vinzent Hoefler:

> Well, TP didn't, and until now I found no real documentation on it (it
> sure wasn't mentioned in *my* copy of the programmer's manual).

That is correct, but the last version of TP appeared in 1992. Many Pascal 
compilers have supported bitpacking, since 2.2 we do too.

> If it's
> similar to C-records then it's unusable anyway, as there are no
> guarantees. Not about endianess, not about padding.

This is simply a matter of documenting and standardizing. I.e. we can 
exchange packed records with TP/Delphi, what would be the problem with 
bitpacking? If I recall well, Jonas made our bitpacking compatible with 
GCC and GNU-Pascal.

> And what about volatile and/or atomic semantics?

Pascal does not have volatile. It is not strictly needed either since the 
use of mem or absolute should provide sufficient information to the 
compiler it cannot optimize away reads/writes.

> Well, too many question at once. I boil it down to this one: How else do
> you write it? The original layout declaration:
> |  for SDRAM_Buffer_Control use
> |   record
> |      WB           at 0 range 0 .. 0;
> |      WB_Flush     at 0 range 1 .. 1;
> |      WB_Watermark at 0 range 2 .. 3;
> |      Read_Ahead   at 0 range 4 .. 4;
> |      --  bits [5:7] are reserved
> |   end record;

type  TSDRAM_Buffer_Control=bitpacked record
         WB:boolean; {Or 0..1, depending on your preference.}


More information about the fpc-devel mailing list