Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Bo Berglund
On Sat, 19 Sep 2015 01:21:25 +0300, Maxim Ganetsky 
wrote:

>19.09.2015 1:10, Donald Ziesig ?:
>> Hi All!
>>
>> It looks like this is Raspberry PI day :-) .
>>
>> I have Lazarus working on a RPi 2 B with no problems til now.
>>
>> (Started with monitor, keyboard and mouse till I got ssh and vnc setup,
>> then switched to Remmina on my laptop via tcp/ip).
>>
>> I need to access the GPIO pins from my Lazarus program.  I have found
>> the C library "wiringPi" and many references to the FPC "hwiringPi"
>> package that wraps it, but I'll be darned if I can find "hwiringPi" itself.
>
>Strange, that you couldn't find it. This site:
>
>https://github.com/AkselMeola/Pascal-projects-on-Raspberry/tree/master/Morse-code-translator
>
>is the first for the "hwiringPi" Google query.

Strangely I also need this for my RPi2 project!
The software needs to pull two relays as part ofthe automation. So
GPIO access is needed.
Now that it popped up may I inject a question here:

The hiwiringpi.pas file is an interface to something else written in C
if I understood the text correctly.
How does that work? It seems like I have to compile something in C on
the Pi as well and it produces an *.o file. Does that act like a dll
in Windows or like a lib file that gets linked into the final
executable?

I am not really (yet) familiar wth programming in Linux


-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Graeme Geldenhuys
On 2015-09-18 at 18:50, Bo Berglund wrote:

> The hiwiringpi.pas file is an interface to something else written in C
> if I understood the text correctly.

As far as I know there is another pure Object Pascal GPIO package which
has no other dependencies. Maybe that would be a better option than the
C wrapper version I'll see if I bookmarked it or something.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Donald Ziesig

On 09/18/2015 07:50 PM, Bo Berglund wrote:

On Sat, 19 Sep 2015 01:21:25 +0300, Maxim Ganetsky 
wrote:


19.09.2015 1:10, Donald Ziesig ?:

Hi All!

It looks like this is Raspberry PI day :-) .

I have Lazarus working on a RPi 2 B with no problems til now.

(Started with monitor, keyboard and mouse till I got ssh and vnc setup,
then switched to Remmina on my laptop via tcp/ip).

I need to access the GPIO pins from my Lazarus program.  I have found
the C library "wiringPi" and many references to the FPC "hwiringPi"
package that wraps it, but I'll be darned if I can find "hwiringPi" itself.

Strange, that you couldn't find it. This site:

https://github.com/AkselMeola/Pascal-projects-on-Raspberry/tree/master/Morse-code-translator
\
is the first for the "hwiringPi" Google query.

Strangely I also need this for my RPi2 project!
The software needs to pull two relays as part ofthe automation. So
GPIO access is needed.
Now that it popped up may I inject a question here:

The hiwiringpi.pas file is an interface to something else written in C
if I understood the text correctly.
How does that work? It seems like I have to compile something in C on
the Pi as well and it produces an *.o file. Does that act like a dll
in Windows or like a lib file that gets linked into the final
executable?

I am not really (yet) familiar wth programming in Linux


There is a package written in C called wiringPi which is available on 
github.  You will need to clone it and follow the instructions to build 
it.  The hwiringPi package links to the wiringPi.o file in the wiringPi 
directory.  As of right now, I am getting a linking error which seems to 
be rather common (there are many references to it online) because I am 
using the latest RPi version 2 B.


Unfortunately my ISP has dropped my connection due to a thunderstorm so 
I am working on my cell phone (very slow).  I think I'll wait until 
tomorrow to look any further.


Don Z


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Schnell

On 09/18/2015 07:00 AM, Martin Schreiber wrote:


On Linux X86 you could use MSEide and the FPC cross compiling environment from
here:
http://mseide-msegui.sourceforge.net/pics/crossarm.png
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/


Maybe MSE is more suitable in this case, as (AFAIK) here console 
programs with an event queue is supported in Linux.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Van Canneyt



On Fri, 18 Sep 2015, Michael Schnell wrote:


On 09/18/2015 10:42 AM, Michael Van Canneyt wrote:


To the best of my knowledge, Delphi itself does not offer an event queue 
either in console programs.


In fact I doubt that the OP really intends to do a pure "console program" 
that is called by e.g. bash and runs through without waiting for anything and 
then exits.


AFAIK, with Delphi a "console program" is just a normal application that only 
does not show a Windows, but that can use e.g. TTimer in the normal 
Delphi-way.


So, we are talking about the windows event queue.

The way your post was constructed, you made it sound as if lazarus fails to 
offer what Delphi offers.
It has nothing to do with Lazarus. Linux does not have an event queue as windows has it. 
One is emulated in e.g. X11 applications, and Lazarus uses that for it's GUI, and for TTimer.


Glad we straightened that out.

I'm still waiting for your patch to create a basic TEventApplication class 
descending from TCustomApplication.
When you do, I'll be glad to include it in FPC, and as a bonus I'll even throw in an item for it under 
"new project" in File|New in the lazarus IDE...


It will then hopefully put an end to this years long bickering about event 
queues :)

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Schnell

On 09/18/2015 11:28 AM, Michael Van Canneyt wrote:


The way your post was constructed, you made it sound as if lazarus 
fails to offer what Delphi offers.


Sorry for being unclear !! (This obviously is just an issue of the word 
"Console Application".)


The contrary is true. Lazarus (at least in Linux) is able to compile 
real "pure run through" command line tools, while Delphi (AFAIK) just 
does normal "Applications" that don't show the main Windows and calls 
this a "Console Program".


In Linux, a Lazarus Console application can be used on hardware with no 
GUI system installed.


So Bo supposedly is save if he selects "Application" and not "Console 
Application" when setting up his project. In fact on a PI a GUI system 
is active by default.


Other than MSE, a Lazarus "Console Application" can't use TTimer, this 
might not be relevant for Bo on Pi.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Schnell

On 09/18/2015 01:28 AM, Bo Berglund wrote:

I have a need to port a Delphi console program written for Windows to
be used on Raspberry Pi2.


What are the steps needed to port to Pi2?


I would use a Linux desktop to do the port to Linux in the most 
comfortable way, before considering the port to ARM.


Especially with "console programs" Delphi/Windows is rather different 
from Lazarus/Linux, as in Lazarus console programs don't feature an 
Event queue.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Marco van de Voort
On Fri, Sep 18, 2015 at 11:02:23AM +0200, Michael Schnell wrote:
> AFAIK, with Delphi a "console program" is just a normal application that 
> only does not show a Windows, but that can use e.g. TTimer in the normal 
> Delphi-way.

Could you please post your Delphi test for that? Thanks.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Dennis
I have written a small program using FPC to run on Rasp Pi to connect, 
via i2c, to a temperature/humidity sensor and save the readings into a 
MySQL database.
Initially, I tried to use wiringPi, but I later found out it was very 
simple to directly connect to i2c via fpRead() . It was as simple as:


const
  I2C_SLAVE = 1795;
  CMD_SOFT_RESET : byte = $FE;
  CMD_READ_TEMP_NOHOLD : byte = $F3;
  CMD_READ_HUM_NOHOLD : Byte =  $F5;

var TheDeviceNo : integer = $40;
ThePath : String = '/dev/i2c-1';
DeviceHandle : integer;

.
   DeviceHandle := fpopen(ThePath,O_RDWR); //Open the I2C bus in 
Read/Write mode
   iio:= FpIOCtl(DeviceHandle, I2C_SLAVE, pointer(TheDeviceNo)); //Set 
options


   If (iio <> 0) or (DeviceHandle < 0) Then begin
  fpclose(DeviceHandle);
  DeviceHandle := 0;
  raise Exception.Create('Failed to open '+ThePath+' device# 
0x'+IntToStr(TheDeviceNo));

   end;

//to read a floating variable:
function ReadFloat(const TheRegNo: byte; TheOffset,  TheSlope: double): 
double;

var aBytes : array[0..3] of byte;
  i : integer;
begin
 fpwrite(DeviceHandle, TheRegNo, 1);
 Sleep(100); //for safety only. not sure if needed

 Fillchar(aBytes, sizeof(aBytes), 0);
 fpread(DeviceHandle, aBytes, 3);

//the following is only specific to the themometer which requires some 
conversion in the data read.

 if IsCRC8Ok(aBytes) then begin
   result := ((aBytes[0] shl 8) or aBytes[1] ) and ($FFFC);
   result  :=result/65536;
   result := result * TheSlope + TheOffset;
 end else
   raise ECRCError.Create('');
end;


//to reset the themometer
  fpwrite(DeviceHandle, CMD_SOFT_RESET, 1);


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Maxim Ganetsky

19.09.2015 1:10, Donald Ziesig пишет:

Hi All!

It looks like this is Raspberry PI day :-) .

I have Lazarus working on a RPi 2 B with no problems til now.

(Started with monitor, keyboard and mouse till I got ssh and vnc setup,
then switched to Remmina on my laptop via tcp/ip).

I need to access the GPIO pins from my Lazarus program.  I have found
the C library "wiringPi" and many references to the FPC "hwiringPi"
package that wraps it, but I'll be darned if I can find "hwiringPi" itself.


Strange, that you couldn't find it. This site:

https://github.com/AkselMeola/Pascal-projects-on-Raspberry/tree/master/Morse-code-translator

is the first for the "hwiringPi" Google query.

--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Maxim Ganetsky

19.09.2015 1:39, Donald Ziesig пишет:

On 09/18/2015 06:21 PM, Maxim Ganetsky wrote:

19.09.2015 1:10, Donald Ziesig пишет:

Hi All!

It looks like this is Raspberry PI day :-) .

I have Lazarus working on a RPi 2 B with no problems til now.

(Started with monitor, keyboard and mouse till I got ssh and vnc setup,
then switched to Remmina on my laptop via tcp/ip).

I need to access the GPIO pins from my Lazarus program.  I have found
the C library "wiringPi" and many references to the FPC "hwiringPi"
package that wraps it, but I'll be darned if I can find "hwiringPi"
itself.


Strange, that you couldn't find it. This site:

https://github.com/AkselMeola/Pascal-projects-on-Raspberry/tree/master/Morse-code-translator


is the first for the "hwiringPi" Google query.


Got it.  I have cataract surgery upcoming :-(


Good luck with it.


, that would have helped
me see in when I looked at it :-[ .  Thanks.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where is hwiringPi?

2015-09-18 Thread Donald Ziesig

On 09/18/2015 06:21 PM, Maxim Ganetsky wrote:

19.09.2015 1:10, Donald Ziesig пишет:

Hi All!

It looks like this is Raspberry PI day :-) .

I have Lazarus working on a RPi 2 B with no problems til now.

(Started with monitor, keyboard and mouse till I got ssh and vnc setup,
then switched to Remmina on my laptop via tcp/ip).

I need to access the GPIO pins from my Lazarus program.  I have found
the C library "wiringPi" and many references to the FPC "hwiringPi"
package that wraps it, but I'll be darned if I can find "hwiringPi" 
itself.


Strange, that you couldn't find it. This site:

https://github.com/AkselMeola/Pascal-projects-on-Raspberry/tree/master/Morse-code-translator 



is the first for the "hwiringPi" Google query.

Got it.  I have cataract surgery upcoming :-( , that would have helped 
me see in when I looked at it :-[ .  Thanks.


Don Z

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Where is hwiringPi?

2015-09-18 Thread Donald Ziesig

Hi All!

It looks like this is Raspberry PI day :-) .

I have Lazarus working on a RPi 2 B with no problems til now.

(Started with monitor, keyboard and mouse till I got ssh and vnc setup, 
then switched to Remmina on my laptop via tcp/ip).


I need to access the GPIO pins from my Lazarus program.  I have found 
the C library "wiringPi" and many references to the FPC "hwiringPi" 
package that wraps it, but I'll be darned if I can find "hwiringPi" itself.


Everything points to Alex's Lazarus forum post which starts:

"Hello,
please find attached a wrapper unit for Gordon Henderson's
wiringPi C library (https://projects.drogon.net/raspberry-pi/wiringpi) 
and a little Lazarus test program."


I can't find the attachment, and I can't find any other references to 
the code.


Help, please :'( .

Thanks,

Don Ziesig


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Sven Barth
Am 18.09.2015 11:41 schrieb "Michael Schnell" :
> The contrary is true. Lazarus (at least in Linux) is able to compile real
"pure run through" command line tools, while Delphi (AFAIK) just does
normal "Applications" that don't show the main Windows and calls this a
"Console Program".

Creating a new Console Application in Delphi creates a nearly empty project
file that contains an empty "begin...end." block with a "{$apptype
console}", so exactly what is needed for a console application that does
not show any GUI by default (the Lazarus analog is "Simple Program" or so).

Regards,
Sven
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Martin Schreiber
On Friday 18 September 2015 16:14:35 Bo Berglund wrote:

> I have not really used Lazarus except for some hello world tests and
> for checking how to port a Sentinel dongle function to FPC.
>
Now that is a chance to use MSEide instead. ;-)
MSEide runs amazingly fast on Raspberry Pi and has very good suport for 
development of embedded and microprocessor projects written in Pascal or C, 
cross development with MSEide is very comfortable. I use it daily for 
different ARM and AVR32 projects.
With MSEgui you also have a state of the art cross platform GUI toolkit with 
excellent database options at your fingertips. MSEgui probably is the most 
versatile GUI toolkit on the market.

Martin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Bo Berglund
On Fri, 18 Sep 2015 11:02:23 +0200, Michael Schnell
 wrote:

>On 09/18/2015 10:42 AM, Michael Van Canneyt wrote:
>>
>> To the best of my knowledge, Delphi itself does not offer an event 
>> queue either in console programs.
>
>In fact I doubt that the OP really intends to do a pure "console 
>program" that is called by e.g. bash and runs through without waiting 
>for anything and then exits.
>
...
>
>I was just trying to be helpful to the OP, and I think - not only 
>because of the potential issue I described - it is a good idea to split 
>the porting task in porting from Delphi/ Windows to Lazarus/Linux and 
>then form PC to ARM. (Been there, learned my lesson.)  With a complex 
>Project, it even could be viable to do a port from Delphi to Lazarus on 
>Windows first).

Thanks for your suggestions!
I think I need to explain more what I am after

What I want to do is the following:

I want to create an automation function running on the RPi2 for
managing a data monitoring system to collect data for detecting
imminent risk of failure of dams.
The system would work as follows:
- An instrument collects data from a number of sensors on the dam
- The instrument is essentially designed to be manually operated so
the Pi is there to automate it
- It has a communications channel via a WiFi adapter hooked to its
serial port and there are commands to do whatever needed
- Via this channel it is possible to command a measure cycle and to
download the resulting data
- So a schedule needs to be set up to tell the instrument to do two
different measure cycles at certain times
- The data will be downloaded to the RPi2 when the cycle finishes in
order to free memory on the instrument
- Access to the data will be provided on the RPi2 via a mobile network
router also connected to the RPi2
- The whole system will be deployed unattended for long periods
(months-years)

I have previously built systems like this using a Windows PC to
automate the instrument and using serial communications. The software
was written using Delphi 7 as a Windows service controlled via
settings in the Registry.

Now we need to shrink and ruggedize the system and I wanted to use an
RPi2 to implement the controller. It would be dual homed with a wired
connection to the router and a WiFi connection to the instrument which
emulates the serial link.

Yesterday I realized that it would be a large task to re-invent the
software on the Pi using for example python since I am not at all
familiar with that language.
Then it dawned on me that freepascal is multi-platform and I colud
possibly port existing Delphi code over to the Pi, thus reducing the
amount of work needed. I have used a serial comm component in the
existing code but I figured I could replace that by an Indy TCP client
component instead. Apart from that there are only standard functions
used and no user interface.

So that is why I am here now. I have used RPi units for a lot of
things at home (I run media centers, printer servers, VPN servers and
such things using 4 different Pi:s). So it is a natural to try this
road...

I am still looking for the proper way to go. Possibly first starting
from my existing Delphi software and creating the cut down unattended
software on Windows and then porting over to the Pi. Windows services
is not possible of course so I figured I could make a console program
started by cron instead.

What would be the best way in your view?


-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Martin Schreiber
On Friday 18 September 2015 16:08:20 Martin Schreiber wrote:
> 2. Port the FPC Windows to FPC Linux X86 on a Linux X86 PC.
2. Port the FPC Windows application to FPC Linux X86 on a Linux X86 PC.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Graeme Geldenhuys
On 2015-09-18 at 00:43, Bo Berglund wrote:

> It seems like an easier way to build directly on the end hardware than
> crosscompiling.

Yeah, that's what I've been doing for years, and it works very well. I
have an original RPi, so even less memory and CPU power, so I opted not
to use Lazarus IDE or LCL. Maximus or MSEide only use 15-25MB of RAM
(compared to Lazarus's 100+MB for the same project).

You can obviously compile from the command line too and use any
lightweight text editor if you want.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Martin Schreiber
On Friday 18 September 2015 15:44:40 Bo Berglund wrote:
> On Fri, 18 Sep 2015 11:02:23 +0200, Michael Schnell

>
> What would be the best way in your view?

1. Port the Delphi 7 application to FPC Windows X86 on a Windows X86 PC.
2. Port the FPC Windows to FPC Linux X86 on a Linux X86 PC.
3. Cross compile and cross debug the Linux application to RaspberryPi on the 
Linux X86 PC.

Martin 


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Bo Berglund
On Fri, 18 Sep 2015 16:08:20 +0200, Martin Schreiber
 wrote:

>On Friday 18 September 2015 15:44:40 Bo Berglund wrote:
>> On Fri, 18 Sep 2015 11:02:23 +0200, Michael Schnell
>
>>
>> What would be the best way in your view?
>
>1. Port the Delphi 7 application to FPC Windows X86 on a Windows X86 PC.
>2. Port the FPC Windows to FPC Linux X86 on a Linux X86 PC.
>3. Cross compile and cross debug the Linux application to RaspberryPi on the 
>Linux X86 PC.
>
Thanks!
I have Lazarus installed on my laptop so I guess I can start right
away to cut and paste code from my existing project and create the
console app on Windows but in Lazarus then.
I have not really used Lazarus except for some hello world tests and
for checking how to port a Sentinel dongle function to FPC.

I'll probably ask some more, but how does one go about getting Indy10
onto Lazarus/FPC?


-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Van Canneyt



On Fri, 18 Sep 2015, Michael Schnell wrote:


On 09/18/2015 01:28 AM, Bo Berglund wrote:

I have a need to port a Delphi console program written for Windows to
be used on Raspberry Pi2.


What are the steps needed to port to Pi2?


I would use a Linux desktop to do the port to Linux in the most comfortable 
way, before considering the port to ARM.


Especially with "console programs" Delphi/Windows is rather different from 
Lazarus/Linux, as in Lazarus console programs don't feature an Event queue.


To the best of my knowledge, Delphi itself does not offer an event queue either 
in console programs.

If you are talking about thread queues: the mechanisms in Delphi and Lazarus 
are exactly the same.
If you are talking about the windows 'event system': this is a windows concept, 
not a linux concept.
Linux has different mechanisms entirely. This is unrelated to 
Delphi/Lazarus/FPC whatever.

I really do not appreciate this kind of derogatory comments.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Schnell

On 09/18/2015 10:42 AM, Michael Van Canneyt wrote:


To the best of my knowledge, Delphi itself does not offer an event 
queue either in console programs.


In fact I doubt that the OP really intends to do a pure "console 
program" that is called by e.g. bash and runs through without waiting 
for anything and then exits.


AFAIK, with Delphi a "console program" is just a normal application that 
only does not show a Windows, but that can use e.g. TTimer in the normal 
Delphi-way.




If you are talking about thread queues: the mechanisms in Delphi and 
Lazarus are exactly the same.
AS the OP did not mention threads, I was mainly thinking of TTimer (I 
should have better written "TTimer" instead of "Event-Queue", even 
though under the hood this means the same in that issue) .


If you are talking about the windows 'event system': this is a windows 
concept, not a linux concept. Linux has different mechanisms entirely. 
This is unrelated to Delphi/Lazarus/FPC whatever. 
With Lazarus the User does not need to be aware that under the hood the 
Event Queue in the Windows and Linux brand of the LCL is implemented in 
a different way. Lazarus rather perfectly hides this. (But not with 
"Console Applications").




I really do not appreciate this kind of derogatory comments.


I did not mean to sound derogatory at all. I am very happy that the 
maintainers of the FPC and Lazarus Project do this great work.


I was just trying to be helpful to the OP, and I think - not only 
because of the potential issue I described - it is a good idea to split 
the porting task in porting from Delphi/ Windows to Lazarus/Linux and 
then form PC to ARM. (Been there, learned my lesson.)  With a complex 
Project, it even could be viable to do a port from Delphi to Lazarus on 
Windows first).


-Michael


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Mark Morgan Lloyd

Bo Berglund wrote:

I found a guide t o install FPC-Lazarus directly on the Pi2 itself
here:
http://www.tweaking4all.com/hardware/raspberry-pi/install-lazarus-pascal-on-raspberry-pi-2/

It seems like an easier way to build directly on the end hardware than
crosscompiling. But the CPU power might be a limiting factor of
course. I will make an attempt at doing this first and see how it
goes.
I can always try cross-compilation later.


Bo, I did that on the original RPi at the end of last month. You'll need 
a couple of the Debian -dev packages (yell if you want me to check my 
notes) but the important things are (a) you'll need at least 512Mb of 
RAM+swap available and (b) remember that you can run the IDE etc. over 
SSH- you don't need a local screen and keyboard.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Dennis
FYI, I have done FPC daemon to run on RPi to communicate with Serial 
port and the feed the data back to a PC program from time to time via 
LAN.  It is not very difficult.
However, I had difficulties using Indy on FPC and eventually gave up. I 
later moved to lNet because it runs on linux and supports SSL.
If I had to redo it, I would do it in synapse, especially if I don't 
need SSL.


For the loop, I would loop infinitely in the console program.
A better way if you don't mind is to create a few threads. One for 
collection data and another for communicating on the LAN.


Nowadays, a raspberry pi has much more RAM and faster CPU. It would make 
it even easier.



For writing daemon, just refer to FPC wiki.


Dennis

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Bo Berglund
On Fri, 18 Sep 2015 11:40:53 +0200, Michael Schnell
 wrote:

>
>So Bo supposedly is save if he selects "Application" and not "Console 
>Application" when setting up his project. In fact on a PI a GUI system 
>is active by default.
>
>Other than MSE, a Lazarus "Console Application" can't use TTimer, this 
>might not be relevant for Bo on Pi.

On the Windows service application I am checking every minute if a
start time for a measure task has occurred and then I run the process
to get the measurement going.
I probably have to do something about the way to handle the scheduling
in Linux, either by programmatically setting up cron jobs or by having
my program run in an eternal loop and checking the time in every loop
iteration.
Or is there a better way on Linux?
As described my Windows application is a service and I am not porting
that, I only want to use all of the ObjectPascal classes I created for
the handling of the instrumentation but using whatever scheduling
functionality that may be available in Linux.
And I have to include an Indy TCP Client too

-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Bo Berglund
On Fri, 18 Sep 2015 16:43:38 +0200, Martin Schreiber
 wrote:

>On Friday 18 September 2015 16:14:35 Bo Berglund wrote:
>
>> I have not really used Lazarus except for some hello world tests and
>> for checking how to port a Sentinel dongle function to FPC.
>>
>Now that is a chance to use MSEide instead. ;-)
>MSEide runs amazingly fast on Raspberry Pi and has very good suport for 
>development of embedded and microprocessor projects written in Pascal or C, 
>cross development with MSEide is very comfortable. I use it daily for 
>different ARM and AVR32 projects.
>With MSEgui you also have a state of the art cross platform GUI toolkit with 
>excellent database options at your fingertips. MSEgui probably is the most 
>versatile GUI toolkit on the market.
>
>Martin

OK, I will have a look when I get a chance. Right now I am specing
down the project and am investigating my different options.
I know Delphi (obviously) and a little about Lazarus. But MSE is news
to me


-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Graeme Geldenhuys
Hello Bo,

On 2015-09-18 at 11:12, Bo Berglund wrote:
> Does that mean I can install FPC only on the Pi and then develop on a
> Linux box (x86) using Lazarus and then move the project to the Pi and
> recompile using the FPC from a terminal on the Pi?

Yes, that is an option too, and should work just fine - especially
since you said the project is a console program.

If you developed a GUI application, then the RPi would need the *.ppu
files for the GUI toolkit too. But this is irrelevant in your case.



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Bo Berglund
On Fri, 18 Sep 2015 14:20:43 +0100, Graeme Geldenhuys
 wrote:

>On 2015-09-18 at 00:43, Bo Berglund wrote:
>
>> It seems like an easier way to build directly on the end hardware than
>> crosscompiling.
>
>Yeah, that's what I've been doing for years, and it works very well. I
>have an original RPi, so even less memory and CPU power, so I opted not
>to use Lazarus IDE or LCL. Maximus or MSEide only use 15-25MB of RAM
>(compared to Lazarus's 100+MB for the same project).
>
>You can obviously compile from the command line too and use any
>lightweight text editor if you want.
>

Does that mean I can install FPC only on the Pi and then develop on a
Linux box (x86) using Lazarus and then move the project to the Pi and
recompile using the FPC from a terminal on the Pi?
Anything I need to take into account for that to work?


-- 
Bo Berglund
Developer in Sweden


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cross-compiling for Raspberry Pi2

2015-09-18 Thread Michael Van Canneyt



On Fri, 18 Sep 2015, Martin Schreiber wrote:


On Friday 18 September 2015 16:14:35 Bo Berglund wrote:


I have not really used Lazarus except for some hello world tests and
for checking how to port a Sentinel dongle function to FPC.


Now that is a chance to use MSEide instead. ;-)
MSEide runs amazingly fast on Raspberry Pi and has very good suport for
development of embedded and microprocessor projects written in Pascal or C,
cross development with MSEide is very comfortable. I use it daily for
different ARM and AVR32 projects.
With MSEgui you also have a state of the art cross platform GUI toolkit with
excellent database options at your fingertips. MSEgui probably is the most
versatile GUI toolkit on the market.


Quite cheeky, posting this on a Lazarus list :)

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus