Keil Logo

C166: Incrementing Huge Pointer Only Changes Lower 16-bits


Information in this article applies to:

  • C166 All Versions

SYMPTOMS

I am trying to compute the CRC of a 96Kb area in flash memory. Doing this involves incrementing a pointer which is passed as a function argument, defined as

crc_16h(unsigned char huge* p, len);

The C166 compiler increments only the lower 16 bits of the pointer p, which gives the wrong result. Is this fixed in a later version?

CAUSE

The huge memory type only supports 16-bit address calculation. This means that only the lower 16-bits of a pointer may be used to calculate addresses. The result is that the huge memory type can only access objects up to 64Kb in size.

RESOLUTION

Change your pointer to the xhuge memory type. xhuge supports full 32-bit address calculation and can access objects with 'unlimited' size.

MORE INFORMATION


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.