public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: mckennad@esatclear.ie
Cc: gdb@sources.redhat.com, insight@sources.redhat.com,
	Richard.Earnshaw@arm.com
Subject: Re: ARM Simulator Bug?
Date: Tue, 02 Sep 2003 12:43:00 -0000	[thread overview]
Message-ID: <200309021243.h82Ch7f24163@pc960.cambridge.arm.com> (raw)
In-Reply-To: Your message of "Tue, 02 Sep 2003 12:27:09 BST." <3f547e8d.791c.0@esatclear.ie>

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

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

	adr	r0, __start_of_thumb
	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.

R.

  reply	other threads:[~2003-09-02 12:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-02 11:27 David Mc Kenna
2003-09-02 12:43 ` Richard Earnshaw [this message]
2003-09-02 14:31 David Mc Kenna
2003-09-02 18:17 ` Richard Earnshaw
2003-09-03  9:13 David Mc Kenna
2003-09-03  9:51 ` Richard Earnshaw
2003-09-03 10:36 David Mc Kenna
2003-09-03 13:53 ` Richard Earnshaw
2003-09-03 14:57 David Mc Kenna
2003-09-03 15:20 ` Richard Earnshaw
2003-09-04 11:45   ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309021243.h82Ch7f24163@pc960.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.redhat.com \
    --cc=insight@sources.redhat.com \
    --cc=mckennad@esatclear.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).