[fpc-devel] Freepascal in microcontrollers
Vinzent Hoefler
JeLlyFish.software at gmx.net
Wed Feb 27 13:55:16 CET 2008
On Wednesday 27 February 2008 12:21, Daniƫl Mantione wrote:
> 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.
Well, the first version of the software I am maintaining appeared around
1992, too. There still were IFDEFs for TP4 in it.
> > 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.
For me it's a matter of the hardware.
> 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.
Great. And surely the PCI-board registers are compatible with GCC (oh,
and if so, which compiler version then?).
> > 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.
No. Global variables in threading context are just as volatile as any
memory-mapped hardware might be. And how should the compiler know that
a given pointer actually points to a memory-mapped hardware register if
you can't tell it? Sure, so far I did not have problems with such (I
don't use too many global variables, the embedded hardware is
programmed in another language anyway, and I only (mis)use types as
atomic, if I can sufficiently guarantee that in most circumstances the
access will be atomic indeed).
Vinzent.
More information about the fpc-devel
mailing list