From: Hans-Bernhard Bröker on
Jim wrote:
> Hi,
>
> I'm using the free Code Sourcery Lite gcc for m68k for a home project
> that involves a micro with 68000 cpu core. I added -lgcc to the
> linker flags to resolve an issue with __divsi3.

That should never be necessary. GCC already puts -lgcc into the linker
command line it builds, whenever that serves a useful purpose.

> If this is true and that
> lib is built with that instruction set, it wouldn't be compatible with
> my object code. I think this is what the error is saying.

More to the point, GCC would probably have to be built with multilib
support to allow switching between incompatible variants of the same
basic CPU architecture. That would include multiple copies of libraries
such as libgcc, the Standard C++ runtime, and startup code as needed,
and the gcc driver program would automatically pick those needed for the
chosen architecture.

For whatever reasons, your GCC apparently wasn't built that way. Maybe
you need to pick a different package. Or, who knows, you may even have
to bite the bullet and build your own GCC tool chain.
From: David Brown on
Hans-Bernhard Br�ker wrote:
> Jim wrote:
>> Hi,
>>
>> I'm using the free Code Sourcery Lite gcc for m68k for a home project
>> that involves a micro with 68000 cpu core. I added -lgcc to the
>> linker flags to resolve an issue with __divsi3.
>
> That should never be necessary. GCC already puts -lgcc into the linker
> command line it builds, whenever that serves a useful purpose.
>
> > If this is true and that
>> lib is built with that instruction set, it wouldn't be compatible with
>> my object code. I think this is what the error is saying.
>
> More to the point, GCC would probably have to be built with multilib
> support to allow switching between incompatible variants of the same
> basic CPU architecture. That would include multiple copies of libraries
> such as libgcc, the Standard C++ runtime, and startup code as needed,
> and the gcc driver program would automatically pick those needed for the
> chosen architecture.
>
> For whatever reasons, your GCC apparently wasn't built that way. Maybe
> you need to pick a different package. Or, who knows, you may even have
> to bite the bullet and build your own GCC tool chain.

CodeSourcery gcc (for the ColdFire, anyway - I don't know about other
targets) /is/ built with multilib. It's just that they don't supply
pre-built libraries for all the architectures supported by the compiler
- pure 68000 is so old that it's rarely used. Mind you, other devices
such as the 68332 are still very much in use, and there are no pre-built
libraries for the CPU32 core either - the downloadable binaries (in the
"lite" version anyway) only include ColdFire libraries.

From: Jim on
First, I'd like to thank everyone for their input! Second, I'd like
to answer some of the questions so no one feels left out:

- The target cpu is truly a 68000 core (the old Dragonball EZ328).
Now, to avoid the "why": it's a Palm pda which has a display and
formfactor that I need and it's cheap.
- I'm using my own OS on the embedded system (no Linux).
- Now that I think about it, I upgraded my Linux box to 2.4, so I'm
not that "ancient" :). I have a 2.6 one at work. I want to do my
development work in MS Windows, but I could build libgcc on Linux, if
I have to).
- I read the GettingStarted guide and I looked at all the libgcc.a
files: all seem to be ColdFire based :(.
- I'm coding mostly from scratch. However, I'm using a modified GDB
stub from David Williams.
- The only two languages I'll consider using for embedded projects are
C and C++ (plus the little bit of necessary assembly). It's what I'm
really familiar with.
- I don't really care if the object code is COFF or ELF. The
executable has to be straight binary though.
- I use gcc for linking. But I still need to explicitly say -lgcc
because of the -nodefaultlibs linker flag (I think). For the sake of
completeness, my compile and link lines are:

m68k-elf-gcc -o bin/main.o -m68000 -I. -I../shared -fno-exceptions -
Wall -Wa,-m68000 -ggdb -c main.c

m68k-elf-gcc -Wl,-T,RadioTest.ldi bin/MyStartup.o bin/main.o bin/
Timer.o -o bin/RadioTest.elf -m68000 -I. -I../shared -fno-exceptions -
Wall -Wa,-m68000 -ggdb -Wl,-Map,bin/RadioTest.map,--cref -nostdlib -
nostartfiles -nodefaultlibs -lgcc


So, I think the general consensus is I only get ColdFire micro support
with CodeSourcery and I agree with this. I can understand why
CodeSourcery may want to ignore older cores. However, don't they
still make micros with that (68000 based) core? I might email them,
but since I'm using the free version, I feel funny bothering them with
this (they do need to earn a living). Purchasing it would be a real
gamble since they do say it's a ColdFire compiler on their website
(and for home use, it's kinda a pricey gamble).

I'm gonna try two things. First, I'll look for other precompiled
binaries for MS Windows. Maybe I'll luck out. I came across one the
other day, but now can't remember for the life of me who made it--I'm
sure it'll turn up in a search.

Second, I'll see if I can build libgcc. I assume I'll get the source
to this when I download the source to gcc. David suggested I use
MinGW. I'm pretty sure I'll need "configure" and maybe autoconf &
automake. I'm not familiar with MinGW: does that package have them?

I just got an idea. PrcTools was a MS Windows compiler for that very
micro. I remember trying it, but it was a limited 16b compiler trying
to be compatible with the Palm OS. However, I might be able to use
its libgcc. The only issue is that compiler is so old it's probably
COFF based (and of course CodeSourcery is ELF). Nothing's ever
easy. :)

Well, thanks again for your help everyone. I'll post what I finally
end up with (in case anyone else needs the info).


Jim
From: 42Bastian Schick on
On Wed, 4 Nov 2009 15:58:50 -0800 (PST), Jim <adirondackmtn(a)yahoo.com>
wrote:

>First, I'd like to thank everyone for their input! Second, I'd like
>to answer some of the questions so no one feels left out:
>
>- The target cpu is truly a 68000 core (the old Dragonball EZ328).
>Now, to avoid the "why": it's a Palm pda which has a display and
>formfactor that I need and it's cheap.

Funny, have such lying around and waiting for a project :-)

>Second, I'll see if I can build libgcc. I assume I'll get the source
>to this when I download the source to gcc.

Why not just add the needed functions to your project ?
I mean, LD will complain about missing __???? and you just pull the
source and that's it.
I wouldn't bother building libgcc.a

>Well, thanks again for your help everyone. I'll post what I finally
>end up with (in case anyone else needs the info).

Yes, please do so.

--
42Bastian
Do not email to bastian42(a)yahoo.com, it's a spam-only account :-)
Use <same-name>@monlynx.de instead !
From: Tauno Voipio on
42Bastian Schick wrote:
> On Wed, 4 Nov 2009 15:58:50 -0800 (PST), Jim <adirondackmtn(a)yahoo.com>
> wrote:
>
>> First, I'd like to thank everyone for their input! Second, I'd like
>> to answer some of the questions so no one feels left out:
>>
>> - The target cpu is truly a 68000 core (the old Dragonball EZ328).
>> Now, to avoid the "why": it's a Palm pda which has a display and
>> formfactor that I need and it's cheap.
>
> Funny, have such lying around and waiting for a project :-)
>
>> Second, I'll see if I can build libgcc. I assume I'll get the source
>> to this when I download the source to gcc.
>
> Why not just add the needed functions to your project ?
> I mean, LD will complain about missing __???? and you just pull the
> source and that's it.
> I wouldn't bother building libgcc.a
>
>> Well, thanks again for your help everyone. I'll post what I finally
>> end up with (in case anyone else needs the info).
>
> Yes, please do so.
>

The compiler will generate the libgcc.a calls when it
feels them needed. There's little that the programmer
can control here.

Contrary to the C library, libgcc.a is needed nearly
always when GCC generates code. You cannot skip it.

(Been there, done that - GCC ports to ARM/Thumb at GCC 2.95 time)

--

Tauno Voipio