building arm cross compiler on FreeBSD

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

building arm cross compiler on FreeBSD

Marc Santhoff-2
Hi,

I'm stuck while trying to build a cross compiler for ARM on FreeBSD. The
compiler does not know any arm target. FreeBSD is running on some arm
platforms (e.g. beagleboard), but it seems the combination is not
implemented in fpc.

Is that correct?

How can I build a build a cross compiler running on FreeBSD compiling
for ARM?

TIA,
Marc

--
Marc Santhoff <[hidden email]>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Jonas Maebe-2
On 09/01/16 23:27, Marc Santhoff wrote:
> I'm stuck while trying to build a cross compiler for ARM on FreeBSD. The
> compiler does not know any arm target.

The compiler always only knows all targets for a single architecture.
Unless you have a native ARM or a cross-compiler for ARM, it's normal
that it doesn't know any ARM targets (just like a native ARM or
cross-compiler for ARM doesn't know any non-ARM targets).

> FreeBSD is running on some arm
> platforms (e.g. beagleboard), but it seems the combination is not
> implemented in fpc.
>
> Is that correct?

Yes.

> How can I build a build a cross compiler running on FreeBSD compiling
> for ARM?

Try adding OS_TARGET=embedded to your "make all CPU_TARGET=arm"
invocation in the top level directory (assuming you've set up your
environment for cross-compiling to embedded).


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Marc Santhoff-2
On Sa, 2016-01-09 at 23:44 +0100, Jonas Maebe wrote:
> OS_TARGET=embedded

No, doesn'r do. The error message talks about the assemble, maybe it is
the binuitls variant installed?

gmake[3]: Entering directory `/usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/embedded'
/usr/local/bin/gmkdir -p /usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/units/arm-embedded
/usr/p1/home/marc/program/fpc-cross/src/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur -Tembedded -Parm -XParm-embedded- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -FE. -FU/usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/units/arm-embedded -darm -dRELEASE -XParm-elf- -Us -Sg system.pp
Assembler messages:
Error: unknown architecture `armv7-m'

Error: unrecognized option -march=armv7-m
system.pp(285) Error: Error while assembling exitcode 1
system.pp(285) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted

If I try directly:

 > arm-elf-as -march=armv7-m
Assembler messages:
Error: unknown architecture `armv7-m'

 > lpkg|grep arm
arm-elf-binutils-2.17

Which version of binutils is needed or what's going worng otherwise?

Marc

--
Marc Santhoff <[hidden email]>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Tomas Hajny-2
In reply to this post by Jonas Maebe-2
On Sat, January 9, 2016 23:44, Jonas Maebe wrote:
> On 09/01/16 23:27, Marc Santhoff wrote:


Hi Jonas,

>> I'm stuck while trying to build a cross compiler for ARM on FreeBSD. The
>> compiler does not know any arm target.
 .
 .
>> FreeBSD is running on some arm
>> platforms (e.g. beagleboard), but it seems the combination is not
>> implemented in fpc.
 .
 .
>> How can I build a build a cross compiler running on FreeBSD compiling
>> for ARM?
>
> Try adding OS_TARGET=embedded to your "make all CPU_TARGET=arm"
> invocation in the top level directory (assuming you've set up your
> environment for cross-compiling to embedded).

I know next to nothing about target embedded or ARM, but the original
poster seems to have asked for support of FreeBSD on ARM (which is indeed
not available in FPC at the moment as far as I can see, although I would
guess that the existing support for Darwin on ARM together with the
existing support of FreeBSD on i386 and x86_64 might be a good starting
point). Was your suggestion meant just as the first step on the way
towards adding support for this target on ARM (would the ARM
cross-compiler not having even a start for the requested target really
help him in this case?)? Or have I missed something?

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Michael Ring-2
In reply to this post by Marc Santhoff-2
Perhaps you should build your own binutils, it seems that the version you are using right now does not properly support armv7-m architecture.

download

ftp://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.gz

extract, create an empty directory and do:

../binutils-2.25.1/configure --target=arm-none-eabi --disable-multilib --program-prefix=arm-none-eabi-

sudo make install will install the tools to /usr/local


or try this version from freshports:

https://www.freshports.org/devel/gcc-arm-embedded/

It also builds gcc, which of course you do not need.

Michael

Am 10.01.16 um 00:16 schrieb Marc Santhoff:
On Sa, 2016-01-09 at 23:44 +0100, Jonas Maebe wrote:
OS_TARGET=embedded
No, doesn'r do. The error message talks about the assemble, maybe it is
the binuitls variant installed?

gmake[3]: Entering directory `/usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/embedded'
/usr/local/bin/gmkdir -p /usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/units/arm-embedded
/usr/p1/home/marc/program/fpc-cross/src/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur -Tembedded -Parm -XParm-embedded- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -FE. -FU/usr/p1/home/marc/program/fpc-cross/src/fpc/rtl/units/arm-embedded -darm -dRELEASE -XParm-elf- -Us -Sg system.pp 
Assembler messages:
Error: unknown architecture `armv7-m'

Error: unrecognized option -march=armv7-m
system.pp(285) Error: Error while assembling exitcode 1
system.pp(285) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted

If I try directly:

 > arm-elf-as -march=armv7-m
Assembler messages:
Error: unknown architecture `armv7-m'

 > lpkg|grep arm
arm-elf-binutils-2.17

Which version of binutils is needed or what's going worng otherwise?

Marc



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Jonas Maebe-2
In reply to this post by Tomas Hajny-2
Tomas Hajny wrote:

> On Sat, January 9, 2016 23:44, Jonas Maebe wrote:
>> On 09/01/16 23:27, Marc Santhoff wrote:
>
>>> How can I build a build a cross compiler running on FreeBSD compiling
>>> for ARM?
>> Try adding OS_TARGET=embedded to your "make all CPU_TARGET=arm"
>> invocation in the top level directory (assuming you've set up your
>> environment for cross-compiling to embedded).
>
> I know next to nothing about target embedded or ARM, but the original
> poster seems to have asked for support of FreeBSD on ARM

His previous messages were about embedded development for ARM. I
interpreted "I'm stuck while trying to build a cross compiler for ARM on
FreeBSD" as (a cross compiler for ARM) (on FreeBSD) rather than (a cross
compiler) (for ARM on FreeBSD), especially given the last sentence from
his mail quoted above..

My guess was that the reason he was asking, was that if you do a "make
all CPU_TARGET=arm" at the top level to get an ARM cross-compiler, the
Makefile will default to $(OS_SOURCE)/$(CPU_TARGET), which will indeed
result in complaints about FreeBSD/ARM not being supported if you do it
on FreeBSD.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Tomas Hajny-2
On Sun, January 10, 2016 12:57, Jonas Maebe wrote:

> Tomas Hajny wrote:
>> On Sat, January 9, 2016 23:44, Jonas Maebe wrote:
>>> On 09/01/16 23:27, Marc Santhoff wrote:
>>
>>>> How can I build a build a cross compiler running on FreeBSD compiling
>>>> for ARM?
>>> Try adding OS_TARGET=embedded to your "make all CPU_TARGET=arm"
>>> invocation in the top level directory (assuming you've set up your
>>> environment for cross-compiling to embedded).
>>
>> I know next to nothing about target embedded or ARM, but the original
>> poster seems to have asked for support of FreeBSD on ARM
>
> His previous messages were about embedded development for ARM. I
> interpreted "I'm stuck while trying to build a cross compiler for ARM on
> FreeBSD" as (a cross compiler for ARM) (on FreeBSD) rather than (a cross
> compiler) (for ARM on FreeBSD), especially given the last sentence from
> his mail quoted above..

That's what I guessed from your response. Nevertheless, the message also
contained an explicit note of running FreeBSD on his device. I checked it
and FreeBSD seems to support the device according to Internet sources
indeed.

It's up to the original poster to clarify whether he intends to target
FreeBSD on his device, or whether he was interested in creating programs
for the device without an operating system.


> My guess was that the reason he was asking, was that if you do a "make
> all CPU_TARGET=arm" at the top level to get an ARM cross-compiler, the
> Makefile will default to $(OS_SOURCE)/$(CPU_TARGET), which will indeed
> result in complaints about FreeBSD/ARM not being supported if you do it
> on FreeBSD.

Yes, I think so as well, but it might be exactly the thing he was
interested in.

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Marc Santhoff-2
On So, 2016-01-10 at 13:17 +0100, Tomas Hajny wrote:
> On Sun, January 10, 2016 12:57, Jonas Maebe wrote:
> > Tomas Hajny wrote:
> >> On Sat, January 9, 2016 23:44, Jonas Maebe wrote:
> >>> On 09/01/16 23:27, Marc Santhoff wrote:

> > His previous messages were about embedded development for ARM. I
> > interpreted "I'm stuck while trying to build a cross compiler for ARM on
> > FreeBSD" as (a cross compiler for ARM) (on FreeBSD) rather than (a cross
> > compiler) (for ARM on FreeBSD), especially given the last sentence from
> > his mail quoted above..
>
> That's what I guessed from your response. Nevertheless, the message also
> contained an explicit note of running FreeBSD on his device. I checked it
> and FreeBSD seems to support the device according to Internet sources
> indeed.
>
> It's up to the original poster to clarify whether he intends to target
> FreeBSD on his device, or whether he was interested in creating programs
> for the device without an operating system.

Jonas is right. Compiling a cross compiler with target arm embedded on a
system running freebsd.

--
Marc Santhoff <[hidden email]>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: building arm cross compiler on FreeBSD

Marc Santhoff-2
In reply to this post by Michael Ring-2
On So, 2016-01-10 at 09:52 +0100, Michael Ring wrote:
> Perhaps you should build your own binutils, it seems that the version
> you are using right now does not properly support armv7-m architecture.

Did the trick, a current version of arm-elf-binutils worked. :)

Many thanks to all who contributed.

Marc

--
Marc Santhoff <[hidden email]>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal