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

AARM and offset calculation

A simple code example:

AREA    SOME_DATA, DATA, READWRITE, ALIGN=2
RSEG    SOME_DATA

MY_DATA:
FIRST_VAR  EQU   $ - MY_DATA
           DSD   1
SECOND_VAR EQU   $ - MY_DATA
           DSD   1

AREA    SOME_CODE, CODE, READONLY, ALIGN=2
RSEG    SOME_CODE

FUNCTION   PROC  CODE32
           LDR   R2,=MY_DATA
           LDR   R0,[R2,#FIRST_VAR]
           LDR   R1,[R2,#SECOND_VAR]
           BX    LR
           ENDP

           END

I would expect SECOND_VAR to have a value of 4, but it gets the value 0. As a matter of fact, the assembler seems to give the expression '$ - label' always the value 0. There is no more documentation for the $ character than that it is listed, but I assume it is the location counter like in Keil A166. Other assemblers use dot as the location counter, but '. - label' gives the same result (no error).

Any comments?

Sauli

0