Code pointer with GCC

Started by Sebastien Jacquemard November 6, 2005
Hello,
I need to declare a pointer to code with GCC.
With 8051 and keil PK51 I do this for exemple "char code *p"
How can I do the same thing with GCC (I use GCC with keil IDE) ?

Thanks,
Sebastien


An Engineer's Guide to the LPC2100 Series

Hello Sebastien,

You don't need to, the ARM has only one 32 bit address space that
contains everything (code, data, readonly data, memory mapped registers,
and more). So a "char *p" or "const char *p" can point to anything in
rom, ram, external memory, etc.

Richard. Sebastien Jacquemard wrote:

> Hello,
> I need to declare a pointer to code with GCC.
> With 8051 and keil PK51 I do this for exemple "char code *p"
> How can I do the same thing with GCC (I use GCC with keil IDE) ?
>
> Thanks,
> Sebastien >
>
> >. >
>




thanks,
sebastien
----- Original Message -----
From: "Richard Duits" <yahoo@yaho...>
To: <lpc2000@lpc2...>
Sent: Sunday, November 06, 2005 11:56 AM
Subject: Re: [lpc2000] Code pointer with GCC > Hello Sebastien,
>
> You don't need to, the ARM has only one 32 bit address space that
> contains everything (code, data, readonly data, memory mapped registers,
> and more). So a "char *p" or "const char *p" can point to anything in
> rom, ram, external memory, etc.
>
> Richard. > Sebastien Jacquemard wrote:
>
> > Hello,
> > I need to declare a pointer to code with GCC.
> > With 8051 and keil PK51 I do this for exemple "char code *p"
> > How can I do the same thing with GCC (I use GCC with keil IDE) ?
> >
> > Thanks,
> > Sebastien
> >
> >
> >
> >
> > >.
> >
> >
> >
> > Yahoo! Groups Links >



Hi,
There are no overlapping memory addresses of RAM and ROM like in 8051. Here the address space is linear. You'll know your memory layout once you look at the datasheet. So if you want to fetch a byte --> use char pointer, 4 bytes use int pointer etc..
If you want the pointer to point a particular address use this :

char *ptr = (char *) 0x10000;

Hence ptr points to memory location 0x10000.

Cheers,
Vineet.

Sebastien Jacquemard <sejacquemard@seja...> wrote:
Hello,
I need to declare a pointer to code with GCC.
With 8051 and keil PK51 I do this for exemple "char code *p"
How can I do the same thing with GCC (I use GCC with keil IDE) ?

Thanks,
Sebastien

---------------------------------
YAHOO! GROUPS LINKS ---------------------------------

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.