public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: ARM Simulator Bug?
@ 2003-09-02 14:31 David Mc Kenna
  2003-09-02 18:17 ` Richard Earnshaw
  0 siblings, 1 reply; 11+ messages in thread
From: David Mc Kenna @ 2003-09-02 14:31 UTC (permalink / raw)
  To: Richard Earnshaw, mckennad, gdb, insight, Richard.Earnshaw

Hi Richard,

Thanks for the reply.

>It's more likely to be the way you are trying to get into Thumb state.  Try

>
>	adr	r0, __start_of_thumb

Should this line not be

	adr	r0, __start_of_thumb+1

To set the LSB to tell the core we want to enter Thumb mode

>	bx	r0
>	.code 16
>	.global __start_of_thumb
>	.thumb_func
>__start_of_thumb:
>
>
>This is really brokenness in the way gas implements ARM and Thumb code 
>areas, but it's hard to fix properly until GAS starts using mapping 
>symbols.

If I use the +1 code above, and set a breakpoint at the adr command, I can single
step successfully past the BX command and into my main.

But if I set a breakpoint further down, e.g. after two NOPS, and hit continue,
things go astray again. It seems that gdb does not know that  when it does a
continue that it is in thumb mode and that it is executing 32bit arm commands
( e.g. 2*16bit Thumb Commands).

Is it possible to see the commands the simulator recieves as you can with the
remote serial commands , i.e. set debug remote 1?


Thanks,
Dave


--
http://www.iol.ie

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: ARM Simulator Bug?
@ 2003-09-03 14:57 David Mc Kenna
  2003-09-03 15:20 ` Richard Earnshaw
  0 siblings, 1 reply; 11+ messages in thread
From: David Mc Kenna @ 2003-09-03 14:57 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: gdb, insight

Hi Richard,

>Does "arm-elf-objdump -xd exe-file" display something sensible?

When I compared the working to non-working output, the only difference was in
the private flags:

Working:
private flags = 6: [interworking enabled] [APCS-32] [FPA float format] [has
entry point]

Broken:
private flags = 4: [interworking enabled] [APCS-32] [FPA float format]

It seems that it cannot find the entry point. Even though it is defined as always
being 0x00.

Any ideas?

Thanks,
Dave


--
http://www.iol.ie

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: ARM Simulator Bug?
@ 2003-09-03 10:36 David Mc Kenna
  2003-09-03 13:53 ` Richard Earnshaw
  0 siblings, 1 reply; 11+ messages in thread
From: David Mc Kenna @ 2003-09-03 10:36 UTC (permalink / raw)
  To: Richard Earnshaw, mckennad, Richard Earnshaw, gdb, insight,
	Richard.Earnshaw
  Cc: gdb, insight, Richard.Earnshaw

Hi Richard,

I think I have gotten closer to solving my problem. It relates to the linker
script I use with compilation of gcc. 

If I take the standard armelf.x from the ldscripts directory and link against
it my problem disappears. My problem is that I wish to place my reset vectors
at 0x00 not the standard 0x8000. So I change the line:

  /* Read-only sections, merged into text segment: */
  . = 0x8000;

to

  /* Read-only sections, merged into text segment: */
  . = 0x00;

and my problem resurfaces. At a quick check of my memory contents from gdb at
0x00 I get 0x01 as opposed to what I get when I "download" the program using
Run->Download of 0xEA000015.

Any ideas?

Thanks,
Dave


--
http://www.iol.ie

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: ARM Simulator Bug?
@ 2003-09-03  9:13 David Mc Kenna
  2003-09-03  9:51 ` Richard Earnshaw
  0 siblings, 1 reply; 11+ messages in thread
From: David Mc Kenna @ 2003-09-03  9:13 UTC (permalink / raw)
  To: Richard Earnshaw, mckennad, gdb, insight, Richard.Earnshaw; +Cc: gdb, insight

Hi Richard,

>Try using an 
>
>	LDR r0, =__thumb
>

This command places the correct value into R0 for the BX command, but the bug
within the simulator is still present. 

Take the following code as an example.

0000005c <TST_start>:
  5c:   e3a0da12        mov     sp, #73728      ; 0x12000
  60:   e59f00a4        ldr     r0, [pc, #164]  ; 10c <IRQ_Interrupt+0x50>
  64:   e12fff10        bx      r0

00000068 <__start_of_thumb>:

void    IRQ_Interrupt(void);

int main()
{
  68:   b580            push    {r7, lr}
  6a:   466f            mov     r7, sp
  6c:   b082            sub     sp, #8

If I place a breakpoint at 0x6c and run the code gdb loses itself, i.e. if I
interrupt it with ctrl-c it says the PC is 0x0580fa70 or some thing similar.
Again, if I place a breakpoint at 0x5c, I can single step successfully. If I
single step to 0x68 and place a breakpoint at 0x6c and continue, gdb loses itself
again.

This problem only occurs when I attempt to use thumb. If I remove the bx command
and compile my C file in ARM mode the simulator works perfectly.

Is it possible to see which commands the simulator is executing? 

Thanks,
Dave


--
http://www.iol.ie

^ permalink raw reply	[flat|nested] 11+ messages in thread
* ARM Simulator Bug?
@ 2003-09-02 11:27 David Mc Kenna
  2003-09-02 12:43 ` Richard Earnshaw
  0 siblings, 1 reply; 11+ messages in thread
From: David Mc Kenna @ 2003-09-02 11:27 UTC (permalink / raw)
  To: gdb, insight

Hi all,

Has anyone else come across something similar to the below??

I have a startup file embedded in a header file using inline assembly. This
file contains the Interrupt vectors for an ARM7TDMi. The main file is compiled
as ARM and I can simulate this perfectly. 
   When I insert a BX command at the end of the inline assembly and add the
-mthumb CL option to instruct gcc to compile the main as thumb it generates
the elf. Then when I go to the simulator things go weird. If I place a "b ."
command at the end of the inline assembly, I can stop gdb at this point and
it stays at the correct point, i.e. at the b .. But if I remove the "b ." command
the simulator goes hay-wire, i.e. Does not know where it is


The embedded file:

asm(".org 0x00\n"
"\n"
"	b 	tst_start	@		SVC	0x00\n"
"	b	tst_start	@ 	Undfd InstrUND	0x04\n"
"	b	tst_start	@	SWI _StartupSVC	0x08\n"
"	b 	tst_start	@	Pre Abort ABORT	0x0C\n"
"	b	tst_start	@	Data AbortABORT	0x10\n"
"	b	tst_start\n"
"	b	tst_start	@	IRQ _StartupIRQ	0x18\n"
"	b	tst_start @	FIQ _Startup	FIQ	0x1C\n"
".global tst_start\n"
"tst_start: \n"
"	mov	sp,#0x12000\n"
"	adr	R0,tmp+1\n"
"	bx	R0\n"   !!!!!!!!! Problem Line 
".code 16\n"
"tmp:\n"
"\n");


My main file:


#include "tester.h"

int main()
{
	unsigned int b=0x01;
	unsigned int count = 0x00;	
	
	while ( b != 0x00)
	{
		count++;
	}
	return 0;

}

My compile script:

arm-elf-gcc.exe -mthumb \
 $1.c -mthumb-interwork -mcpu=arm7tdmi\
   -g -Wall -nostartfiles -mlittle-endian -save-temps -O$2 \
    -Wl,-T /c/tst/scripts/clink.x  -o $1.elf

I have tried this with the same result with gcc3.2.3, gcc version 3.3.2 20030825
and gdb snapshots from 10-6-2003 and 01-09-2003

Any ideas?

Thanks,
Dave Mc Kenna


--
http://www.iol.ie

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-09-04 11:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-02 14:31 ARM Simulator Bug? David Mc Kenna
2003-09-02 18:17 ` Richard Earnshaw
  -- strict thread matches above, loose matches on Subject: below --
2003-09-03 14:57 David Mc Kenna
2003-09-03 15:20 ` Richard Earnshaw
2003-09-04 11:45   ` Richard Earnshaw
2003-09-03 10:36 David Mc Kenna
2003-09-03 13:53 ` Richard Earnshaw
2003-09-03  9:13 David Mc Kenna
2003-09-03  9:51 ` Richard Earnshaw
2003-09-02 11:27 David Mc Kenna
2003-09-02 12:43 ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).