Справочник Пользователя для Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1

Модели
SW006021-1
Скачать
Страница из 518
How To’s
 2012 Microchip Technology Inc.
DS52053B-page 65
The list of functions, memory location and size is available in a file called funclist. 
Each function will have a line similar to the following.
_main: CODE, 2012 0 30 
This indicates that generated assembly code associated with the function, main, was 
placed in the CODE linker class (see Section 6.4.9.3.3 “Class”), was located at 
address 2012 (decimal) in address space number 0 (see Section 6.4.9.3.13 “Space”), 
and was 30 (again decimal) words/bytes long. An introduction to psects is given in 
Section 5.15.1 “Program Sections”.
3.6.14
How Do I Know What Resources Are Being Used by Each 
Function?
In the assembly list file there is information printed for every C function, including library 
functions, see Section 6.6 “Assembly List Files”. This information indicates what 
registers the function used, what functions it calls (this is also found in the call graph, 
see Section 6.6.6 “Call Graph”), and how many bytes of data memory it requires. 
Note that auto, parameter and temporary variables used by a function may overlap with 
those from other functions as these are placed in a compiled stack by the compiler, see 
Section 5.5.2.2.1 “Compiled Stack Operation”.
3.6.15
How Do I Find Out Where Variables and Functions Have Been 
Positioned?
You can determine where variables and functions have been positioned from either the 
assembly list file, see Section 6.6 “Assembly List Files”, or the map file, see 
Section 7.4 “Map Files”. Only global symbols are shown in the map file; all symbols 
(including locals) are listed in the assembly list file, but only for the code represented 
by that list file. (Each assembly module has its own list file.)
There is a mapping between C identifiers and the symbols used in assembly code, 
which are the symbols shown in both of these files, see Section 5.12.3.1 “Equivalent 
Assembly Symbols”
. The symbol associated with a variable is assigned the address 
of the lowest byte of the variable; for functions it is the address of the first instruction 
generated for that function.
3.6.16
Why are some objects positioned into memory that I reserved?
The memory reservation options, see Section 3.4.3.4 “How Do I Stop the Compiler 
Using Certain Memory Locations?”
 wil
l adjust the range of addresses associated 
with classes used by the linker. Most variables and function are placed into psects, see 
Section 5.15.1 “Program Sections”, that are linked anywhere inside these class 
ranges and so are affected by these reservation options.
Some psects are explicitly placed at an address rather than being linked anywhere in 
an address range, e.g., the psect that holds the code to be executed at Reset is always 
linked to address 0 because that is where the Reset location is defined to be for 8-bit 
devices. Such a psect will not be affected by the --ROM option, even if you use it to 
reserve memory address 0. Psects that hold code associated with Reset and interrupts 
can be shifted using the --CODEOFFSET option, see Section 4.8.22 “--CODEOFF-
SET: Offset Program Code to Address”
.
Check the assembly list file, see Section 6.6 “Assembly List Files”, to determine the 
names of psects that hold objects and code. Check the linker options in the map file, 
seSection 7.4 “Map Files”, to see if psects have been linked explicitly or if they are 
linked anywhere in a class. See also, the linker options -p (Section 7.2.19 “-Pspec”
and -A (Section 7.2.1 “-Aclass =low-high,...”).