Scope - Epson S5U1C17001C Manual

Cmos 16-bit single chip microcontroller (c compiler package for s1c17 family) (ver. 3.2)
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

6.4 Scope

Symbols defined in each source file can freely be referred to within that file. Such reference range of symbols is termed scope.
Usually, reference can be made only within a defined file. If a symbol that does not exist in that file is referenced, the as assembler
creates the object file assuming that the symbol is an undefined symbol, leaving the problem to be solved by the ld linker.
If your development project requires the use of multiple source files, it is necessary for the scope to be extended to cover other
source files. The as assembler has the pseudo-instructions that can be used for this purpose.
Symbols that can be referenced in only the file where they are defined are called "local symbols". Symbols that are declared to be
global are called "global symbols". Local symbols – even when symbols of the same name are specified in two or more different
files – are handled as different symbols. Global symbols – if defined as overlapping in multiple files – cause a warning to be
generated in the ld linker.
Example:
file1: file in which global symbol is defined
.global SYMBOL
.global VAR1
SYMBOL:
LABEL:
.section .bss
.align
VAR1:
.zero
file2: file in which a global symbol is referred
xcall SYMBOL
xld.a %r1,VAR1
LABEL:
The as assembler regards the symbols SYMBOL and VAR1 in the file2 as those of undefined addresses in the assembling, and
includes that information in the object file it delivers. Those addresses are finally determined by the processing of the ld linker.
S5U1C17001C Manual
(Rev. 1.0)
...Global declaration of symbols that are to be defined in this file.
:
:
...Local symbol
:
(Can be referred to only in this file)
2
4
...Symbol externally referred
:
...Symbol externally referred
...Local symbol
:
(Treated as a different symbol from LABEL of file1)
Seiko Epson Corporation
6 Assembler
6-4

Advertisement

Table of Contents
loading

Table of Contents