strange problem in initialization of struct in eemem

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I've defined this struct:

#define LCD_LINE_LENGTH 16
struct menuitem{
	char item[LCD_LINE_LENGTH];
	struct menuitem *next;
	int (*func)();
};

typedef struct menuitem menuItem;
const menuItem mIcoll[4] EEMEM = 
{	{"Totale", NULL, NULL},
	{"Driver relè", NULL, NULL},
	{"Altro", NULL, NULL},
	{"NULL", NULL, NULL}		};
const menuItem mIimp[4] EEMEM = 
{	{"Cod. Utente", NULL, NULL},
	{"Cod. Impianto", NULL, NULL},
	{"Altro", NULL, NULL},
	{"NULL", NULL, NULL}		};
const menuItem mImain[6] EEMEM = 
{	{"BURN-IN G/Basic", NULL, NULL}, 
	{"Loading program.", NULL, NULL}, 
	{"<-- precedente", NULL, NULL},
	{"Collaudo", mIcoll, NULL},
	{"Impostazioni", mIimp, NULL},
	{"NULL", NULL, NULL}		};

And I want to access to the data using function like this:

void printMainMenu()
{
	char buf[LCD_LINE_LENGTH];
	lcdClear();
	eeprom_busy_wait();
	eeprom_read_block(buf, &mImain[0].item, LCD_LINE_LENGTH);
	lcdPrintData(buf);
	lcdGotoXY(0,1);
	eeprom_busy_wait();
	eeprom_read_block(buf, &mImain[1].item, LCD_LINE_LENGTH);
	lcdPrintData(buf);
}

But strange problem occurs.
Please look at the following image

Have you an idea of why the eeprom is not initialized?

Last Edited: Tue. Feb 24, 2009 - 04:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you program the generated .eep into the AVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I've found the problem. AVR studio does not load properly the eeprom even if I ask yes to the "Load EEPROM data" question.
I've to manually load the eep file when I'm in the debug.
Is this a known bug of avr studio?