Recent

Author Topic: crosscompilator for Pico - FpcUpDeluxe  (Read 10056 times)

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
crosscompilator for Pico - FpcUpDeluxe
« on: November 05, 2023, 10:37:30 pm »
Hi,

 I installed crosscompilator for Pico according to https://wiki.freepascal.org/ARM_Embedded_Tutorial_-_Installing_Lazarus_and_Free_Pascal not new Lazarus installation but for exising one I selected under Cross tab CPU-arm and the OS-embedded and on the 'Set subarch'- arm6m, arm target=armhf and abi=eabi (in fact these two opition were already selected). Then from https://github.com/michael-ring/pico-fpcexamples/tree/main I copied blinky example, set in Project Opitions target OS=embedded, CPU family=arm, target processor=armv6m but during compilation I get this
Quote
Compile Project, OS: embedded, CPU: arm, Target: project1.elf: Exit code 1, Errors: 1, Hints: 2
Hint: Start of reading config file C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.2.2-r0d122c49 [2023/11/05] for arm
Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and others
Verbose: Target OS: Embedded
Verbose: Compiling project1.lpr
Verbose: PPU Loading C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\system.ppu
Verbose: PPU is compiled for another processor
Verbose: PPU Loading C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\system.ppu
Verbose: PPU is compiled for another processor
Fatal: Can't find unit system used by project1
Verbose: Compilation aborted
Verbose: C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\ppcrossarm.exe returned an error exitcode

Any hints?

Regards,

----------
Small update:
under this folder ...\fpc\units\arm-embedded\armv6m\eabi\rtl I've found all units but now compilator says that it can't find lnfodwrf. Searching through my folders give me some records but actually I can't find  the right file (lnfodwrf) for the chosen hardware platform..
« Last Edit: November 05, 2023, 10:50:07 pm by krolikbest »

ojz0r

  • Jr. Member
  • **
  • Posts: 65
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #1 on: November 06, 2023, 12:11:12 am »
Try to add "sysutils" to the units (under uses).
I like big endians and i can not lie.

Laksen

  • Hero Member
  • *****
  • Posts: 786
    • J-Software
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #2 on: November 06, 2023, 03:36:40 am »
For infodwrf disable line info debug (-gl)

For compiling try setting target to default and ABI to default

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #3 on: November 06, 2023, 08:59:51 am »
Thanks for hints. I'll check them out this afternoon.

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #4 on: November 06, 2023, 06:08:53 pm »
Hi,

 I've installed new instance of Lazarus using of course FpcUpDeluxe but only for Pico. Then loaded the Blinky project. I had to set Target OS, CPU family and processor and set path to units. Then Build process gives me
Quote
Compile Project, Mode: Raspberry Pi Pico, OS: embedded, CPU: arm, Target: H:\PROGRAMY\_pascal programy\LAZARUS\RASPBERRY PICO\prg1\bin\blinky.elf: Exit code 1, Errors: 1, Hints: 4
Hint: Start of reading config file C:\fpcupdeluxe4\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe4\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-9929-g8d63a1ddfd [2022/01/18] for arm
Verbose: Copyright (c) 1993-2022 by Florian Klaempfl and others
Verbose: Target OS: Embedded
Verbose: Compiling blinky.lpr
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_gpio_c.pas
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_c.pas
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_sync_c.pas
Verbose: Assembling pico_sync_c
pico_c.pas(103,17) Hint: Parameter "fmt" not used
pico_c.pas(103,33) Hint: Parameter "Args" not used
Verbose: Assembling pico_c
Verbose: Assembling pico_gpio_c
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_timer_c.pas
Verbose: Assembling pico_timer_c
Verbose: Assembling blinky
Verbose: Linking H:\PROGRAMY\_pascal programy\LAZARUS\RASPBERRY PICO\prg1\bin\blinky
blinky.lpr(20,0) Error: Can't open executable "H:\PROGRAMY\_pascal programy\LAZARUS\RASPBERRY PICO\prg1\bin\blinky.elf"
Verbose: Compilation aborted
Verbose: C:\fpcupdeluxe4\fpc\bin\x86_64-win64\ppcrossarm.exe returned an error exitcode

Meantime I tested more or less stupid combinations of settings, but mostly I end up with this what is above...
« Last Edit: November 06, 2023, 06:11:16 pm by krolikbest »

TRon

  • Hero Member
  • *****
  • Posts: 3745
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #5 on: November 06, 2023, 06:38:33 pm »
Code: [Select]
blinky.lpr(20,0) Error: Can't open executable "H:\PROGRAMY\_pascal programy\LAZARUS\RASPBERRY PICO\prg1\bin\blinky.elf"
Spaces... get rid of them and you should be good to go (at least a bit better)  :)
I do not have to remember anything anymore thanks to total-recall.

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #6 on: November 06, 2023, 06:49:13 pm »
I wouldn't have come across this.. That did the trick, thanks! But why, how, I can't change all my directories structure :)

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #7 on: November 06, 2023, 07:38:46 pm »
One more question (hope the last in this trhread). Installing new ver of Lazarus I noticed that now it is 2.3.0. My main ver is 2.2.6, so once again I tested blinky example under Lazarus 2.2.6 with exactly the same options as in 2.3.0 with of course path to the blinky example file where there are no spaces:)
This time however I got:
Quote
Compile Project, OS: embedded, CPU: arm, Target: blinky.elf: Exit code 1, Errors: 5, Hints: 4
Hint: Start of reading config file C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Hint: End of reading config file C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.cfg
Verbose: Free Pascal Compiler version 3.2.2-r0d122c49 [2023/11/05] for arm
Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and others
Verbose: Target OS: Embedded
Verbose: Compiling blinky.lpr
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_gpio_c.pas
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_c.pas
Verbose: Compiling C:\fpcupdeluxe3\fpcupdeluxe\fpc\units\arm-embedded\units\pico_sync_c.pas
Verbose: Assembling pico_sync_c
pico_c.pas(103,17) Hint: Parameter "fmt" not used
pico_c.pas(103,33) Hint: Parameter "Args" not used
pico_c.pas(195,15) Error: Identifier not found "resets"
pico_c.pas(196,17) Error: Identifier not found "resets"
pico_c.pas(198,10) Error: Identifier not found "resets"
pico_c.pas(200,17) Error: Identifier not found "resets"
pico_c.pas(202,10) Error: Identifier not found "resets"
pico_c.pas(230,0) Verbose: There were 5 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: C:\fpcupdeluxe3\fpcupdeluxe\fpc\bin\x86_64-win64\ppcrossarm.exe returned an error exitcode

All applies to unit pico_c and resets (Register?) is used here:
Code: Pascal  [Select][+][-]
  1. procedure runtime_init;
  2. const
  3.   RESETS_SAFE_BITS=     %1111111111100110110111111;
  4.   RESETS_PRECLOCK_BITS= %0001111000100110110111110;
  5.   //RESETS_POSTCLOCK_BITS=%1110000111000000000000001;
  6.   RESETS_RESET_BITS    =%1111111111111111111111111;
  7. begin
  8.   hw_set_bits(resets.reset_done,RESETS_SAFE_BITS);
  9.   hw_clear_bits(resets.reset,RESETS_PRECLOCK_BITS);
  10.   repeat
  11.   until (resets.reset_done and RESETS_PRECLOCK_BITS) = RESETS_PRECLOCK_BITS;
  12.   clocks_init;
  13.   hw_clear_bits(resets.reset,RESETS_RESET_BITS);
  14.   repeat
  15.   until (resets.reset_done and RESETS_RESET_BITS) = RESETS_RESET_BITS;
  16.   spin_locks_reset;
  17. end;    
I can't find where "resets" Register comes from? Where is it defined? It is because of trunk version of Lazarus 2.3.0?

------------

Update: I think I understand where the problem is coming from, and it is indeed the newer version of Lazarus (2.3.0) that contains information about Pico. In Lazarus 2.2.6, e.g. under this directory
Quote
..\fpcupdeluxe\fpcsrc\rtl\embedded\arm
there is not the file rp2040.pp and exactly in this file is written configuration of Pico. In ver 2.3.0 this file exists, so that was my problem (I suppose so)
« Last Edit: November 06, 2023, 09:06:37 pm by krolikbest »

TRon

  • Hero Member
  • *****
  • Posts: 3745
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #8 on: November 07, 2023, 01:33:05 am »
I wouldn't have come across this.. That did the trick, thanks!
You're more than welcome. Without the intention to hurt your feelings it is a (common) rookie mistake.

Quote
But why, how, I can't change all my directories structure :)
Compiler, linkers and assemblers do not digest spaced out file and/or path names very well. I believe it originates from the society against free minds and one of their doctrines seem to mention something about anti spacing.

Sorry to say but that means that you are more or less obligated to write a recursive directory parsing routine that replaces all your spaces located in your project paths with something non-spacey (underscore comes to mind).  ;)
I do not have to remember anything anymore thanks to total-recall.

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #9 on: November 07, 2023, 08:09:29 am »
Still I can't get over it somehow( mean about "spaces"). I did dozens project using Laz2.2.6 compiling for Windows, Raspberry Pi, WinCE and never got such problems. Aparently always it has to be the first time.. :)

TRon

  • Hero Member
  • *****
  • Posts: 3745
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #10 on: November 07, 2023, 02:27:32 pm »
I did dozens project using Laz2.2.6 compiling for Windows, Raspberry Pi, WinCE and never got such problems. Aparently always it has to be the first time.. :)
Well, yes to the latter but you must have been lucky then I guess.

Usually it is the linker and/or passing arguments to the linker that causes issues and there is no general rule of thumb there. Which linker (as in version/age/origin/patches) is used depends on the target you are (cross-)compiling for and different linkers might act differently depending on the circumstances. But I have seen this using (external) assemblers as well.
I do not have to remember anything anymore thanks to total-recall.

Laksen

  • Hero Member
  • *****
  • Posts: 786
    • J-Software
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #11 on: November 07, 2023, 06:50:01 pm »
Which version of binutils are you using?

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #12 on: November 08, 2023, 01:38:34 pm »
Where to check it? :-[

dbannon

  • Hero Member
  • *****
  • Posts: 3174
    • tomboy-ng, a rewrite of the classic Tomboy
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #13 on: November 09, 2023, 12:08:44 am »
On a debian like machine -

Code: Bash  [Select][+][-]
  1. dpkg -l | grep binutils

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

krolikbest

  • Sr. Member
  • ****
  • Posts: 250
Re: crosscompilator for Pico - FpcUpDeluxe
« Reply #14 on: November 09, 2023, 02:09:07 pm »
Windows?

 

TinyPortal © 2005-2018