Hi
I hope I am posting this in the right place!
I produced a program on my RasPi, model 2 B, using fpc 3.1.1 and lazarus 1.5. It works fine.
I have now moved to a RasPi model 3 with fpc 3.0.0 and lazarus 1.7. It uses Jessie as opposed to Raspbian on the model 2.
fpc and lazarus were installed from the script at:
http://cache.getlazarus.org/download/raspberry/setup.sh.
lazarus seems to work fine as I made a simple program and it worked as expected.
After that, I copied just the executable of my program to the model 3. It runs but there are 3 areas of problems:
1). The close button on the main form, when clicked, stops the program but does not close the window. Need to use kill to get rid of it.
2). I am not getting data from either of 2 USB ports, ttyUSB0 and 1, although data can be sent/received to the connected devices via putty.
3). I have a thread timer which is doing precisely nothing!
Next, I copied all the source code and built. It built fine, but on running it, it behaved as the executable from the model 2 had.
It therefore seems that the code being produced is not right for processor or os?
I notice that in most units on the model 2's lazarus, there is the line {$mode objfpc}{$H+}
whereas on the model 3's lazarus, it is {$mode delphi} . I think these statements tell the compiler the target? Why delphi?
The units for the serial port routines, sdposerial.pas, synafpc.pas, synaser.pas and synautil.pas don't have the {$mode objfpc}{$H+}, but instead start as below:
//old Delphi does not have MSWINDOWS define.
{$IFDEF WIN32}
{$IFNDEF MSWINDOWS}
{$DEFINE MSWINDOWS}
{$ENDIF}
{$ENDIF}
//Kylix does not known UNIX define
{$IFDEF LINUX}
{$IFNDEF UNIX}
{$DEFINE UNIX}
{$ENDIF}
{$ENDIF}
{$IFDEF FPC}
{$MODE DELPHI}
{$IFDEF MSWINDOWS}
{$ASMMODE intel}
{$ENDIF}
{define working mode w/o LIBC for fpc}
{$DEFINE NO_LIBC}
{$ENDIF}
{$Q-}
{$H+}
{$M+}
So, with fpc we get $mode delphi and $H+. I don't profess to understand what these terms do!
I changed the $mode statements in my source units to {$mode delphi}. Now when I compile, I get an error in Sdposerial.pas:
"Error variable identifier expected".
In the following procedure:
procedure TComPortReadThread.Execute;
begin
try
while not MustDie do begin
if Owner.FSynSer.CanReadEx(100) then
Synchronize(@CallEvent);
end;
finally
Terminate;
end;
end;
the line with Synchronize(@CallEvent) is highlighted.
I presume there needs to be changes to the directives in the serial units?
Can anyone suggest what the problem is and how to move forward please?
Thanks
Brian