eeprom_read_block function warning

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

Hi guys,

can you prompt me how to get rid form warning (AVR Studio 6.2)? I am using

eeprom_read_block(void *__dst, const void *__src,
size_t __n) 

function from avr/eeprom.h. But second parameter is digit:

eeprom_read_block(&uid, 8184, 8);

and I see warning:

Quote:
passing argument 2 of '__eerd_block_EEPROM_SUFFIX' makes pointer from integer without a cast [enabled by default]

It is working. But how remove this warning?

Thank you

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

The compiler is telling you that 8184 is not a pointer. It's right it's not. It's an integer. If you want to tell the compiler "interpret this integer as if it were a pointer value" you use a typecast:

eeprom_read_block(&uid, (const void *)8184, 8); 

but this does raise the question as to why it is that you are using absolute addressing in the EEPROM? Have you never heard of EEMEM? Do you really think you can do a better job of laying out variables in the EEPROM than the linker will?

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

I use it for specific aim. External programmer write random value on this bytes (8 last bytes in eeprom). This value will be used during initialization my device. And this random value must be different at all microcontrollers. My own PC soft manages programming process using atprogram tool.