Keil Logo

HPTR Compiler Directive

Abbreviation

None.

Arguments

None.

Default

In the memory models SMALL, XSMALL, and LARGE the default memory space is far.

µVision

Options — Target — Treat far pointers as huge pointer.

Description

When HPTR is used the default memory space in the memory models SMALL, XSMALL, and LARGE is huge instead of far. This also implies that all pointer definitions are huge pointers when no explicit memory type is used.

See Also

LARGE, SMALL, XSMALL

Example
C251 SAMPLE.C XSMALL HPTR
#pragma small HPTR

The following example:

stmt  level    source

   1           unsigned int *ptr;
   2           unsigned int i, j;
   3
   4           void test (void)  {
   5    1        i = ptr[j];
   6    1      }

demonstrates code generated with and without the HPTR directive.

Code Generated without HPTR:

                 ; SOURCE LINE # 5
000000 7E1500    MOV   WR2,j
000003 3E14      SLL   WR2
000005 7E1D00    MOV   DR4,ptr
000008 2D31      ADD   WR6,WR2
00000A 0B1A30    MOV   WR6,@DR4
00000D 7A3500    MOV   i,WR6
                 ; SOURCE LINE # 6
000010 22        RET

Code Generated with HPTR:

                 ; SOURCE LINE # 5
000000 7E3500    MOV   WR6,j
000003 6D22      XRL   WR4,WR4
000005 7F01      MOV   DR0,DR4
000007 2F00      ADD   DR0,DR0
000009 7E1D00    MOV   DR4,ptr
00000C 2F10      ADD   DR4,DR0
00000E 0B1A30    MOV   WR6,@DR4
000011 7A3500    MOV   i,WR6
                 ; SOURCE LINE # 6
000014 22        RET
  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.