Hi,
It's first time I contact S08AW32 w/ codewarrior 10.6. The development tool is Multilink Universal. I create several files and many function calls.
In file Main.c:
void main(void)
{
Record_AddUser();
}
In file Record.c:
typedef struct {
byte Template[498];
// other members
} tUserData;
void Record_AddUser(void)
{
tUserData sUserData;
// do something...
GetTemplate(gbyTemplate);
memcpy(sUserData.Template, gbyTemplate, 498); // <------ overlapping !!!!
}
In file FP.c: (provided by h/w module vendor)
byte gbyTemplate[498]; // global variable
void GetTemplate(byte* pBuf)
{
byte Buf[498];
// do somethins to get Template, and put it into Buf.
memcpy(pBuf, Buf, 498);
}
After calling function GetTemplate(gbyTemplate), value of many other variables are changed. And then, I find something wrong. The structure sUserData is allocated at 0x0133, and gbyTemplate is allocated at 0x00A5. Can anyone help? Thank you!!