public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: John Gonzaga <jgonzaga@pnicorp.com>
To: "'gcc-help@gcc.gnu.org'" <gcc-help@gcc.gnu.org>
Subject: pointer problem
Date: Fri, 13 Sep 2002 09:37:00 -0000	[thread overview]
Message-ID: <30C1F709FEEBD511B11400B0D049495904B0AF@server2> (raw)

We just got our boot code running and I'm trying to make a simple C++
program. But here's my problem:

#define REGBASE  0x3FF0000
#define IOPDATA  (REGBASE+0x5008)

// LED class
class LED
{
	public:
		LED( unsigned long * );
	...
}

 ... in main

// This code will not work
unsigned long * ioport = ( unsigned long * )IOPDATA;
LED * pLED = new LED( ioport );

// ... but this works!
LED * pLED = new LED( ( unsigned long * )IOPDATA );

Looking at the dump for the code that doesn't work.

	unsigned long * ioport = ( unsigned long * )IOPDATA
10001d4:      e3a03008        mov     r3, #8               ; 0x08
10001d8:      e28337ff        add     r3, r3, #66846720    ; 0x3fc0000
10001dc:      e2833a35        add     r3, r3, #217088      ; 0x35000
10001e0:      e50b3030        str     r3, [fp -#48]
      LED * pLED = new LED( ioport );
10001e4:      e3a00004        mov     r0, #4               ; 0x4
10001e8:      eb00022d        bl      1000aa4 <__builtin_new>
      ...

What happens if I set a breakpoint at 10001e4 is r3 will have a value of
0x3fc0008 which is 0x3ff5008 - 0x35000 but if I set a breakpoint at 10001d4
and step through until 10001e4, r3 will have 0x3ff5008. Then I hit go the
program would run okay. Somehow address 10001dc gets ignored, any ideas.
BTW, our target is a Samsung ARM7TDMI (S3C4530A). Thanks.

John Gonzaga
jgonzaga@pnicorp.com 

                 reply	other threads:[~2002-09-13 16:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=30C1F709FEEBD511B11400B0D049495904B0AF@server2 \
    --to=jgonzaga@pnicorp.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).