avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] array of string pointers in progmem


From: Slawomir Kawalek
Subject: Re: [avr-gcc-list] array of string pointers in progmem
Date: Mon, 29 Apr 2002 08:54:11 +0200

I do it in the following way:

1. for one string:
 const char szErrorInfo[] PROGMEM = ("Error");
 

2. for table of strings:
 
#define CMD_HELP             "HELP"
#define CMD_HELP_CHAR  "?"
#define CMD_EXIT               "EXIT"
#define CMD_PASSWORD  "PASS="
PGM_P szProgMemCommands[15];
 
void InitSetup( void)
{
 
 BYTE iCnt=0;
 
 szProgMemCommands[iCnt++]=PSTR( CMD_HELP);
 szProgMemCommands[iCnt++]=PSTR( CMD_HELP_CHAR);
 szProgMemCommands[iCnt++]=PSTR( CMD_EXIT);
 szProgMemCommands[iCnt++]=PSTR( CMD_PASSWORD);
 ...
}
 
 
Maybe it could be possible to make it easier but it also works...

Slawomir Kawalek
 
 

----- Original Message -----
From: xol
To: address@hidden
Sent: Monday, April 29, 2002 8:40 AM
Subject: [avr-gcc-list] array of string pointers in progmem
 

Hi.
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.
 
Any Ideas?
Thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]