Atmel CAVR-4 ユーザーズマニュアル
CAVR-4
Part1. Using the compiler
Assembler language interface
97
Note: In this example we use a low optimization level when compiling the code to
show local and global variable access. If a higher level of optimization is used, the
required references to local variables could be removed during the optimization. The
actual function declaration is not changed by the optimization level.
show local and global variable access. If a higher level of optimization is used, the
required references to local variables could be removed during the optimization. The
actual function declaration is not changed by the optimization level.
COMPILING THE CODE
In IAR Embedded Workbench, specify list options on file level. Select the file in the
workspace window. Then choose Project>Options. In the C/C++ Compiler category,
select Override inherited settings. On the List page, deselect Output list file, and
instead select the Output assembler file option and its suboption Include source. Also,
be sure to specify a low level of optimization.
workspace window. Then choose Project>Options. In the C/C++ Compiler category,
select Override inherited settings. On the List page, deselect Output list file, and
instead select the Output assembler file option and its suboption Include source. Also,
be sure to specify a low level of optimization.
Use the following options to compile the skeleton code:
iccavr skeleton -lA .
The
-lA
option creates an assembler language output file including C or C++ source
lines as assembler comments. The
.
(period) specifies that the assembler file should be
named in the same way as the C or C++ module (
skeleton
), but with the filename
extension
s90
. Also remember to specify the memory model you are using as well as a
low level of optimization.
The result is the assembler source output file
skeleton.s90
.
Note: The
-lA
option creates a list file containing call frame information (
CFI)
directives, which can be useful if you intend to study these directives and how they are
used. If you only want to study the calling convention, you can exclude the
used. If you only want to study the calling convention, you can exclude the
CFI
directives from the list file. In IAR Embedded Workbench, select
Project>Options>C/C++ Compiler>List and deselect the suboption Include call
frame information. On the command line, use the option
Project>Options>C/C++ Compiler>List and deselect the suboption Include call
frame information. On the command line, use the option
-lB
instead of
-lA
. Note that
CFI
information must be included in the source code to make the C-SPY Call Stack
window work.
The output file
The output file contains the following important information:
●
The calling convention
●
The return values
●
The global variables
●
The function parameters
●
How to create space on the stack (auto variables)
●
Call frame information (CFI).
The
CFI
directives describe the call frame information needed by the Call Stack window
in the IAR C-SPY™ Debugger.