Setting up an ARM embedded project? lazarus / 1-Linux ---------------------------------------------------------------------- Ruptor · 2025-07-10 20:29 I managed to blunder through the setup of Lazarus & FPC trunk using fpcupdeluxe after installing the prerequisites as given here: https://github.com/LongDirtyAnimAlf/fpcupdeluxe and following the wiki instructions here: https://wiki.freepascal.org/ARM_Embedded_Tutorial_- _Entry_FPC_and_STM32 but after completing the cross compiler build the wheels have fallen off. The instructions started to go wrong with a minor thing     "Tools > Reread FPC source code directory" should be rescan not reread. I moved on to the simple project. After guessing Settings is Options where is this? "Project > Project Settings ... > Configuration and Goals" Elsewhere under Tools > Configure "Build Lazarus" I could set arm & embedded then I did rescan and it said system.ppu not found in fpc binary so is more screwed up. Is there alternative instructions to do a simple arm project. Eventually under project options I have done some of the settings in config target > embedded, arm & armv7m settings but not -WpSTM32F103X8 & what about the fpc.cfg? I am a bit lost so any help will be appreciated. ---------------------------------------------------------------------- Laksen · 2025-07-10 20:38 Which chip are you targetting? You can do it in two steps to figure out where the problem is A) Check that FPC is configured right 1. Write the following test program to test.pas: Code: [Select]program test; begin end.2. Compile that with Code: [Select]fpc -Tembedded -Cparmv7m -WpXXX test.pas with XXX being the fpc name for your microcontroller (use "fpc -Tembedded -Cparmv7m -i" to list) If that works and produces a test.elf then your compiler works, and the problem is in the configuration of Lazarus ---------------------------------------------------------------------- Ruptor · 2025-07-10 22:10 Error: Illegal parameter: -Cparmv7m removing all parameters gives Target OS: Embedded Compiling test.pas Fatal: Can't find unit system used by Program Fatal: Compilation aborted fpc works on Linux code. ---------------------------------------------------------------------- Ruptor · 2025-07-11 09:31 There is only one fpc.cfg file and it is in the x86_64-linux directory. Shouldn't there be two fpc.cfg files so there is one for arm? There are two system.ppu that Lazarus files one in RTL under x86 and the other in RTL under embedded. It looks like the fpc.cfg file is missing for embedded to me but why didn't the cross build create it? ---------------------------------------------------------------------- Laksen · 2025-07-11 09:52 Sorry forgot "-Parm". Add that to all commands ---------------------------------------------------------------------- Ruptor · 2025-07-11 11:52 Compiling test.pas Fatal: Can't find unit system used by Program Fatal: Compilation aborted ---------------------------------------------------------------------- DonAlfredo · 2025-07-11 12:51 It would be good to check some basic things first, if fpcupdeluxe did the rights things. Check if the following folders and files are available. ....yourinstalldir/fpc/units/arm-embedded ....yourinstalldir/cross/lib/arm-embedded ....yourinstalldir/cross/bin/arm-embedded ....yourinstalldir/fpc/bin/cpu-os/ppcrossarm.exe" ---------------------------------------------------------------------- Ruptor · 2025-07-11 15:46 Yes everything is there but as I said there is only one fpc.cfg for Linux & nothing for cross compiler hence Lazarus doesn't know where to look I think. ---------------------------------------------------------------------- ccrause · 2025-07-12 07:08 Quote from: Ruptor on July 11, 2025, 05:46:01 pmYes everything is there but as I said there is only one fpc.cfg for Linux & nothing for cross compiler hence Lazarus doesn't know where to look I think. The configuration file can contain conditionals and macros to identify and handle different targets configurations.  Fpcupdeluxe updates its fpc.cfg file when adding targets to your install folder. ---------------------------------------------------------------------- DonAlfredo · 2025-07-12 07:58 Please have a look at your fpc.cfg. Towards the end of this file, the settings for arm-embedded can be found. You may post these settings so we can have a look at them. ---------------------------------------------------------------------- Ruptor · 2025-07-12 10:07 Quote from: DonAlfredo on July 12, 2025, 09:58:38 amPlease have a look at your fpc.cfg.....I assumed there would be a config for each cross so no IFDEF required. Does it mean fpcupdeluxe didn't update the config? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i # begin fpcup do not remove arm-embedded# Inserted by up v2.4.0f on 11-7-25 09:57:30# Cross compile settings dependent on both target OS and target CPU#IFDEF FPC_CROSSCOMPILING#IFDEF EMBEDDED#IFDEF CPUARM#IFDEF CPUARMV6M-CaEABI#ENDIF CPUARMV6M-FD/home/paul/fpcupdeluxe/cross/bin/arm-embedded-XParm-none- eabi--Fl/home/paul/fpcupdeluxe/cross/lib/arm- embedded/$fpcsubarch/$fpcabi-Fu/home/paul/fpcupdeluxe/fpc/units/arm- embedded/$fpcsubarch/$fpcabi/rtl- Fu/home/paul/fpcupdeluxe/fpc/units/arm- embedded/$fpcsubarch/$fpcabi/packages#ENDIF CPUARM#ENDIF EMBEDDED#ENDIF FPC_CROSSCOMPILING# end fpcup do not remove ---------------------------------------------------------------------- DonAlfredo · 2025-07-12 10:43 This config looks good. FPC only needs a single fpc.cfg config file. Look at the defines for arm embedded. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i /home/paul/fpcupdeluxe/fpc/units/arm-embedded/$fpcsubarch/$fpcabiFor FPC to be able to find the right unit-files, the subarch and the abi need to be set correct. Set the subarch with the -Cp command line option. Subarch is the name of this directory: /home/paul/fpcupdeluxe/fpc/units/arm-embedded/SUBARCH Set the abi with the -Ca command line option. Abi is the name of this directory: /home/paul/fpcupdeluxe/fpc/units/arm-embedded/subarch/ABI This all looks complicated, but it is the only way to have an install of FPC that can handle different subarch and different abi in one install [AFAIK]. ---------------------------------------------------------------------- Ruptor · 2025-07-12 22:44 Quote from: DonAlfredo on July 12, 2025, 12:43:09 pmSet the abi with the -Ca command line option.Thanks for the pointers but I haven't sorted the paths yet as things went from bad to worse and I was side tracked looking up the myriad of FPC parameters. At one point Lazarus said there was no fpc.cfg file even though it hadn't moved. Finally I am back where I was this morning. The wiki says use option -WpSTM32F103X8  but doesn't add up with the fpc description just adding to my confusion. "-WP     Minimum iOS deployment version: 8.0, 8.0.2, ... (iphonesim)" Also I don't want kernel or OS  based embedded code so I have to use EABI don't I? I would expect fpcupdeluxe that setup paths and placed the cross compiler stuff to transfer it to the IDE when the target processor is selected.  I will try again tomorrow. ---------------------------------------------------------------------- DonAlfredo · 2025-07-13 07:26 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i I would expect fpcupdeluxe that setup paths and placed the cross compiler stuff to transfer it to the IDE when the target processor is selected.  I will try again tomorrow.Fpcupdeluxe has done all the work to prepare FPC to be able to cross-compile towards your desired arm embedded target. The only thing you need to do is to tell FPC (and Lazarus) about the desired target when cross-compiling. FPC cannot guess the target other than using the default target (settings). ---------------------------------------------------------------------- Laksen · 2025-07-13 08:51 Which specific chip do you want to compile for? ---------------------------------------------------------------------- Ruptor · 2025-07-14 10:07 Quote from: DonAlfredo on July 13, 2025, 09:26:44 amThe only thing you need to do is to tell FPC (and Lazarus) about the desired target when cross-compiling. FPC cannot guess the target other than using the default target (settings).Sorry for tardy responses I am a 24/7 carer for my 100 year old mum. I think I set everything but Lazarus can't see things. Still trying to understand your previous post. ---------------------------------------------------------------------- Ruptor · 2025-07-14 10:14 Quote from: Laksen on July 13, 2025, 10:51:10 amWhich specific chip do you want to compile for?As per wiki STM32F103C8  Cortex M3. Confused with armv6m & armv7m where Fpcup & Lazarus seem to swap them automatically as if the 7m compiler covers both. ---------------------------------------------------------------------- Ruptor · 2025-07-15 13:06 I reinstalled everything doing compiler trunk first then compiler trunk then cross with armv7m target. Now after messing with the paths I get this hitting the test button under project options. If I add another path to the x86_64-linux where the files are it complains there are duplicates with cross files.