[Lazarus] Cross-compiling for Raspberry Pi2

Bo Berglund bo.berglund at gmail.com
Fri Sep 18 15:44:40 CEST 2015

On Fri, 18 Sep 2015 11:02:23 +0200, Michael Schnell
<mschnell at lumino.de> 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

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

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

More information about the Lazarus mailing list