Re: [fpc-pascal] Linking error with unit initc on arm

2015-08-22 Thread Jonas Maebe

Martin Schreiber wrote:

Looks the same with

Linux X86 cross: 2.24.0.20141017
from binutils-2_24-branch.


Try
* generating linker maps (ppcarm -Xm) for both binaries and comparing them
* running readelf -aW on both binaries and compare the output
* runrunning objdump -DR on both binaries and compare the output


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] I-Pascal: IDE based on IntelliJ platform

2015-08-22 Thread ARGB32
l Under *nix platforms, FPC layout is slightly different. At least bin and
l units by default doesn't have the same direct parent (/usr/bin vs
l /usr/lib/fpc/$fpcversion/units). Does this mean your plugin doesn't work
l there?

I'm  using Linux and CodeTyphoon which  places  all  FPC-related  files in one
directory and initially I didn't know of any problems.

OSX users reported the problem with paths.
The right directory for SDK is parent of units (offered automatically).
/usr/bin is checked for fpc executable.
So it should work.

If  someone knows better ways to determine locations of fpc executable
and RTL DCUs please let me know.

---
Best regards, George

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Linking error with unit initc on arm

2015-08-22 Thread Martin Schreiber
On Saturday 22 August 2015 10:25:19 Jonas Maebe wrote:
 Martin Schreiber wrote:
  Looks the same with
 
  Linux X86 cross: 2.24.0.20141017
  from binutils-2_24-branch.

 Try
 * generating linker maps (ppcarm -Xm) for both binaries and comparing them
 * running readelf -aW on both binaries and compare the output
 * runrunning objdump -DR on both binaries and compare the output

Got it working! The (hopfully) last problem was a transmission problem PC - 
Pi so I checked a wrong binary, thank you very much for your help.

Martin
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Fatal: Internal error 200305103

2015-08-22 Thread Ched

Hello,

The 2.6.0 version which comes with apt-get is plenty of bugs. Installing the 2.6.4 downloaded from the 
link in the freepascal site makes it workable, at least for my programs, perfectly. So do the upgrade !


Cheers, Raoul





Le 22. 08. 15 16:44, Xiangrong Fang a écrit :

Hello,

I got Fatal: Internal error 200305103 while try to compile the attached file 
on my raspi.

The file is a class helper. I wonder if that is supported on FPC 2.6.0 or not? 
And whether this problem
has anything to do with ARM?




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Cross compiling and debugging Linux-X86 - Raspberry Pi

2015-08-22 Thread Martin Schreiber
Hi,

There are new versions of the cross development environment for FPC 3.0.1:

http://mseide-msegui.sourceforge.net/pics/crossarm.png
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/

For integrated development with FPC 3.0.1 MSEide+MSEgui git master version is 
necessary:

https://gitlab.com/mseide-msegui/mseide-msegui

From MSEide+MSEgui README.TXT:

Crosscompiling and remote debugging i386-linux - arm-linux
***
For Raspberry Pi:
- Establish a ssh login without password (public key authentication).

- On the i386-linux host install the scp program
- download and extract 
  
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/crossfpc-i386_linux-eabihf_3_0_1.tar.gz
  to your crossfpc directory.

- Start MSEide, in 'Settings'-'Configure MSEide'-'Global Macros' add:

Name  Value

CROSSMSEDIR   MSEide+MSEgui directory
CROSSFPCDIR   your crossfpc directory
HOSTIPthe IP of the host
REMOTEIP  the IP of the remote target
REMOTEPORTthe remote port, ex: 2345
REMOTEUSERpi

- 'Project'-'New'-'From Template', select crossarmdefault.prj or
  crossarmconsole.prj.
- Create the new project.
- 'Project'-'Options'-'Macros', set the TARGETPROJECTDIR value to the project
  path in remote target, ex: /home/pi/proj/testcase.
- Check the TARGETENV macro.
- If your application needs additional libraries copy them from Raspberry Pi
  /lib/arm-linux-gnueabihf or /usr/lib/arm-linux-gnueabihf to
  your crossfpc directory/eabihf/lib

Press F9 and hope the best. ;-)


MSEide+MSEgui also runs amazingly fast native on the Raspberry Pi.

Martin
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Fatal: Internal error 200305103

2015-08-22 Thread Xiangrong Fang
Hello,

I got Fatal: Internal error 200305103 while try to compile the attached
file on my raspi.

The file is a class helper. I wonder if that is supported on FPC 2.6.0 or
not? And whether this problem has anything to do with ARM?
unit cipher;
{$mode objfpc}{$H+}
interface
uses sysutils, BlowFish;
type
  TBlowFish = BlowFish.TBlowFish;
  TBlowFishModes = class helper for TBlowFish
  private
procedure CryptCTR(IV: QWord; buf: Pointer; len: Integer); inline;
  public
constructor Create(key: Pointer; KeySize: Integer);
procedure EncryptCTR(IV: QWord; buf: Pointer; len: Integer);
procedure DecryptCTR(IV: QWord; buf: Pointer; len: Integer);
procedure EncryptCBC(IV: QWord; buf: Pointer; len: Integer);
procedure DecryptCBC(IV: QWord; buf: Pointer; len: Integer);
  end;

implementation

constructor TBlowFishModes.Create(key: Pointer; KeySize: Integer);
begin
  inherited Create(PBlowFishKey(key)^, KeySize);
end;

procedure TBlowFishModes.EncryptCTR(IV: QWord; buf: Pointer; len: Integer);
begin
  CryptCTR(IV, Buf, len);
end;

procedure TBlowFishModes.DecryptCTR(IV: QWord; buf: Pointer; len: Integer);
begin
  CryptCTR(IV, Buf, len);
end;

procedure TBlowFishModes.CryptCTR(IV: QWord; buf: Pointer; len: Integer);
var
  i, cnt, res: Integer;
  ipt: QWord;
  iptb: array[0..7] of Byte absolute ipt;
  ptb: PQWord;
  ptr: PByte;
begin
  cnt := len div 8;
  res := len mod 8;
  for i := 0 to cnt - 1 do begin
ipt := IV xor i;
Encrypt(TBFBlock(ipt));
ptb := PQWord(buf + i * 8);
ptb^ := ptb^ xor ipt;
  end;
  if res  0 then begin //process last block less than 8 byte
ipt := IV xor cnt;
for i := 0 to res - 1 do begin
  ptr := PByte(buf + cnt * 8 + i);
  ptr^ := ptr^ xor iptb[i];
end;
  end;
end;

procedure TBlowFishModes.EncryptCBC(IV: QWord; buf: Pointer; len: Integer);
var
  i, cnt, res: Integer;
  ptb: PQWord;
  last, prelast: QWord;
begin
  if len = 8 then begin
CryptCTR(IV, buf, len);
Exit;
  end;
  cnt := len div 8;
  res := len mod 8;
  if res = 0 then begin
prelast := PQWord(buf+(cnt-2)*8)^;
last := PQWord(buf+(cnt-1)*8)^;
res := 8;
Dec(cnt, 2);
  end else begin
prelast := PQWord(buf+(cnt-1)*8)^;
last := PQWord(buf+cnt*8)^;
Dec(cnt);
  end;
  for i := 0 to cnt - 1 do begin
ptb := PQWord(buf + i * 8);
ptb^ := ptb^ xor IV;
Encrypt(TBFBlock(ptb^));
IV := ptb^;
  end;
  prelast := prelast xor IV;
  Encrypt(TBFBlock(prelast));
  Move(prelast, PByte(buf+(cnt+1)*8)^, res);
  last := last xor prelast;
  Encrypt(TBFBlock(last));
  PQWord(buf+cnt*8)^ := last;
end;

procedure TBlowFishModes.DecryptCBC(IV: QWord; buf: Pointer; len: Integer);
type
  QWB = array[0..7] of Byte;
var
  i, cnt, res: Integer;
  ptb: PQWord;
  ctx: QWord;
  last, prelast: QWord;
begin
  if len = 8 then begin
CryptCTR(IV, buf, len);
Exit;
  end;
  cnt := len div 8;
  res := len mod 8;
  if res = 0 then begin
prelast := PQWord(buf+(cnt-2)*8)^;
last := PQWord(buf+(cnt-1)*8)^;
Dec(cnt, 2);
  end else begin
prelast := PQWord(buf+(cnt-1)*8)^;
last := PQWord(buf+cnt*8)^;
Dec(cnt);
  end;
  for i := 0 to cnt - 1 do begin
ptb := PQWord(buf + i * 8);
ctx := ptb^;
Decrypt(TBFBlock(ptb^));
ptb^ := ptb^ xor IV;
IV := ctx;
  end;
  Decrypt(TBFBlock(prelast));
  if res  0 then begin
for i := res to 7 do QWB(last)[i] := QWB(prelast)[i];
  end else res := 8;
  prelast := prelast xor last;
  Move(prelast, PByte(buf+(cnt+1)*8)^, res);
  Decrypt(TBFBlock(last));
  PQWord(buf+cnt*8)^ := last xor IV;
end;

end.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] I-Pascal: IDE based on IntelliJ platform

2015-08-22 Thread Sven Barth
Am 22.08.2015 15:28 schrieb ARGB32 armorcava...@narod.ru:

 If  someone knows better ways to determine locations of fpc executable
 and RTL DCUs please let me know.

For the unit paths parsing fpc.cfg (by default on *nix either /etc/fpc.cfg
or ~/.fpc.cfg) might be the best solution.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal