initializing protected variables

Hello, I’m a new rabbit user and trying to tackle all the goodies but I’ve hit a brick wall. I’ve spent hours trying different things and googling to no avail.

I’m using the Rabbit 4200 and want to store data in the serial Flash.
It’s critical to not lose the data I’m buffering to fill to up a page of flash memory.

void StoreData(char * data, int bytes_to_save)
/* Stores the data in a static non-volatile memory space. */
{
protected  static char buffer[1056]; // Size of a single block of Flash memory
protected  static int  offset; // the last position used in the buffer
  int i;

  segchain sysResetChain {
  offset = 0;
 }
... code to fill up buffer, when full, save to SFlash and reset offset
}

I need to initialize the offset to zero once and then when the rabbit gets turned off and back on, I want to recover the offset and the buffer.

When I compile in DC 10.21, I get this compile message:

line    1 : ERROR DKENTRY.LIB   : sysResetChain previously defined.     
line    1 : ERROR DKENTRY.LIB   : Redefining already defined global symbol sysResetChain

It doesn’t look like I should play around in DKENTRY.LIB. I’ve followed the documentation, but I just can’t grasp what I’m doing wrong.

Can anyone help me? Thank you!

I think I answered my own question.

When snooping through the sys.lib, where the sysResetChain function is, it makes the function chain with an underscore before the name. So by changing my code to include the underscore, there is no compile error. I still have to test it all, but I have feeling that’s it.

void StoreData(char * data, int bytes_to_save)
/* Stores the data in a static non-volatile memory space. */
{
protected  static char buffer[1056]; // Size of a single block of Flash memory
protected  static int  offset; // the last position used in the buffer
  int i;

  segchain _sysResetChain {
  offset = 0;
 }
... code to fill up buffer, when full, save to SFlash and reset offset
}