On 4 June 2012 09:09, Oldrine Lewis <[email protected]> wrote:

> I also noticed that all my const array of structs are being stored in RAM.
> Is there any way to force const them into program memory
>

Yes, but that might not be what you really want. Since the Iris uses an AVR
chip, you have a Harvard memory architecture. This means that the program
space and RAM space are separate, so to access constants you need specific
code to read from program space rather than plain RAM (using the
instruction "LPM"). The header file <avr/pgmspace.h> defines the macro
PROGMEM which instructs the compiler to place a const entity in program
memory, as well as some macros for easier reading from program space (e.g.
pgm_read_byte_near/far). If you're storing string constants in program
space, there is also a whole bunch of str..._P functions which directly
take a program space string pointer.

Hth,
/Johny
-- 
Johny Mattsson
Senior Software Engineer

DiUS Computing Pty. Ltd.
*where ideas are engineered
*
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to