<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I am looking for an easy way to have all cortex-m compilers
available at the same time to be able to do automated
building/testing</p>
<p>Inspired by the -V parameter of fpc I started my journey and
ended up with something different.</p>
<p>My question is now did I go down the correct path or is there a
better way to fulfill my requirements:<br>
</p>
- I want to be able to switch between armv6m, armv7m and armv7em
without the need to build the matching compiler/rtl
<p>- I want lazarus to use fpc as start compiler, I want to be able
to configure the whole compiler switching via Project settings.</p>
<p>- I want to be able to use lazbuild so that I can do automated
builds of my lazarus projects.</p>
<p>I found this helpful page:</p>
<p><a class="moz-txt-link-freetext" href="http://wiki.freepascal.org/FPC_Version_Switcher#Setting_the_fpc_frontend_executable_path">http://wiki.freepascal.org/FPC_Version_Switcher#Setting_the_fpc_frontend_executable_path</a></p>
<p>but in the end this approach did not work for me, FPC version
switcher is not available in lazarus svn (or I am too blind to
find it) and in the end I had some issues with using lazbuild when
defining the -V switch in my project settings.</p>
<p><br>
</p>
<p>In the end I came up with the following approach:</p>
<p>Build ppcrossarm and make sure that the rtls do end up in those
directories:<br>
</p>
<p><font face="Courier New, Courier, monospace">/usr/local/lib/fpc/3.1.1/units/arm-embedded/armv6m/rtl<br>
/usr/local/lib/fpc/3.1.1/units/arm-embedded/armv7m/rtl<br>
/usr/local/lib/fpc/3.1.1/units/arm-embedded/armv7em/rtl</font></p>
<p>created a softlink so that the crosscompiler can be caled via
/usr/local/bin/fpc <br>
</p>
<p><font face="Courier New, Courier, monospace">ln -sf
/usr/local/lib/fpc/3.1.1/ppcrossarm /usr/local/bin/ppcarm</font><br>
</p>
<p>added the following to my /etc/fpc.cfg:</p>
<p><font face="Courier New, Courier, monospace">#ifdef embedded<br>
-Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget/$fpcsubarch/rtl<br>
#endif</font><br>
</p>
<p>and then I add the following lines to the user-defined project
settings in Lazarus:</p>
<p><font face="Courier New, Courier, monospace">-Cparmv7em<br>
-XP/usr/local/bin/arm-none-eabi-<br>
-Wpnucleof411re<br>
-dnucleof411re</font></p>
<p>I thought about putting <br>
</p>
<p><font face="Courier New, Courier, monospace">-Fu/usr/local/lib/fpc/3.1.1/units/arm-embedded/armv7em/rtl</font></p>
<p>in the project Settings so that I do not need to tweak
/etc/fpc.cfg but I do not like the fact that I have to hardcode
paths there, is there a better way? If yes then I'd prefer that a
lot over tweaking /etc/fpc.cfg</p>
<p><br>
</p>
<p>Michael<br>
</p>
<p>------<br>
</p>
<p>Here's how I build the cross-compiler:<br>
</p>
<p><font face="Courier New, Courier, monospace">SUBARCH=armv6m</font></p>
<font face="Courier New, Courier, monospace">
</font>
<p><font face="Courier New, Courier, monospace">#SUBARCH=armv7m</font></p>
<font face="Courier New, Courier, monospace">
</font>
<p><font face="Courier New, Courier, monospace">#SUBARCH=armv7em</font></p>
<p><font face="Courier New, Courier, monospace">make clean buildbase
CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm
SUBARCH=$SUBARCH CROSSOPT="$CROSSOPT"
BINUTILSPREFIX=arm-none-eabi- || exit 1<br>
make installbase CROSSINSTALL=1 OS_TARGET=embedded
CPU_TARGET=arm SUBARCH=$SUBARCH CROSSOPT="$CROSSOPT"
BINUTILSPREFIX=arm-none-eabi-
INSTALL_UNITDIR=/usr/local/lib/fpc/3.1.1/units/arm-embedded/$SUBARCH/rtl
|| exit 1<br>
cp /usr/local/lib/fpc/3.1.1/ppcrossarm
/usr/local/lib/fpc/3.1.1/ppcrossarm-$SUBARCH</font><br>
</p>
</body>
</html>