AnsweredAssumed Answered

Compiler error: Pointer to a __far location

Question asked by Sandeep Parvatikar on Dec 16, 2010
Latest reply on Dec 16, 2010 by Sandeep Parvatikar

Hi,

 

I have written a small piece of code to copy the contents of paged flash memory into Ram.

 

const __far MemSegTable BL_AddressTable =
{
     { 0x00005000uL, 0x00006BFFuL },
     { 0x0000C000uL, 0x0000CFFFuL },
     { 0x00E08000uL, 0x00E0BFFFuL },
     { 0x00E18000uL, 0x00E1BFFFuL },
     { 0x00E28000uL, 0x00E2BFFFuL },
     { 0x00E38000uL, 0x00E3BFFFuL }
};

const __far uint32 BL_PtrToArray[6] =
{
    0xD18000,   /* Address of BL_Array_D1 */
    0xD28000,   /* Address of BL_Array_D2 */
    0xD38000,   /* Address of BL_Array_D3 */
    0xD48000,   /* Address of BL_Array_D4 */
    0xD58000,   /* Address of BL_Array_D5 */
    0xD68000    /* Address of BL_Array_D6 */
};

 

function( )

{

             flashAddress_t                 StartAddress;
             flashMemoryLength_t     PageLength;
             uint32                                 count;
             uint8 const __far *           pBootloaderArray;
             uint8 *                                 pRAMBuffer;

                         StartAddress          =  BL_AddressTable[NumOfBlks][0];
                         PageLength           =  ( BL_AddressTable[NumOfBlks][1] - BL_AddressTable[NumOfBlks][0] + 1 );
                         pBootloaderArray  =  ( uint8 const __far * )((const __far uint32)BL_PtrToArray[NumOfBlks]);
                         pRAMBuffer            =  RAMBuffer;
                         count                       =  0x100;
                         

                         while (count)
                         {
                                         (  * ( ( uint8 * ) pRAMBuffer ) )  =  (  * (  ( uint8 const __far *  ) ( pBootloaderArray ) ) );
                                         ( ( uint8 const __far *) ( pBootloaderArray ) )++;
                                         ( ( uint8 * ) pRAMBuffer )++;
                                         count--;
                         }

 

return();

}


I am getting the following error:

 C1069: Wrong use of far/near/rom/uni/paged in local scope

 

Can anybody help me?

Outcomes