Wrong overlapping variables in RAM (CW HC08)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Wrong overlapping variables in RAM (CW HC08)

跳至解决方案
2,927 次查看
elil
Contributor I
Hi,

Recently I found that HC08 C Compiler ovelapped a local automatic variable with a global one, causing the destroy of the global var. In order to prevent it I tried to define the local variable as static and the problem was solved. Another solution was to disable some Optimizer options.
The var. definitions were:
unsigned char *Tx_ptr; // the global var.

typedef union
{
unsigned long l;
unsigned char arr[4];
}adress_format;

adress_format adress; // the local automatic var.
// The adress var. is overlapping *Tx_ptr.

The solution, I found, does not satisfy me, since I haven't found the reason for the problem and the similar problem may be exist in an other place of my code, and I don't want to define all of my local variables as static (it is not economic!).
Any idea is wellcome.

Thank you in advance,
Eli.
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,096 次查看
CrasyCat
Specialist III
Hello

This should be a corner situation of an configuration issue.
Please submit a service request through our on-line support site to get our
support people take a look at that.

CrasyCat

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,097 次查看
CrasyCat
Specialist III
Hello

This should be a corner situation of an configuration issue.
Please submit a service request through our on-line support site to get our
support people take a look at that.

CrasyCat
0 项奖励
回复
1,096 次查看
CompilerGuru
NXP Employee
NXP Employee
This is either a compiler bug, then use CrazyCats suggestion and file a service request or this is a simple stack overflow. If so, increase the stack size.

Daniel