EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Update to gcc-4.3.3 (from 4.2) breaks my build

Started by rsturmer February 24, 2009
Since we're on the topic, and we've established that using the
bleeding edge stuff is probably bad news, what's the version I should
be using. I want to be current, but stable, and it looks like
everyone is using gcc 4.3 now, not 4.2.... what version do you guys
use of gcc, binutils, newlib, insight, gdb, et al?

-R
--- In l..., "rsturmer" wrote:
>
> ... I see now why they're called the "bleeding" edge builds...
> --- In l..., Peter Vidler wrote:
> >
> > rsturmer wrote:
> > > It's an ld thing. I was using the latest "stable release" of
> > > binutils, which is 2.19.1, but the bug is fixed in the latest source
> > > snapshot, which is 2.19.51, upgrading puts the stubs in the right
> place.
> >
> > The change I mentioned before works fine with 2.19.1.
> >
> > I'm actually thinking of changing all my linker scripts in a similar
> > way, in case future changes to ld try to dump things at the start of
> the
> > text section.
> >
> > > Since I've got your attention, does anyone have a clue why my
program
> > > might be data-aborting when it does? It never did this with the old
> > > version of the tools. This upgrade is a nightmare... but I'm
learning
> > > a lot.
> >
> > Well, I tend to stay away from bleeding-edge builds; toolchain issues
> > are just too much hassle to track down. They probably have their own
> > mailing lists and bug tracking though -- you might try there if
no-one
> > here can help.
> >
> > (Not that I actually looked at the code -- it might just be a bug in
> > your startup).
> >
> > Pete
> >
> > --
> > Peter J. Vidler
> > Senior Systems Developer, TTE Systems Ltd
> > www.tte-systems.com
>

An Engineer's Guide to the LPC2100 Series

rsturmer schrieb:
> Since we're on the topic, and we've established that using the
> bleeding edge stuff is probably bad news, what's the version I should
> be using. I want to be current, but stable, and it looks like
> everyone is using gcc 4.3 now, not 4.2.... what version do you guys
> use of gcc, binutils, newlib, insight, gdb, et al?

gcc: 4.3.2 CodeSourcery 2008q3
binutils: 2.19

Note:
- GAS has a bug concerning .syntax unified which hits you, if you write
assembly code for thumb and thumb-2.

Try "mov r1,r2" with syntax unified, it generate the opcode for
"mov loReg,HiReg" which is illegal according ARM ARM.

- Older versions have a bug: they generate a thumb-2 "nop" even if
the selected arch is ARMv4T !

--
42Bastian

Note: SPAM-only account, direct mail to bs42@...
Peter,

This fix seems to put all my code in the right place, but gdb no
longer has line number information while in the startup code, and my
.lss file doesn't show the .startup section in its listing. Can I fix
that?

-R

--- In l..., Peter Vidler wrote:
>
> 42Bastian wrote:
> > If, then not gcc but ld (binutils).
>
> Yeah, I always forget they are separate projects. Most of the time I
> lump GDB in there as well :)
>
> I found a way to work around the bug. The stub only seems to get added
> to the '.text' section, so we can add the startup to a section of its
> own (*before* '.text' in the script):
>
> .startup :
> {
> KEEP(*(.startup))
> . = ALIGN(0x100);
> } >ROM
>
> Obviously you should also remove the startup from '.text' (not that it
> would make any difference, but it could cause confusion later on).
>
> I had to add the alignment option because OpenOCD complained if I
didn't
> -- it seems to want 0x100 for some reason. Other than that it works
> perfectly, at least in my brief testing.
>
> Pete
>
> --
> Peter J. Vidler
> Senior Systems Developer, TTE Systems Ltd
> www.tte-systems.com
>

--- In l..., "rsturmer" wrote:
>
> I have a simple program for the LPC2103 that I've been building
> successfully for months with gcc 4.2, but on the switch to 4.3 (new
> machine, got the latest sources, applied the interwork patch, and
> rebuilt) I get a software interrupt as soon as I power the thing
up.
> If I break in, the thing is off in the weeds in Thumb mode. A
quick
> look at the .lss file produced by gcc turns up a pretty stark change
> to my startup code:
>
> OLD:
> 00000000 <_boot>:
>
> // Runtime Interrupt Vectors
> // -------------------------
> Vectors:
> b _start // reset - _start
> 0: ea000012 b 50 <_mainCRTStartup>
> ldr pc,_undf // undefined - _undf
> 4: e59ff014 ldr pc, [pc, #20] ; 20 <_undf>
> ldr pc,_swi // SWI - _swi
> 8: e59ff014 ldr pc, [pc, #20] ; 24 <_swi>
> ldr pc,_pabt // program abort - _pabt
> c: e59ff014 ldr pc, [pc, #20] ; 28 <_pabt>
> ldr pc,_dabt // data abort - _dabt
> 10: e59ff014 ldr pc, [pc, #20] ; 2c <_dabt>
> nop // reserved
> 14: e1a00000 nop (mov r0,r0)
> NEW:
> 00000000 <__disableIRQ_from_thumb>:
> 0: 4778 bx pc
> 2: 46c0 nop (mov r8, r8)
> 4: ea0000c2 b 314 00000008 <__restoreIRQ_from_thumb>:
> 8: 4778 bx pc
> a: 46c0 nop (mov r8, r8)
> c: ea0000e5 b 3a8 00000010 <_boot>:
> _boot:
>
> // Runtime Interrupt Vectors
> // -------------------------
> Vectors:
> b _start // reset - _start
> 10: ea000012 b 60 <_mainCRTStartup>
> ldr pc,_undf // undefined - _undf
> 14: e59ff014 ldr pc, [pc, #20] ; 30 <_undf>
> ldr pc,_swi // SWI - _swi
> 18: e59ff014 ldr pc, [pc, #20] ; 34 <_swi>
> What gives!? The compiler has dropped those functions right before
my
> start up code. Should I be booting to that? I'm tracing through
the
> assembly now to see if it makes sense, but this is a pretty stark
> change from before, so I'm just wondering if anyone else has made
> this move, and if they know what's up with this?
>
> THanks!
>
> -R
>

I have an LPC2103 project that I did about 18 months ago. I don't know
what version of gcc I was using then. However, just this past week I
have installed the latest Eclipse Ganymede, ZylinCDT, Yagarto,
OpenOCD, FreeRTOS and FlashMagic.

I know I am using gcc 4.3.2. I'm not having any issues. I've done all
the latest updates via Eclipse but I can't tell you if I have the
patches you mentioned.

I can tell you that in my makefile I explicitly compile ISR code as
ARM code (and not Thumb code).

I'm not sure how to generate the .lss file of the top of my head. If I
did I would do a compile and take a look at how the interrupt vectors
have been compiled.

TC

rsturmer wrote:
> This fix seems to put all my code in the right place, but gdb no
> longer has line number information while in the startup code, and my
> .lss file doesn't show the .startup section in its listing. Can I fix
> that?

Possibly not -- sounds like they might be hardcoded to work with the
'.text' output section (or input sections perhaps?). See also:

http://www.cygwin.com/ml/gdb/2007-03/msg00290.html

Personally, I would recommend just putting as little as possible in your
startup section and live with it until the next binutils release. Or
you could go back to an older binutils, which it seems people don't have
problems with (though I'm not sure if they're in the same situation as you).

Pete

--
Peter J. Vidler
Senior Systems Developer, TTE Systems Ltd
www.tte-systems.com

Memfault Beyond the Launch