Searching \ for '[PIC]: USING Hi-Tech C COMPILER' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'USING Hi-Tech C COMPILER'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: USING Hi-Tech C COMPILER'
2002\01\14@111011 by Ing. Gustavo Quilosa

picon face
Hi Hitech users....
   .... I'm trying to define an array in ROM, but the compiler always
reserves place in RAM, what I'm doing wrong ?

   the C code is:

   const float * add[16] = { &RAM_add};

Where RAM_add is a float variable.

       thanks in advance. Gus


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\14@133214 by John Pfaff

flavicon
face
I think your problem is that you're declaring pointers to constant
floats, not constant pointers to floats (there is a difference).  I've
gotten around that by doing this (if I remember correctly (and I may
not)):

typedef float * floatptr;

float var[4];
const floatptr reg[4] = { &var[0], &var[1], &var[2], &var[3] };

If that isn't quite correct, it's some variation of typedefs and pointer
declarations.  Sorry I don't have the code where I did this in front of
me.

John

"Ing. Gustavo Quilosa" wrote:
{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\01\14@181944 by Ing. Gustavo Quilosa

picon face
Hi Hitech users....
     .... I'm trying to define an array of pointers to float in ROM, but
the
compiler always
 reserves place in RAM, what I'm doing wrong ?

    the C code is:

    float var[4];                                 /* RAM Array */

    const float* reg[4] = { &var[0], &var[1], &var[2], &var[3] };
    const dummy = 1;

The compiler docs indicates that "const" type modifier makes "const
variables" to reside in ROM. Although, reg[0], reg[1], reg[2], reg[3] are
located in a section (psect) called rdata_0 (RAM) that it's initialized
with
an idata_0 (ROM) table initializer.
I believe the problem is that the initializers of reg [ ] are not explicit
constants cause dummy it's well placed.
Any ideas to do this ?

    thanks in advance.
                                        Gus.




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...