[fpc-pascal] Setting up FPC to cross compile for the AVR, MSP430 and native mode.
Christo Crause
christo.crause at gmail.com
Fri Sep 4 19:11:38 CEST 2026
The specific paths are configurable, so it depends on how you install the
new compiler. See
https://wiki.freepascal.org/Cross_compiling#From_macOS_(Darwin) for typical
folder structure on a Mac.
On Sun, Aug 30, 2026 at 10:08 PM Stephen Holland <sholland at mac.com> wrote:
> Thank you for the reply. I gather that since I will specify architecture
> that as a result of this process I will have a compiler that targets my OS
> on the desktop and I have the additional AVR target available with just the
> compiler directives.
>
> Is there documentation on where the subdirectories go so I can check on
> the install having gone well?
>
> I’ll try the install, check the -i option on fpc to see if it thinks it
> did the install and report back.
>
> Steve
>
> On Aug 30, 2026, at 10:12 AM, Christo Crause <christo.crause at gmail.com>
> wrote:
>
>
> A good starting point: https://wiki.freepascal.org/AVR
>
> Typically you need to use make and ensure you have the cross binutils for
> the target system available already. If you want to compile for avr64du32
> then specify SUBARCH=avrxmega2 as part of the make parameters. Note that
> the makefile only builds one subarch at a time and by default put the
> compiled units in folders without a subarch differentiator.
>
> Maybe the easiest option if you are new to fpc and cross compiling is to
> use the fpcupdeluxe tool to help configure and maintain lazarus and/or fpc
> for various different targets (especially if one isn't familiar with
> fiddling with the compiler's configuration file):
> https://github.com/LongDirtyAnimAlf/fpcupdeluxe. There is a very long
> help thread for fpcupdeluxe here:
> https://forum.lazarus.freepascal.org/index.php/topic,34645.0.html
>
> In general you need a cross compiler per CPU target, so you need a native
> compiler for the host and then a cross compiler for say AVR. MSP430 is not
> supported by fpc.
>
> Once the cross compiler is installed correctly, compile as follows
> (minimum command line options, assumes that binutils and RTL are in known
> to the compiler locations).:
> $ fpc -Tembedded -Pavr -Wpavr64du32 hello.pas
>
> Please ask if you run into issues (this is almost guaranteed if it is your
> first time trying to build a cross compiler from fpc's development
> branch). Good luck!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20260904/75f3ec95/attachment.htm>
More information about the fpc-pascal
mailing list