Topic : union in EEPROM memory

Forum : ST7/STM8

Original Post
Post Information Post
November 11, 2009 - 4:52pm
Guest

I tried to have a union in the EEPROM memory but Ride7 keeps crashing (during build)
any ideas?

the union was declared as follows:

in data.h file -

union active_chair_data
{
u8 chair_data[40];
struct
{
u16 cycle_on_time;
u16 cycle_off_time;
u16 continuous_time;
u16 reset_position_time;
u16 pause_time;
u16 restart_after_pause_time;
u16 start_after_sitting_time;
u16 pwm_cycle_time;
u16 pwm_on_time;
u16 get_up_time;
u16 spare2;
u16 spare3;
u16 spare4;
u16 spare5;
u16 spare6;
u16 spare7;
u16 spare8;
u16 spare9;
u16 spare10;
u16 spare11;
}par;
};

extern union active_chair_data eeprom chair_eeprom;

and in data.c file-

union active_chair_data eeprom chair_eeprom;

I have another variable declared as this union but it is located in RAM, I believe it should not present a problem.
extern union active_chair_data chair_value; (in h file)
union active_chair_data chair_value; (in c file)

I tried different locations for the eeprom directive (once before and once right after the union (union eeprom active_chair_data chair_eeprom; and eeprom union active_chair_data chair_eeprom;) the compiler crashed.

I need the variables to be in the EEPROM in successive addresses so I can write them using a flash programming at the same time without calling the function many times (40 byte write to flash at one go)

thanks
Igal

Replies
Post Information Post
+1
0
-1
November 12, 2009 - 9:19am
Raisonance Support Team

Hi Igal,

I tried to reproduce the problem without any luck. It definitely works!

First thing : The "eeprom" qualifier should be in front of the declaration i.e. "eeprom union active_chair_data chair_eeprom;"

Second: An EEPROM variable should be initialized (there are some chances that values you put in *are* meaningful)

Third: When you say "Ride keep crashing during build", do you mean that the IDE itself crashes, or just the compiler? Can you try to run the compiler from the command-line and check whether it is ok? If this is not the case, the best would be that you send us a zipped project that shows the problem, along with your versions of Ride and RKit-STM8.

Regards,
Bruno