Recent

Author Topic: Lazarus cross-compiler for embedded arm  (Read 2952 times)

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Lazarus cross-compiler for embedded arm
« on: September 18, 2025, 01:57:30 pm »
Hi,
 despite having a separate copy of Lazarus for compiling for arm I wanted the same option for compiling for arm in my normal (normal=windows os) installation. I used fpcupdeluxe as ususall for that purpouse; have selected embedded(os) and arm(cpu) from cross tab of fpcupdeluxe application. Installation went ok. So started Lazarus, selected new program and in Project->Project options->Config and target: Target os: Embedded, Target cpu: Arm. Then hit OK button. But then I get popup window with
info (see attachment below). I already have compilers installed for other platforms (Linux, ARM, WinCE) and I don't really have any problems compiling for them. Does embedded require some different way than other os-targets? or is this because of this a little outdated version of Lazarus, or am I something missed..
Regards,
Martin
Lazarus 2.2.6, FPC 3.2.2, win64

ccrause

  • Hero Member
  • *****
  • Posts: 1082
Re: Lazarus cross-compiler for embedded arm
« Reply #1 on: September 18, 2025, 04:29:22 pm »
I also get that warning when using Lazarus (even recent main branch) for some embedded & freertos targets. Perhaps it is due to these targets saving the rtl units in subarch specific structures?  But not IIRC for avr-embedded, so not sure exactly what is causing this.

What happens if you click OK and compile your example?  In my case (if the cross compiler, rtl units and cross binutils are installed correctly) the project should compile successfully despite this warning.

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #2 on: September 18, 2025, 06:25:43 pm »
I did a test on my other computer with win10 64bit and the same Lazarus ver as in my first post and this time I could choose Target: Embedded and CPU: arm but no luck with compiling (please see photo below). No matter Target processor (tested: default, arm7, armv7em, ..). Not yet investigated what the error does mean.

ccrause

  • Hero Member
  • *****
  • Posts: 1082
Re: Lazarus cross-compiler for embedded arm
« Reply #3 on: September 18, 2025, 06:57:14 pm »
Disable line info option.  There is no lnfodwrf unit provided for embedded targets.

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #4 on: September 18, 2025, 07:28:18 pm »
Aha!  :) Very helpful hint. Thank you. However.. one must remember to avoid spaces in saving path of project. After saving project files and attempting to compile I got a message (in attachment). Then I recollected a similar problem related to spaces in directories. No spaces no problem :)

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #5 on: September 24, 2025, 03:48:52 pm »
Hi,
 if a program for pico looks like
Code: Pascal  [Select][+][-]
  1. program prg1;
  2. {$MODE OBJFPC}
  3. {$H+}
  4. {$MEMORY 10000,10000}
  5.  
  6. begin
  7. end.
then there is not a problem to compile but if it looks like
Code: Pascal  [Select][+][-]
  1. program prg1;
  2. {$MODE OBJFPC}
  3. {$H+}
  4. {$MEMORY 10000,10000}
  5.  
  6. uses
  7.  pico_gpio_c,
  8.  pico_timer_c;
  9.  
  10. begin
  11. end.
  12.  
I get error during compiling. The error says
Quote
pico_c.pas(195,15) Error: Identifier not found "resets"

Use Win10/64bit, FPC 3.2.2. The file pico_c.pas obtained from picoexamples4fpc.

avra

  • Hero Member
  • *****
  • Posts: 2569
    • Additional info
Re: Lazarus cross-compiler for embedded arm
« Reply #6 on: September 25, 2025, 11:21:48 am »
Maybe identifier was not defined in FPC 3.2.2 and you need more fresh version?

Have you tried FPC trunk? That would probably need newer Lazarus as well...
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

ccrause

  • Hero Member
  • *****
  • Posts: 1082
Re: Lazarus cross-compiler for embedded arm
« Reply #7 on: September 25, 2025, 11:48:38 am »
Maybe identifier was not defined in FPC 3.2.2 and you need more fresh version?

Correct, the RP2040 unit was added after FPC 3.2.2 was released.  Thus one needs to build a new compiler based on the FPC main source branch.  As per the wiki, one only needs FPC 3.2.2 to bootstrap the new compiler version.

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #8 on: September 25, 2025, 02:21:28 pm »
That's how I felt it should be, but I didn't want to change my Laz/fpc instalations. Anyway thanks a lot guys for explanations.

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #9 on: September 27, 2025, 10:47:44 am »
Hi, it's me again.. sorry to bother anybody but I installed fpc+Laz using button PICO from  fpcupdeluxe. Now if I choose new simply project (like begin end.) and set in config OS-embedded, Family-arm, Processor=armv6m, deselect in Debugging option Display Line Number I get this(see please image1). How to fix it? It looks that I'm back at beginning of this topic :)
« Last Edit: September 27, 2025, 10:50:35 am by krolikbest »

avra

  • Hero Member
  • *****
  • Posts: 2569
    • Additional info
Re: Lazarus cross-compiler for embedded arm
« Reply #10 on: September 27, 2025, 03:40:56 pm »
Did you build a cross compiler for your target in fpcupdeluxe?
Did you use the new desktop shortcut made for PICO Laz/FPC combo?
« Last Edit: September 27, 2025, 03:43:35 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

ccrause

  • Hero Member
  • *****
  • Posts: 1082
Re: Lazarus cross-compiler for embedded arm
« Reply #11 on: September 27, 2025, 03:47:20 pm »
Hi, it's me again.. sorry to bother anybody but I installed fpc+Laz using button PICO from  fpcupdeluxe. Now if I choose new simply project (like begin end.) and set in config OS-embedded, Family-arm, Processor=armv6m, deselect in Debugging option Display Line Number I get this(see please image1). How to fix it? It looks that I'm back at beginning of this topic :)

As already mentioned, Lazarus performs some checks, but it is not perfect so ignore the error.  What happens when you click OK, then build an empty project?

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #12 on: September 27, 2025, 07:32:01 pm »
Compilation attempt of blinking example ended up successfully. I have one more small question about the configuration in Lazarus:
if I start new project (for Pico) it would be nice to check someting in the project that this is for Pico, so then all necesarry options like
Quote
-Wpraspi_pico
-godwarfsets
-godwarfcpp
-Xu
I wouldn't have to add them manually; they would be added automatically after selecting a project for Pico. I'm not sure if am I making myself clear? Maybe I've even seen it somewhere before, but I forgot how to do it...
« Last Edit: September 27, 2025, 07:35:00 pm by krolikbest »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1850
Re: Lazarus cross-compiler for embedded arm
« Reply #13 on: September 28, 2025, 08:22:40 am »
In case of the Lazarus error you encountered, you might try to rescan the FPC sources.
See: https://github.com/LongDirtyAnimAlf/fpcupdeluxe/issues/779#issuecomment-3275789669

krolikbest

  • Sr. Member
  • ****
  • Posts: 272
Re: Lazarus cross-compiler for embedded arm
« Reply #14 on: September 28, 2025, 02:07:57 pm »
In my case it doesn't help, but I can live with such harmless (presumably) error.

 

TinyPortal © 2005-2018