📄 tutor.lst
字号:
##############################################################################
# #
# 12/Oct/2006 10:58:07 #
# IAR Atmel AVR C/C++ Compiler V4.20A/W32, KickStart Version #
# Copyright 1996-2006 IAR Systems. All rights reserved. #
# #
# Source file = D:\IAR Systems\Embedded Workbench 4.0 #
# KickStart\avr\tutor\Tutor.c #
# Command line = "D:\IAR Systems\Embedded Workbench 4.0 #
# KickStart\avr\tutor\Tutor.c" -v0 -mt -o #
# "F:\zln\AVR与PROTEUS\IAR AVR应用程序\Debug\Obj\" -lCN #
# "F:\zln\AVR与PROTEUS\IAR AVR应用程序\Debug\List\" #
# --initializers_in_flash -z2 --no_cse --no_inline #
# --no_code_motion --no_cross_call --no_clustering #
# --no_tbaa --debug -e -I "D:\IAR Systems\Embedded #
# Workbench 4.0 KickStart\avr\INC\" -I "D:\IAR #
# Systems\Embedded Workbench 4.0 KickStart\avr\INC\CLIB\" #
# List file = F:\zln\AVR与PROTEUS\IAR AVR应用程序\Debug\List\Tutor.ls #
# t #
# Object file = F:\zln\AVR与PROTEUS\IAR AVR应用程序\Debug\Obj\Tutor.r90 #
# #
# #
##############################################################################
D:\IAR Systems\Embedded Workbench 4.0 KickStart\avr\tutor\Tutor.c
1 /**************************************************
2 *
3 * IAR EMBEDDED WORKBENCH TUTORIAL
4 * C tutorial. Print the Fibonacci numbers.
5 *
6 * Copyright 1996 - 2003 IAR Systems. All rights reserved.
7 *
8 * $Revision: 1.3 $
9 *
10 **************************************************/
11
12
13 #include "Tutor.h"
14
15
16 /* Global call counter */
\ In segment TINY_Z, align 1, keep-with-next
\ 00000000 REQUIRE `?<Segment init: TINY_Z>`
17 int call_count;
\ call_count:
\ 00000000 DS 2
18
19 /*
20 Increase the 'call_count' variable by one.
21 */
\ In segment CODE, align 2, keep-with-next
22 void next_counter(void)
\ next_counter:
23 {
24 call_count += 1; /* from d_f_p */
\ 00000000 .... LDI R30, call_count
\ 00000002 8100 LD R16, Z
\ 00000004 8111 LDD R17, Z+1
\ 00000006 5F0F SUBI R16, 255
\ 00000008 4F1F SBCI R17, 255
\ 0000000A 8300 ST Z, R16
\ 0000000C 8311 STD Z+1, R17
25 }
\ 0000000E 9508 RET
26
27 /*
28 Increase the 'call_count' variable.
29 Get and print the associated Fibonacci number.
30 */
\ In segment CODE, align 2, keep-with-next
31 void do_foreground_process(void)
\ do_foreground_process:
32 {
\ 00000000 .... RCALL ?PROLOGUE2_L09
33 unsigned int fib;
34 next_counter();
\ 00000002 .... RCALL next_counter
35 fib = get_fib( call_count );
\ 00000004 .... LDI R30, call_count
\ 00000006 8100 LD R16, Z
\ 00000008 8111 LDD R17, Z+1
\ 0000000A .... RCALL get_fib
\ 0000000C 2F80 MOV R24, R16
\ 0000000E 2F91 MOV R25, R17
36 put_fib( fib );
\ 00000010 2F08 MOV R16, R24
\ 00000012 2F19 MOV R17, R25
\ 00000014 .... RCALL put_fib
37 }
\ 00000016 E0E2 LDI R30, 2
\ 00000018 .... RJMP ?EPILOGUE_B2_L09
38
39 /*
40 Main program.
41 Prints the Fibonacci numbers.
42 */
\ In segment CODE, align 2, keep-with-next
43 void main(void)
\ main:
44 {
\ 00000000 .... RCALL ?PROLOGUE2_L09
45 call_count = 0;
\ 00000002 E000 LDI R16, 0
\ 00000004 E010 LDI R17, 0
\ 00000006 .... LDI R30, call_count
\ 00000008 8300 ST Z, R16
\ 0000000A 8311 STD Z+1, R17
46 init_fib();
\ 0000000C .... RCALL init_fib
47 while ( call_count < MAX_FIB )
\ ??main_0:
\ 0000000E .... LDI R30, call_count
\ 00000010 8180 LD R24, Z
\ 00000012 8191 LDD R25, Z+1
\ 00000014 308A CPI R24, 10
\ 00000016 4090 SBCI R25, 0
\ 00000018 F414 BRGE ??main_1
48 do_foreground_process();
\ 0000001A .... RCALL do_foreground_process
\ 0000001C CFF8 RJMP ??main_0
49 }
\ ??main_1:
\ 0000001E E0E2 LDI R30, 2
\ 00000020 .... RJMP ?EPILOGUE_B2_L09
Maximum stack usage in bytes:
Function CSTACK RSTACK
-------- ------ ------
do_foreground_process 2 2
-> next_counter 2 2
-> get_fib 2 2
-> put_fib 2 2
main 2 2
-> init_fib 2 2
-> do_foreground_process 2 2
next_counter 0 2
Segment part sizes:
Function/Label Bytes
-------------- -----
call_count 2
next_counter 16
do_foreground_process 26
main 34
Others 4
76 bytes in segment CODE
4 bytes in segment INITTAB
2 bytes in segment TINY_Z
76 bytes of CODE memory (+ 4 bytes shared)
2 bytes of DATA memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -