ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


Is it possible to use long pointer arithmetic with the far memory support in Cx51? I'm using a device has a extended XDATA address space. I know that a far object can only be up to 64KB in size and resides within a 64KB segment, but I need to generic pointer access to the whole memory for FLASH programming. Is this possible directly in C?


Yes. In C51 Version 7 we have introduced long pointer arithmetic on far variables for exactly this purpose. For example,

#include <absacc.h>

bit verify (void)  {
  unsigned long addr;

  for (addr = 0; addr < 0x40000; addr++)  {
    if (FVAR (unsigned char, addr) != FCVAR (unsigned char, addr + 0x10000L))  {
      return (0);

This program compares the XDATA RAM starting at address 0 with the CODE ROM starting at address 0x10000. You may use similar functions to check that the FLASH was programmed correctly.



Article last edited on: 2005-07-18 17:38:07

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential