More specifically, result of
#include <Arduino.h>
__attribute__((section(".eeprom"))) uint8_t eepContent[6] = {0,1,0xFF,3,4,5};
void setup() { Serial.begin(9600); }
void loop() { delay(1000); }
is
:00000001FF
(empty)
but
#include <Arduino.h>
__attribute__((section(".eeprom"))) uint8_t eepContent[6] = {0,1,0xFF,3,4,5};
void setup() { Serial.begin(9600); }
void loop() { delay(1000); uint8_t value = eeprom_read_byte(eepContent); Serial.println(value); }
results in
:060000000001FF030405EE
:00000001FF
You can also force the variable to be put in EEPROM regardless of its actual usage in your code (at risk of being wasteful if you forget about it) by using another special attribute, __used__
#include <Arduino.h>
__attribute__((section(".eeprom"), __used__)) uint8_t eepContent[6] = {0,1,0xFF,3,4,5};
void setup() { Serial.begin(9600); }
void loop() { delay(1000); }
will make the data appear in the .eep file as well. This has the same effect as volatile, too, preventing all compiler optimization.
#include <Arduino.h>
volatile __attribute__((section(".eeprom"))) uint8_t eepContent[6] = {0,1,0xFF,3,4,5};
void setup() { Serial.begin(9600); }
void loop() { delay(1000); }
If you go on to naturally use the EEPROM variable you have created, then no such optimization is needed.