已解决! 转到解答。
Thank you for your help. Adding the lines ENTRIES EEPROM_DATA END to the the end of the linker file solved the problem. It now programs the eeprom with the default values.
"#pragma CONST_SEG" applies to constants only, so make the array constant or use #pragma DATA_SEG".
#pragma CONST_SEG EEPROM_DATA
const uint8_t Defaults[16] = {24,24,24,24,24,0,10,5,27,30,5,0,0,0,0,0};
#pragma CONST_SEG DEFAULT
Also in the prm, READ_WRITE segments are initialized during startup, so it should be used for RAM only. For flash or eeprom use READ_ONLY instead, that means that the content gets stored in there during programming time.
EEPROM = READ_ONLY 0x1780 TO 0x17FF;
Daniel
Your setup is correct, it works here, if copied to one of my test project. It generates following line into S19 file:
S11317801818181818000A051B1E05000000000090
Since my code does not use EEPROM_DATA, I just needed to assure the linker includes that object into the final binary:
ENTRIES EEPROM_DATAEND
which I don't think would be an issue with your setup. Just in case.
Pavel
Thank you for your help. Adding the lines ENTRIES EEPROM_DATA END to the the end of the linker file solved the problem. It now programs the eeprom with the default values.