Forum > Embedded

Lazarus Pascal cross compile Raspberry pi PICO

(1/3) > >>

andrew Bubble:
Hi All

I need some assistance in trying to find out why my Lazarus Pascal shows an error when opening any examples for the PICO.

I have had quite a issues trying to install the correct version of Lazarus and freePascal on a Raspberry PI 400 running the 32 bit OS of Bookworm.

On a fresh install of Bookworm on the SD card and after running any updates, I  did the following

// This only for PI Os (Bookworm)
sudo raspi-config noint do_wayland W1

// Required dependencies for Lazarus
sudo apt install libx11-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev git

As per previous issues with Lazarus and Bookworm I did the following
sudo raspi-config noint do_wayland W1

I then installed the latest version of fpcupdeluxe v2.4.0c.

This is where my issues have been, as I need to select embedded for fpc and a suitable version for the Lazarus, I have tired the stable and trunk but the install fails with the exit code 512.

I eventually got the install to work with using the embedded for fpc and v2.26 for Lazarus. I then installed for the cross arm and embedded and as advised else where selected the armv6m for the set subarch and installed the compiler. All installed ok.

Also as advised I installed the develtools4fpc in the modules section.

When I run Lazarus and open any of the examples I get the following error 'The project uses target OS=embedded and CPU=arm. The system ppu for this target was not found.

I tried the simple Blinky example which showed the above error when I tried to open it, however it still opens and if I select Build it compiles very quickly and does so correctly.

I copied the *.uf2 file to the Pico and the led flashed as normal, skeptical I altered the timings in the blinky pas file and re built and coped the new uf2 file to the PICO and the led flashed as expected with the altered timings.

SO to recap I can clearly modify any of the examples changing the code and see the result, however I cannot make a new project and somehow select the Pico as Lazarus treats any new project as a Raspberry pi Linux project.

Any ideas

Regards Andrew

 I am not sure I fully understand you, but Lazarus and FPC should not be compiled for embedded. Just the cross- compiler for the Pico needs to be for embedded target..
There is no way to run FPC nor by extension Lazarus on a Pico, but you can run any code - within the constraints of the Pico - on a Pico when cross-compiled.
The second interpretation is that somehow the IDE picks up something wrong and that would definitely be a bug. That said, I have not compiled for Pico a few months (3) so some things may have changed.
I suppose you are using trunk or 3.2 fixes?
The third interpretation is that the compiler can not find any system.pp.
Have you tried adding a stub unit system.pp? The compiler expects that, also on embedded.
(A stub unit is cheating, you likely need a very basic system for some inevitable language support)
AFAICR I never ran into trouble.

andrew Bubble:
Hi Thaddy

I am sorry for the confusion, I was simply trying to get to the right fpc and Lazarus to install on my pi 400.

As an update, I have just tried to from a fresh SD card install of Bookworm 32 bit.

I used the fpc version embedded and the trunk version but had the install failed on the following

laz_xmlstreaming,pas(85,15) Error: (3058) there is not method in an ancestor class to be overridden "WriteString(const RawByteString);"
laz_xmlstreaming.pas(158,1) Fatal: (10026) there were 1 errors compiling module, stopping.

Then the install fails.

Can you suggest a suitable Lazarus I could try, the list states trunk, stable. fixes, fixes-3.0, fixes-2.6.

The reason I chose the 2.26 is I had used this before.

Once the two install is there some settings I need to do to Lazarus / configuration when I make a new Pico application.

Regards Andrew

andrew Bubble:
Hi All

Just an update, I made a Windows 10 VMWare on my PC and installed fpcpdeluxe and selected the Pico ad waited until everything installed, which it did with no options.

I assumed that as this installed all ok there would be an option to select a Pico as a new project but there was not.

Opening any of the example projects yielded the same error - 'The project uses target OS=embedded and CPU=arm. The system ppu for this target was not found.

However as before I can still build the project and everything works as before.

One thing I can do is take one of the examples and save the project as and give a different name and use this as a basis.

My question is, is this how the Pcio cross compiling is to be used, this is workable but seeing the error message made look for something I had done wrong or a step I had missed.

Regards Andrew

Would you mind trying this ?
In the Lazarus Tools menu, there is an option called "Rescan FPC source directory".
It might be that your problems are solved after using this command.


[0] Message Index

[#] Next page

Go to full version