AnsweredAssumed Answered

Global constant in GNU AS

Question asked by Ian Benton on Mar 21, 2019
Latest reply on Apr 30, 2019 by Ian Benton

I have an assembler program consisting of several partial programs.

I know that labels have to be declared as "global" so that other partial programs can see them:

label: LDR R0,[R1]

can only be seen by the same partial program


.global label

label: LDR R0,[R1] 

can be seen by all the partial programs.


I can't seem to get the same thing to work for constants:

.equ v_charge,2400

sets the constant v_charge to 2400.

If I put it in its own file and .include the file in all the partial programs that need it, then it works, but as a line of code in a partial program it is only available to its local program

I would expect that .global v_charge would make it available to the other partial programs, but it doesn't.


What is the correct syntax?