3.3.7.3 How Do I Access C Objects From Assembly Code?
Most C objects are accessible from assembly code. There is a mapping between the symbols used in the C source and those used in the assembly code generated from this source. Your assembly should access the assembly-equivalent symbols which are detailed in 5.12.3.3 Equivalent Assembly Symbols.
Instruct the assembler that the symbol is defined elsewhere by using the
GLOBAL
assembler directive (see 6.1.9.21 Global Directive). This is the assembly
equivalent of a C declaration, although no type information is present. This directive is
not needed and should not be used if the symbol is defined in the same module as your
assembly code.
Any C variable accessed from assembly code will be treated as if it were
qualified volatile
. Specifically specifying the volatile
qualifier in C code is preferred as it makes it clear that external code can access the
object.