Re: [arm-gnu] thumb code calling arm subroutine causes undefined insn exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] thumb code calling arm subroutine causes undefined insn exception
- To: 42Bastian <list-bastian.schick@xxxxxxxxxxx>
- Subject: Re: [arm-gnu] thumb code calling arm subroutine causes undefined insn exception
- From: Richard Earnshaw <rearnsha@xxxxxxx>
- Date: Wed, 28 Apr 2010 15:57:54 +0100
On Wed, 2010-04-28 at 16:54 +0200, 42Bastian wrote:
> Am 28.04.2010 16:02, schrieb Andrew Kohlsmith (mailing lists account):
> > On Sunday 25 April 2010 10:43:51 pm Mark Mitchell wrote:
> >> Andrew Kohlsmith (mailing lists account) wrote:
> >>> Since I am already using -mcpu=arm7tdmi, would this indicate that there
> >>> is a bug in the compiler wherein it is assuming that the BLX instruction
> >>> exists on the ARM7TDMI/TDMI-S?
> >>
> >> Please post your exact options for all of (a) code compiled with
> >> GCC/G++, (b) code assembled with GAS, (c) link line.
> >
> > Actually some further inspection seems to lead to the conclusion that
> > incorrect bootup code (in my case it's using msr in thumb mode) causes the
> > linker to become confused.
> >
> > -A.
> >
> > boot.s:
> > ------------------
> > .equ MIN_STACK, 0x0004 /* enough for a RET */
> > .equ IRQ_STACK_LEN, 0x0080 /* 128 words */
> > .equ STACK_LEN, 0x0200 /* 512 words */
> >
> > /* .text is used instead of .section .text so it works with arm-aout too. */
> >
> > .text
> > .code 32
> >
> > .align 0
> >
> > .extern main
> > .global start
> > .global endless_loop
> >
> > start:
> > ldr r0, =thumb_start + 1 /* +1 to set LSB to
> identify
> > destination as thumb code */
> > bx r0
>
> >
> > .code 16
>
> You should add
> .thumb_func
> and then omit the above +1
>
> >
> > thumb_start:
>
.thumb_func shouldn't be needed these days.
However, you probably want to add a
.type thumb_start, %function
directive.
R.