AnsweredAssumed Answered

Error writing to data EEPROM using @eeprom

Question asked by evenson.bryan on Dec 6, 2013
Latest reply on Dec 9, 2013 by evenson.bryan
I have a STM8S207 board and I'm using STVD version 4.3.3 with the Cosmic compiler.  I am trying to use the @eeprom directive for writing/reading the data EEPROM and my system hangs when I try to write the data.  Here's what I've been trying so far.

#include <string.h>
#include "stm8s.h"
#include "stm8s_flash.h"

@eeprom s16 eeData;
s16 localData;

/* Read the data */
localData = eeData; // Works

/* Write the data, scenario 1 */
eeData = localData;

/* Write the data, scenario 2 */
eecpy(&eeData, &localData, 2);

In both cases, the system hangs on the instruction in which I attempt to write to eeData.  When stopping with the debugger I see that it is stopped inside function c_eewrw (library function?) at the following instruction:

BTJF 0x505f, #2, 0xb155

Is there something else I need to do to get the system ready to write to data EEPROM?