[fpc-pascal] fpmmap arm-linux issue

Fabio Luis Girardi fluisgirardi at gmail.com
Fri Jan 31 22:17:20 CET 2020

Hi all!

I'm porting a program written in C that uses mmap (fpmmap) that maps GPIOs
and other utilities on a beaglebone. Everything is going well, until the
test, where I see the all base address of beaglebone  in FPC should be
divided by 4096 dec ($1000 hex) to get it working. Example:

In C:

CM_BaseAddr = mmap(NULL, 0x4000, PROT_READ | PROT_WRITE,
    MAP_SHARED,  devmemfd, *0x44e00000*);

to get the "same" code working in FPC I have to change some constants.

CM_BaseAddr := Fpmmap(NULL, $4000, PROT_READ + PROT_WRITE,
      MAP_SHARED,  devmemfd, *$44e00*);

I did a strace in the FPC executable, and the in line above, the base
address is "multiplied" by 4096 dec ($1000 hex)  becoming back equal to the
C constant.

The question is: this is intentional? Has some technical point that's not
mentioned on the fpmmap documentation? Or it's simply a bug?

The best regards,

Fabio Luis Girardi
PascalSCADA Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200131/9c531e31/attachment.html>

More information about the fpc-pascal mailing list