- 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/),You can use -FD/opt/ARM/gcc-arm-none-eabi-6-2017-q2-update to tell fpc where to look for utilities.
- how to tell FPC to use the "arm-none-eabi-" prefix to reference the ARM binutils tools,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.
- how to tell the FPC make to install the FPC compiler, RTL, etc. at a specific place (e.g., /opt/ARM/fpc).Pass INSTALL_PREFIX=/opt/ARM/fpc to make.
...
Example (untested):
$ 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"
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/.)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/.
Does this define success or it it not quite there yet?
(It's not clear that the "CROSSINSTALL=1" actually does anything at all (tried with and without) but it's on the TARGET_Embedded page, so...)The CROSSINSTALL variable is set automatically (https://gitlab.com/freepascal.org/fpc/source/-/blob/release_3_2_2/Makefile#L210) if the target is different from the source compiler, so hasn't been necessary to specify this for quite a while.
For the remainder of the puzzle, I'm not clear on how to get an fpc in /opt/ARM/fpc/bin that'll use the ppccrossarm that was dropped in /opt/ARM/fpc/lib/fpc/3.3.1/. (I'm kinda wondering what the fpc portion actually does...)I see fpc as a tool that locates and calls the appropriate cross compiler binary based on the -P parameter. One can also call the cross compiler directly, instead of calling fpc.
Of course, there's already a native fpc installed on the system (3.2.2+dfsg-9ubuntu1) and I don't want to mess that up in trying to build a native from the gitlab tree or jacking around with the native config file(s).It gets a bit tricky to use compilers installed in separate locations. Also fpc in one install path is unlikely to locate a cross compiler located in another path. If you can build and install a cross compiler, you can also do the same for a native compiler. A further complication is that sometimes one needs features only available in the development branch - for this reason I chose to install both a native and a few cross compilers for a specific fpc version in my home folder. Others probably have different strategies.