Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-01

fpmmap arm-linux issue

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fabio Luis Girardi

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 http://sourceforge.net/projects/pascalscada http://www.pascalscada.com

Reply by email

Jonas Maebe
to Fabio Luis Girardi
Fabio Luis Girardi wrote 16 lines
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?

It sounds like a bug. I don't see anything in the RTL that intentially does this.

Jonas

Reply by email

Fabio Luis Girardi
to Jonas Maebe

Ok. I'll fill out a bug report.

Jonas Maebe wrote 27 lines
On 31/01/2020 22:17, Fabio Luis Girardi via fpc-pascal wrote: > 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? It sounds like a bug. I don't see anything in the RTL that intentially does this. Jonas _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Bo Berglund
to Fabio Luis Girardi
Fabio Luis Girardi wrote 14 lines
I'll test it tomorrow. Em Dom, 16 de fev de 2020 18:32, Florian Klämpfl escreveu: > Am 01.02.20 um 18:13 schrieb > > Agreed, the rtl should definitely divide by pagesize if MMAP2 is > > defined. I've run into this discrepancy before on ARM at work > > I have fixed it meanwhile. > _______________________________________________ > fpc-pascal maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >

This reply above winds up in a thread named "Demo threads.pp can't run" from May 2004....

Seems like there must be a message header problem here.

Bo Berglund Developer in Sweden

Reply by email

Fabio Luis Girardi
to Bo Berglund

About windows CE?

Em Seg, 17 de fev de 2020 17:12, Bo Berglund via fpc-pascal <

Show quoted text 33 lines
escreveu: On Sun, 16 Feb 2020 23:36:09 -0300, Fabio Luis Girardi via fpc-pascal wrote: >I'll test it tomorrow. > >Em Dom, 16 de fev de 2020 18:32, Florian Klämpfl >escreveu: > >> Am 01.02.20 um 18:13 schrieb >> > Agreed, the rtl should definitely divide by pagesize if MMAP2 is >> > defined. I've run into this discrepancy before on ARM at work >> >> I have fixed it meanwhile. >> _______________________________________________ >> fpc-pascal maillist - >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >> This reply above winds up in a thread named "Demo threads.pp can't run" from May 2004.... Seems like there must be a message header problem here. -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Fabio Luis Girardi
to Florian Klämpfl: Am 01.02.20 um 18:13 schrieb I have fixed it meanwhile.

Hi Florian!

Now it works as expected. Thanks!

Em dom., 16 de fev. de 2020 às 18:32, Florian Klämpfl <

Show quoted text 11 lines
escreveu: Am 01.02.20 um 18:13 schrieb > Agreed, the rtl should definitely divide by pagesize if MMAP2 is > defined. I've run into this discrepancy before on ARM at work I have fixed it meanwhile. _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com

Reply by email