[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] array of string pointers in progmem
From: |
Peter N Lewis |
Subject: |
Re: [avr-gcc-list] array of string pointers in progmem |
Date: |
Sun, 28 Apr 2002 11:45:51 +0800 |
At 23:40 -0700 28/4/02, xol wrote:
I want to do following
Create array of pointers to strings in program memory. Strings also
must be in program memory.
I try following:
PGM_P str_table[] PROGMEM = { "ERROR", "OK" };
I get
00000026 <str_table>:
26: 61 00 67 00
Contents of section .data:
800060 01455252 4f52004f 4b00 .ERROR.OK.
Compiler put pointers to prog memory but I can't make him to put string there.
The only solution I found is this one from
<http://ww2.tiki.ne.jp/~maro/AVR/old/tips.html>:
I wish to put an array of strings into progmem. The only solution I found is
------
PROGMEM char pcStandard[] = "Standard";
PROGMEM char pcClass[] = "Class";
PROGMEM char pcVendor[] = "Vendor";
PROGMEM char pcReserved[] = "Reserved";
char * _NAME_USB_REQUEST_TYPE[] =
{pcStandard, pcClass, pcVendor, pcReserved };
It would seem that the PROGMEM attribute applies only to the
*variable* being defined. So in your example, the variable str_table
points into progmem. But the contents of that variable in progmem
are string pointers which point in to RAM.
In order for those strings to be placed in progmem, it appears there
has to be an associated variable with the PROGMEM attribute.
Perhaps someone has an alternative idea?
Peter.
--
<http://www.interarchy.com/> <ftp://ftp.interarchy.com/interarchy.hqx>
avr-gcc-list at http://avr1.org