Forum > Embedded - ARM
Yet another FPC/embedded ARM question
DavidL:
Greetings all,
I'd like to build a Linux-hosted FPC binary to generate code for an embedded ARM device (STM32), albeit with an existing binutils package. From the TARGET_embedded wiki page I believe part of the magic incantation is:
$ cd <directory containing the FPC source cloned from gitlab>
$ make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em
However, I'm unclear on a few things:
- how to tell the FPC make to find and use the existing binutils (which are installed in /opt/ARM/gcc-arm-none-eabi-6-2017-q2-update/),
- how to tell FPC to use the "arm-none-eabi-" prefix to reference the ARM binutils tools,
- how to tell the FPC make to install the FPC compiler, RTL, etc. at a specific place (e.g., /opt/ARM/fpc).
Thanks very much for any assistance!
Dave
ccrause:
--- Quote from: DavidL on March 31, 2023, 06:38:45 pm --- - how to tell the FPC make to find and use the existing binutils (which are installed in /opt/ARM/gcc-arm-none-eabi-6-2017-q2-update/),
--- End quote ---
You can use -FD/opt/ARM/gcc-arm-none-eabi-6-2017-q2-update to tell fpc where to look for utilities.
--- Quote --- - how to tell FPC to use the "arm-none-eabi-" prefix to reference the ARM binutils tools,
--- End quote ---
Specify the bintools prefix with the -XParm-none-eabi- command line option. When building the cross compiler, you can pass BINUTILSPREFIX=arm-none-eabi- to make, which will then pass it to the compiler.
--- Quote --- - how to tell the FPC make to install the FPC compiler, RTL, etc. at a specific place (e.g., /opt/ARM/fpc).
--- End quote ---
Pass INSTALL_PREFIX=/opt/ARM/fpc to make.
Example (untested):
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ make clean buildbase installbase OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em INSTALL_PREFIX=/opt/ARM/fpc BINUTILSPREFIX=arm-none-eabi- CROSSOPT="-FD/opt/ARM/gcc-arm-none-eabi-6-2017-q2-update"
DavidL:
Excellent! Thank you very much! I'll give this a run next week and report back.
DavidL:
--- Quote from: ccrause on April 01, 2023, 01:08:45 pm ---...
Example (untested):
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ make clean buildbase installbase OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em INSTALL_PREFIX=/opt/ARM/fpc BINUTILSPREFIX=arm-none-eabi- CROSSOPT="-FD/opt/ARM/gcc-arm-none-eabi-6-2017-q2-update"
--- End quote ---
Apparently the "-FD" requires a full path to find the binutils executables (i.e., a "/bin" must be appended to the path). Adding the "/bin" appeared to allow the make to complete but I noticed the /opt/ARM/fpc/bin directory is empty. Shouldn't there be an fpc executable there? (There is a /opt/ARM/fpc/lib/fpc/3.3.1/ppcrossarm and the RTL bits appear in /opt/ARM/fpc/lib/fpc/3.3.1/units/arm-embedded/rtl/.)
Does this define success or it it not quite there yet?
Thanks again,
Dave
ccrause:
--- Quote from: DavidL on April 03, 2023, 08:44:31 pm ---Apparently the "-FD" requires a full path to find the binutils executables (i.e., a "/bin" must be appended to the path). Adding the "/bin" appeared to allow the make to complete but I noticed the /opt/ARM/fpc/bin directory is empty. Shouldn't there be an fpc executable there? (There is a /opt/ARM/fpc/lib/fpc/3.3.1/ppcrossarm and the RTL bits appear in /opt/ARM/fpc/lib/fpc/3.3.1/units/arm-embedded/rtl/.)
Does this define success or it it not quite there yet?
--- End quote ---
My suspicion is that make buildbase produces only the cross compiler and cross RTL. Usually I start with make all ... which then builds the full native FPC compiler, RTL and packages, and various utilities. make install then installs the compiler utilities (including fpc) in $INSTALL_PREFIX/bin and the rest of the compiler, RTL and packages in $INSTALL_PREFIX/lib/fpc/$FPCVERSION/.
So you probably have a working cross compiler setup, but with none of the native compiler utilities (fpc, fpcres, h2pas etc.). You should be able to cross compile a simple embedded program this way by directly invoking the cross compiler binary - provided you have a fpc.cfg that points to the installed RTL for the cross target.
Navigation
[0] Message Index
[#] Next page