Motherboard Forums


Reply
Thread Tools Display Modes

embedded gcc linker issue--trying to build for m68000 cpu

 
 





















Hans-Bernhard Bröker
Guest
Posts: n/a

 
      11-04-2009, 09:16 PM


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.
 
Reply With Quote
 
Jim
Guest
Posts: n/a

 
      11-04-2009, 11:58 PM
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
 
Reply With Quote
 
42Bastian Schick
Guest
Posts: n/a

 
      11-05-2009, 06:02 AM
On Wed, 4 Nov 2009 15:58:50 -0800 (PST), Jim <>
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 , it's a spam-only account :-)
Use <same-name>@monlynx.de instead !
 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      11-05-2009, 09:13 AM
42Bastian Schick wrote:
> On Wed, 4 Nov 2009 15:58:50 -0800 (PST), Jim <>
> 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
 
Reply With Quote
 
Chris Burrows
Guest
Posts: n/a

 
      11-05-2009, 12:34 PM
"Jim" <> wrote in message
news:14e64133-7221-449b-8240-...
> - The target cpu is truly a 68000 core (the old Dragonball EZ328).


> - I'm using my own OS on the embedded system (no Linux).


> I want to do my
> development work in MS Windows


> - I'm coding mostly from scratch.


> - 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.


> First, I'll look for other precompiled
> binaries for MS Windows.
>


If you hit a brick wall with gcc check out the Manx Aztec C68K MS-DOS
cross-compiler. AFAIR Aztec C had a great reputation in the 1980's.

The software rebundled for Windows XP is here:

http://www.aztecmuseum.ca/compilers.htm#aztec68K

The manual is here:

http://www.bitsavers.org/pdf/manx/

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com




 
Reply With Quote
 
ChrisQ
Guest
Posts: n/a

 
      11-05-2009, 01:05 PM
Jim 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.



If you are working with dragonball, there were loads of sites out there
a few years ago and some are most likely still around, Mark Wyman's site
was one, another called dragonball developers lair and there were
others. I only stopped using 328 series because it went eol at motorola.
Was not pleased and needless to say, I won't be using their product in
the future :-(.

I used the vz328 and built the tool chain from source, originally gcc
2.7.2. It wasn't the latest version, but found it more than up to the
task. It was rebuilt for solaris 10 on sparc a year or two ago with
version gcc 2.95.1, binutils 2.1 and newlib-1.8.2. 2.95 produces pretty
good code and seems bug free, so there's no real point in upgrading to a
later version, which seems to get more difficult to build from source
with every revision.

If you need sol10 sparc binaries for the toolchain, let me know...

Regards,

Chris


 
Reply With Quote
 
David Brown
Guest
Posts: n/a

 
      11-05-2009, 01:28 PM
Jim 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.
> - 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).


These days, gcc and related tools can all be built happily on windows
with mingw and msys. Building on Linux can be much faster and easier,
especially if you want to do the optional parts like building the man
pages or using the autoconf stuff, but for the compiler and libraries
there should be no real problem - if you still want to do that. The
source download from CodeSourcery should give you what you need, in
addition to mingw and msys. You may need to get a few of the extra
mingw/msys packages.

> - I read the GettingStarted guide and I looked at all the libgcc.a
> files: all seem to be ColdFire based .


Yes, it looks very much like that's the only libraries they have
pre-built. But the compiler certainly supports it the 68000 devices.

An alternative idea is just to find some older binaries from around the
net. CodeSourcery always has the latest versions with the newest
features, since they are the maintainers, but there are plenty of other
builds around. Development tool resellers and debugger vendors often
have packages to download - try some and see if you get the right
libraries there, saving you some effort. For example,

<http://www.macraigor.com/full_gnu.htm>

> - 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).
>


The support for the free version is a mailing list. You don't get any
guarantees of an answer, and it might be from another user rather than a
CodeSourcery developer, but my experience is that they are helpful
regardless of whether or not the poster is a customer. You should feel
entirely free to post to these lists. They will also be able to tell
you whether the commercial versions of their tools have the right
pre-built libraries (you can also download a 30-day trial version of
those tools).

Another mailing list of possible interest is .

> 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 can't remember off-hand if you get autoconf and automake with the
standard mingw/msys packages - it's a while since I installed a new
version of these tools, and the packaging has changed a little since
then. But you can certainly find out about them on the mingw and msys
websites.

> 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.
>


You probably don't want to mix libgcc from a different version than the
gcc compiler. libgcc is a support library for the compiler, and is
closely tied to it - it's not like the standard C library that can be
replaced.

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

 
Reply With Quote
 
Jim
Guest
Posts: n/a

 
      11-17-2009, 12:16 AM
On Nov 4, 6:58*pm, Jim <adirondack...@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.
> - I'm using my own OS on the embedded system (no Linux).
>
> ...text deleted for brevity...
>
> 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 buildlibgcc. *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
> itslibgcc. *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


Problem solved. I looked at the libc files and they were pretty
simple. I think there was only one macro definition I had to figure
out. But, then I realized my next step would be to build newlib and
that wasn't gonna be that simple.

I looked at a bunch of pre-built stuff (thanks again everyone for the
links--I may compare the Aztec C output to gcc someday). I decided I
really wanted GNU because I know the debugger works with Eclipse.
By the way, the other pre-built gcc I was thinking of was www.ronetix.it.
It had everything I needed, but, unfortunately, there was a flaw with
it (either the binary wasn't produced correctly or gdb didn't load it
correctly--I didn't look into it further). One other by ASH WARE was
too old (2.95 and coff based--I wasn't sure an elf type gdb would
handle it). The Macgregor (sp?) didn't run (I need a cygwin dll).

So, I ended up building gcc and newlib using mingw/msys like David
suggested. I was intrigued by the idea. I'm still gonna use
CodeSourcery's gcc though (I figure they ran some of the gcc tests).
I'll just link to the libc, libgcc, etc. produced by me (so far tests
show it's ok). It wasn't TOO bad building the libs. There were some
tricks to get things to build right--I spent some time doing
searches. I think the biggest thing to remember is that many tools
want you to do these three things:
(1) create a folder outside of the source tree to hold intermediate
files.
(2) run configure and build from the folder created in (1)
(3) Use a RELATIVE path when running configure in (2). You can get
weird compile errors otherwise. Unfortunately many docs have scripts
that use the full path (including the one at mingw). Maybe this used
to work for older gcc.

One last thing: gcc needs to build mpfr and gmp. It turns out for
the 4.2.1 and 4.4.2 releases I did, all you have to do it place the
source in the gcc folder (omit the -version part of the folder name).
I'm sure there's other ways to do it as well.

Well, thanks again everyone for all of your input! It was fun (for me
anyways)!!


Jim
 
Reply With Quote
 
42Bastian Schick
Guest
Posts: n/a

 
      11-17-2009, 06:58 AM
On Mon, 16 Nov 2009 16:16:15 -0800 (PST), Jim
<> wrote:

>Well, thanks again everyone for all of your input! It was fun (for me
>anyways)!!


Thanks for follow-up Jim.

--
42Bastian
Do not email to , it's a spam-only account :-)
Use <same-name>@monlynx.de instead !
 
Reply With Quote
 
David Brown
Guest
Posts: n/a

 
      11-17-2009, 09:12 AM
Jim wrote:
> On Nov 4, 6:58 pm, Jim <adirondack...@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.
>> - I'm using my own OS on the embedded system (no Linux).
>>
>> ...text deleted for brevity...
>>
>> 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 buildlibgcc. 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
>> itslibgcc. 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

>
> Problem solved. I looked at the libc files and they were pretty
> simple. I think there was only one macro definition I had to figure
> out. But, then I realized my next step would be to build newlib and
> that wasn't gonna be that simple.
>
> I looked at a bunch of pre-built stuff (thanks again everyone for the
> links--I may compare the Aztec C output to gcc someday). I decided I
> really wanted GNU because I know the debugger works with Eclipse.
> By the way, the other pre-built gcc I was thinking of was www.ronetix.it.
> It had everything I needed, but, unfortunately, there was a flaw with
> it (either the binary wasn't produced correctly or gdb didn't load it
> correctly--I didn't look into it further). One other by ASH WARE was
> too old (2.95 and coff based--I wasn't sure an elf type gdb would
> handle it). The Macgregor (sp?) didn't run (I need a cygwin dll).
>


Installing cygwin isn't hard, unless you bump into problems with
incompatible versions of cygwin1.dll...

> So, I ended up building gcc and newlib using mingw/msys like David
> suggested. I was intrigued by the idea. I'm still gonna use


Well done! Building gcc is not as hard as it used to be, but it is
still not for the faint of heart. It is somewhat like fixing your own
car instead of taking it to the garage - it takes time, and you can get
pretty stressed and dirty in the process, but it's fun if you like that
sort of thing and you get a sense of achievement in the end.

> CodeSourcery's gcc though (I figure they ran some of the gcc tests).
> I'll just link to the libc, libgcc, etc. produced by me (so far tests
> show it's ok). It wasn't TOO bad building the libs. There were some
> tricks to get things to build right--I spent some time doing
> searches. I think the biggest thing to remember is that many tools
> want you to do these three things:
> (1) create a folder outside of the source tree to hold intermediate
> files.
> (2) run configure and build from the folder created in (1)
> (3) Use a RELATIVE path when running configure in (2). You can get
> weird compile errors otherwise. Unfortunately many docs have scripts
> that use the full path (including the one at mingw). Maybe this used
> to work for older gcc.
>


Good advice.

> One last thing: gcc needs to build mpfr and gmp. It turns out for
> the 4.2.1 and 4.4.2 releases I did, all you have to do it place the
> source in the gcc folder (omit the -version part of the folder name).
> I'm sure there's other ways to do it as well.
>
> Well, thanks again everyone for all of your input! It was fun (for me
> anyways)!!
>


Thanks for the feedback.
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
For Tiger and Leopard users Michelle Steiner Apple 1 09-11-2009 02:02 AM
Security update 2008-2 Michelle Steiner Apple 0 03-19-2008 12:19 AM
Mac Security: QuickTime 7.2 Update Derek Currie Apple 15 07-15-2007 07:39 AM


All times are GMT. The time now is 07:43 AM.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43