This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SMALL memory model, compiler error?

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.