Recent

Author Topic: how do i build for rpi on windows  (Read 2217 times)

petex

  • Jr. Member
  • **
  • Posts: 93
how do i build for rpi on windows
« on: January 30, 2025, 06:05:35 pm »
I have Lazarus installed on my PC and a rasberry PI. I can build programs on the rpi successfully but it is slow and I would prefer to cross compile an image on Windows.

I have installed the ARM cross compiler on windows and can produce objects (.o). I can succesfully build these into a library and included them on a build on the rpi.

I have yet been able to produce a build (.elf) that I can transfer to the rpi and run immediately. I tried to include unix .pas sources from various rtl locations but had errors compiling them. I also don't know what other units and libraries are required to link.

Is it possible to copy the necessary units and libraries from the rpi installation and install them on windows ? or is there a release of this somewhere. I am using fpcupdeluxe to install.

Thaddy

  • Hero Member
  • *****
  • Posts: 18529
  • Here stood a man who saw the Elbe and jumped it.
Re: how do i build for rpi on windows
« Reply #1 on: January 30, 2025, 06:40:54 pm »
Sigh.
Fpcupdeluxe will install everything to compile for rpi for years....
What exactly is your problem?

This may read as not really friendly, but I can only help you if you are not more specific.
There should not be - and is not - a problem in building a cross-compiler for rpi from windows.

That said, why not building on the Pi itself?, because that also works since Pi one, 10 years + with a swap size increase.
« Last Edit: January 30, 2025, 06:43:56 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

petex

  • Jr. Member
  • **
  • Posts: 93
Re: how do i build for rpi on windows
« Reply #2 on: January 30, 2025, 08:30:32 pm »
Are you DeepSeek ?


PascalDragon

  • Hero Member
  • *****
  • Posts: 6238
  • Compiler Developer
Re: how do i build for rpi on windows
« Reply #3 on: January 30, 2025, 08:43:46 pm »
I have installed the ARM cross compiler on windows and can produce objects (.o). I can succesfully build these into a library and included them on a build on the rpi.

Is this ARMHF, ARM with software floating point or ARM64/Aarch64?

I have yet been able to produce a build (.elf) that I can transfer to the rpi and run immediately. I tried to include unix .pas sources from various rtl locations but had errors compiling them. I also don't know what other units and libraries are required to link.

To link for a *nix target you need to have all the referenced libraries (*.so) available on your Windows system to be able to successfully generate a binary (library or executable).

Alternatively you can compile with the option -st (aka link on target) which will generate a ppas.sh, and a link*.res. These two together with all object files referenced in the link*.res you need to copy to your Pi and then execute the script which should generate the final binary.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8515
Re: how do i build for rpi on windows
« Reply #4 on: January 30, 2025, 09:09:54 pm »
Are you DeepSeek ?

We can do without that, if you don't mind.

I've been building my own FPC and Lazarus binaries since the early '00s, but for the specific case of cross-compilers I'm in full agreement with Thaddy: use Fpcupdeluxe (or what exactly is your problem?).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

petex

  • Jr. Member
  • **
  • Posts: 93
Re: how do i build for rpi on windows
« Reply #5 on: January 30, 2025, 09:13:15 pm »
Thanks, but i got it ....

Lazarus builds prog.elf,prog.hex and "prog". I was getting unstuck trying to run "prog.elf".

Also needed reference to ".....................\fpc\units\arm-linux\rtl\"

FcupDeluxe is fine, select the "Cross" tab, select ARM cpu and LINUX OS on the columns of radio buttons.
« Last Edit: January 30, 2025, 09:28:26 pm by petex »

petex

  • Jr. Member
  • **
  • Posts: 93
Re: how do i build for rpi on windows
« Reply #6 on: January 30, 2025, 09:21:41 pm »
honestly guys, you are not really being helpful and jumping to conclusions. I have seen a lot of conficting stuff to get this working. Maybe i didn't make it clear, but i always generally use fpcupdeluxe to install (its not always worked) . I did say that i had the x compiler working.
I was hoping there was a simple newbie guide around. Amazingly typing the query into chatGpt gave me a convincing guide.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8515
Re: how do i build for rpi on windows
« Reply #7 on: January 30, 2025, 09:24:33 pm »
Sorry, but "AI" is a bit of a dirty word around here since people are inclined to post "AI-generated" solutions which risks other AIs assuming that the code is correct...

Seriously, Fpcupdeluxe is very good indeed: I used it to get (among other things) a Pi-Pico development environment off the ground.

I'd suggest that you also need to ask yourself /why/ your Pi is slow. In particular, you need to consider that /if/ you've increased the amount of working memory by swapping to the SD-Card that those devices (as well as being notoriously slow) lack any form of wear leveling which means that their ability to tolerate that role is limited.

(Back in the day, an NSLU-2 would take a week to build Lazarus, but it /would/ work and the result was usable).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

petex

  • Jr. Member
  • **
  • Posts: 93
Re: how do i build for rpi on windows
« Reply #8 on: January 30, 2025, 09:40:15 pm »
Have you asked chatGPT to write a simple program ? The unwary are often amazed but it tends to invent stuff. That said, its handy to figure out simple syntax stuff when writing with an unfamiliar language so i'm not a complete luddite.

"Slow" is pretty subjective -- I much prefer the convenience of working on a PC, plus I hope it is easier to get updates.
I'm just love working with Lazarus and Pascal and its amazing that it can x compile to so much and it is so solid.

petex

  • Jr. Member
  • **
  • Posts: 93
Re: how do i build for rpi on windows
« Reply #9 on: January 30, 2025, 09:57:04 pm »
The real reason for playing around with this is ......

I have written a system to run on a pi using Ultibo. This is quite impressive with its bare metal approach, and it has a lot of built in goodies e.g. file handling, wifi, usb etc. It can be developed on the PC using Lazarus and runs in memory, so it is fast and a has quick boot time.

Now i wanted to write a system to use the "motion" linux package, but Ultibo seems not to have any clean way of accessing stuff written for linux.

I have been investigating TinyCore linux for the rpi. This again runs in memory and has a fast boot time. I am trying to see if I can take the "Ultibo" approach but be able to take advantage of all the Linux goodies.

 

TinyPortal © 2005-2018