[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: C question
On Sun, 4 Mar 2007 13:58:45 -0700
Andy Peters <devel@xxxxxxxxx> wrote:
> On Mar 3, 2007, at 4:57 PM, carzrgr8@xxxxxxxxxxxxx wrote:
>
> > Thanks. I threw the question to the group because I know there's
> > plenty of knowledgable people reading willing to answer it.
> >
> > Anyway, I was trying to get the compiler to generate 2 versions of
> > an initialized array: ROM, and RAM. The processor I am using has
> > more ROM than RAM, so
> > placing the code into ROM makes more sense, yet I was having
> > trouble getting access it correctly due to a routine expecting a
> > const ptr. So, I was trying it in
> > RAM, but not sure if the code was correct.
> >
> > Thanks again for the help :)
>
> You didn't say which compiler you're using, nor which architecture.
>
> But Keil's 8051 compiler has the "code" keyword, which tells the
> compiler that the variable should be put into CODE space, which is by
> definition ROM.
>
For gcc ports this keyword would be: __attribute__((section
("YOURSECTION"))) where YOURSECTION must be replaced with .text for code
in ROM.
GCC ports are not consistent though. If I develop for ARM and declare
avariable as const it will end up in RAM also unless I add the
__attribute__... keyword. However the MSP430 port places the variable in
ROM if I only declare it as const...
Maybe the reason for this behaviour is the difference in complexity in
ARM and MSP430 micros...
HTH,
Hans
> -a
>
>
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
>
--
$ cat .sig /dev/null
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user