Re: compiling a simple "hello world example" Microchip PIC32 ( march is 24ks) fails...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/03/2019 23:19, Branko wrote:
> I just did.
> 
> I've compiled separate binutils for the target and then also compiled gcc.
> 
> Result runs fine without parameters. But as soon as I give it to compile
> even trivial program, it chokes with the message like:
> 
> "as: unrecognised option -EB"
> 
> It shows that this gcc always calls system AS/AR/LD, no mater what I do
> or how I compile it.
> 
> Is there any special trick for this ?
> 
> 
> I tired using configure option AS_FOR_TARGET,AS etc.
> 
> 
> With no change in end result...
> 
> 

Building a cross-compilation toolchain is not an easy task.  There are
many steps involved.  You need binutils (or another linker and
assembler), the compiler, and a library.  These are all somewhat
dependent on each other.

Then you have the microcontroller-specific things - the linker files,
header files, libraries, etc.  And often there are a number of patches
to the compiler, binutils and library that are developed and maintained
by the manufacturer, and only slowly make it back to the mainline gcc.

Unless you have very good reason to do otherwise, it is usually far
easier, safer and more efficient to get your gcc-based toolchain from
the manufacturer.  Failing that, try a third-party like Code Sourcery.

If you want to build the cross-development toolchain, look for webpages
and scripts that automate some of the process (like crosstool-ng).
Failing that, look for websites with tutorials and lists of steps to
take.  I don't recommend trying to figure this out on your own until you
have some experience using other people's guides.  (Unless, of course,
this is all for fun and learning - in which case, go for it!)

mvh.,

David


> 
> 
> On 12. 03. 19 20:43, Jonathan Wakely wrote:
>> On Tue, 12 Mar 2019 at 18:33, Branko <brane221122@xxxxxxxxx> wrote:
>>> I'd like to use my system gcc if possible to compile for such simple
>>> micro ( no OS, no infrastructure, need barebone implementation).
>>>
>>>
>>> I'm running Gentoo on x86_64, with gcc-8.3.0
>> Then your system compiler can only compile for x86_64 and x86.
>>
>>>
>>> So I cobbled up one three line example and within it just main functioin
>>> that does nothing, except returns.
>>>
>>>
>>> Then I tried "gcc -march=24kc main.c".
>>>
>>>
>>> But compiler fails with unknown architecture, even though 24ks is listed
>>> under MIPS.
>> But your system compiler targets x86_64.
>>
>> A given build of GCC targets a single CPU architecture. Yours targets
>> x86_64, not MIPS.
>>
>>> It outputs a list of suppported arches, and all of them are just within
>>> x86/x86_64 world. No ARM, not Power, nothing else.
>>>
>>>
>>> How should this be done ?
>>>
>>>
>>> I don't think about going crosscompile as the compiler will run on my
>>> host machine, while it's results would run on the micro...
>> That's the definition of a cross compiler, and is what you need to do.
>>
>> You'll have to get a MIPS cross-compiler that runs on your host
>> machine, or build one yourself.
>>
> 
> 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux