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

Address of xdata structure elements are not linked into code structure

I created a structure about data fields, which are located in a structure in xdata area. The informal structure itself should be in code area.

typedef struct
{
  unsigned char  *pucRamAddr;
  eNvmDevice      eDeviceId;    // enum type
  unsigned short  tNvmAddr;
  unsigned short  tLength;
  unsigned char   code *pucRomDefaults;
  char            ucFlags;
} TNvmBlock;

extern const TNvmBlock code tNvmBlock[NVM_BLOCK_COUNT];

Selected model is LARGE. Size of TNvmBlock is usually 11.

So pucRamAddr should point to the element within the xdata structure:

But after linking with BL51 at the pointer entry there is only the Offset within the xdata Structure, the added base address is missing.

I tried to define pucRamAddr as xdata pointer, but then the size of the struct was reduced to 10, although the pucRamAddr were still 2 Byte ???

unsigned char xdata *pucRamAddr;

The pointer target itself were defined like &(tStruct.Element)

Why doesn't the linker fill in the correct xdata address of the Element? And why schrinks the structure size somewhere else when I define the pointer as xdata * ?

Parents
  • With a 16-bit addressable XDATA range, an xdata pointer is expected to be 2 bytes large.
    A generic pointer on the other hand, needs an extra byte just to know what memory type it points to so a generic pointer is larger and slower. This is one of the strange workarounds needed when implementing C in a processor that is C-hostile.

Reply
  • With a 16-bit addressable XDATA range, an xdata pointer is expected to be 2 bytes large.
    A generic pointer on the other hand, needs an extra byte just to know what memory type it points to so a generic pointer is larger and slower. This is one of the strange workarounds needed when implementing C in a processor that is C-hostile.

Children
No data