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

Problem when reading internal flash via pointer, EXTS

I use a XC164CS32F40-Controller and C166 V05.05:

I want to read the data of the internal flash via following code. It works correct until the adress 0xC13518 will be reached.
The Assembler-Cmd "EXTS R5,#1" jumps to Adress 0xC00002A. I checked it via Debugging with ULINK. Normally he jumps to adress 0x00C00178.

This is a reduced routine of a CRC-calculation of the internal flash-memory.

void main ()
{
   unsigned char xhuge* pByte;
   unsigned char u8Val;

   pByte  = (unsigned char xhuge*)0x00000000;

   while (1)
   {
      u8Val = *pByte;
      pByte++;
   }
}

=> in Assembler:

u8Val = *pByte;
   00C0016E D4500200  MOV      R5,[R0+#0x0002]
   00C00172 A840      MOV      R4,[R0]
   00C00174 DC05      EXTS     R5,#1
   00C00176 A984      MOVB     RL4,[R4]
   00C00178 E4800400  MOVB     [R0+#0x0004],RL4