Hello!
A function here starts like this:
uchar uc_Check_Limits(uchar pdata *ptr_Set,struct st_Limit code *ptr_Limit)small reentrant { union INT_CHAR data Value; uint uiLimit; // typ of limit EA=0; Value.byte[0]=*ptr_Set; ptr_Set++; Value.byte[1]=*ptr_Set; EA=1; ...}
The union is defined as:
union INT_CHAR // Union zur Konvertierung { Uint16 word ; // von char zu int und umgekehrt signed int sword ; Uchar byte[2]; signed char sbyte[2] ; };
I'm using Hitop debugging software. If I add Value to the watch list, Hitop says Value is on memory I:0xF0. So Value.byte[0] should be on I:0xF0 and Value.byte[1] should be on I:0xF1. But the compiler generated code copies the first byte of ptr_Set target to I:0xEF and the second value to I:0xF0. If I manually edit Value.byte[0] in Hitop, it is written to I:0xF0 and if I edit Value.byte[1], it is written to I:0xEF. I can verify that in the RAM viewer starting at I:0xEF. It looks like the bytes are accessed in reversed order here. What is wrong here? I can not see there's something special about the used memspace.
Thanks in advance for any clue.
Uhm, the variable Value is normally not declared in data. This is just because I tried something. In both ways, the compiler uses the same memory address and space.
I found out that the code seems to work anyway. So it may be a wrong interpretation of Hitop.
So I can not do anything about it. The topic can not be solved with further means. But as long as the code works, it is acceptable.
Sorry for the useless posting.
Hitop says Value is on memory I:0xF0 ... you are (very close to being) in stack trouble.
Erik