EEPROM Object placement vs. declaration order
XC8 UG, 50002737C-page 102: 22.214.171.124 EEPROM Variables
I declared three initialised "__eeprom" objects. The first two are structures, the final one is a byte array.
I thought the EEPROM layout would reflect declaration sequence (OBJECT_1,OBJECT_2,OBJECT_3). In fact, I see from the EEPROM view that the placement has (for some reason) been chosen by the compiler (or is that linker..?) as (OBJECT_2,OBJECT_3,OBJECT_1).
__eeprom TpwmCfg gPwm0Defaults[N_CONFIGS] =
__eeprom TpwmCfg gPwm1Defaults[N_CONFIGS] =
__eeprom uint8_t gPresetClockIdxs[N_CONFIGS] =
_gPwm1Defaults idataEEDATA 00000
_gPresetClockIdxs idataEEDATA 0002C
_gPwm0Defaults idataEEDATA 00030
The initialised structs and the byte array hold preset values which the user can recall & modify if desired.
I need to know the sequencing for subsequent reads (& occasional updates) "in the field".
Would it be best to amalgmate all objects into one structure? Also, do I have to worry about alignment, packing etc?
PS What does the forum option "Toggle Reward Point Option" do?
post edited by sjb741 - 2020/06/17 08:16:26