AnsweredAssumed Answered

Address of function error

Question asked by Ron Wilson on Aug 4, 2010
Latest reply on Aug 11, 2010 by Daniel Lundin

In the code below, the pointer, p, gets initialized to 0xC3D0, even though the funtion. NvStartAndWait is located at 0xD0C3.

Similarly, it gets compared to 0xD6D0 even though the next function begins at 0xD0D6.


I checked that I am using the correct syntax, so this seems like an error in the compiler.


I am using CodeWarrior 5.9.0 build 2836 for S12XE.


#define FCNBUFLEN 24vuint8 NvWaitBuf[FCNBUFLEN]; // RAM buffer to hold copy of NvStartAndWait()// Start pending FLASH command then wait for completion// Must immediately preceed CopyNvStartAndWait()void NvStartAndWait(void){   FSTAT = CCIF;   while ((FSTAT & CCIF) == 0)   {      (*WDFct)(); // Feed the watch dog while we wait   }}// Copies the start and wait function to RAM// Must immediately follow NvStartAndWait()vuint8 CopyNvStartAndWait(void){   vuint8 i;   vuint8 * p;   for(i = 0, p = (vuint8 *)NvStartAndWait; p < (vuint8 *)CopyApplNvStartAndWait; p++)   {      NvWaitBuf[i] = *p;      i++;      if (i >= FCNBUFLEN)      {         return Failed;      }   }   return Ok;}