public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* pointer problem
@ 2002-09-13  9:37 John Gonzaga
  0 siblings, 0 replies; only message in thread
From: John Gonzaga @ 2002-09-13  9:37 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

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 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-13 16:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13  9:37 pointer problem John Gonzaga

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).