EEprom decalration occupy SRAM memory

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

Hello,

I use at90can128 with optimizer on "“0S and want to use the eeprom

In .h file

typedef struct
{
uint32_t VAL;
uint16_t CRC;
}EEPROM_32;

In C file I declare my EE_SCHEDULE_INTERVAL

EEPROM_32 EEMEM EE_SCHEDULE_INTERVALL[3] = {
{0x00005460,0xBF04},
{0x00005460,0xBF04},
{0x00005460,0xBF04}
};

When compiling the Data memory usage increase equal to the eeprom usage. So it seems like declaring of a EEPROM struct occupies SRAM memory.
What do I do wrong?

Br Leif G

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

Quote:

When compiling the Data memory usage increase equal to the eeprom usage

That's a known bug in AS6 memory usage reporting. If you want the true figure use avr-size outside of AS6 (or as a post build step). Because of the faultin previous threads Atmel have given a way to switch off their own, errant, size reporting but my brain is too addled to remember exactly what the incantation is right now - a search will likely find it.

As a test I built this:

#include 
#include 

typedef struct
{
	uint32_t VAL;
	uint16_t CRC;
}EEPROM_32;

EEPROM_32 EEMEM EE_SCHEDULE_INTERVALL[3] = {
{0x00005460,0xBF04},
{0x00005460,0xBF04},
{0x00005460,0xBF04}
};

int main(void) {
	while (1) {
	}
}

and AS6 said this:

		"C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-size.exe" "GccApplication1.elf"
		   text	   data	    bss	    dec	    hex	filename
		     40	     18	      0	     58	     3a	GccApplication1.elf
	Done executing task "RunCompilerTask".
	Using "RunOutputFileVerifyTask" task from assembly "C:\Program Files\Atmel\Atmel Studio 6.0\Vs\Compiler.Task.dll".
	Task "RunOutputFileVerifyTask"
				Program Memory Usage 	:	40 bytes   0.2 % Full
				Data Memory Usage 		:	18 bytes   1.8 % Full
				EEPROM Memory Usage 	:	18 bytes   3.5 % Full

But when I run avr-size separately I get:

C:\Documents and Settings\asl\My Documents\Atmel Studio\GccApplication1\GccApplication1\Debug>avr-size -C --mcu=atmega16
 GccApplication1.elf
AVR Memory Usage
----------------
Device: atmega16

Program:      40 bytes (0.2% Full)
(.text + .data + .bootloader)

Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)

EEPROM:       18 bytes (3.5% Full)
(.eeprom)

which is the correct answer.

Last Edited: Fri. Oct 12, 2012 - 10:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks like a "feature" of AS6.

				Program Memory Usage 	:	160 bytes   1.0 % Full
				Data Memory Usage 		:	18 bytes   1.8 % Full
				EEPROM Memory Usage 	:	18 bytes   3.5 % Full

This is what AS4 produces:

Device: atmega169p

Program:     122 bytes (0.7% Full)
(.text + .data + .bootloader)

Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)

EEPROM:       18 bytes (3.5% Full)
(.eeprom)

Don't worry about it. You may have to manually subtract eeprom size from SRAM.

David.

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

I appreciate the fast response, I will ignore this and do it manualy, The output you refer to is exact what I see her. Thanks.

Br Leif G