📄 serial.lst
字号:
##############################################################################
# #
# IAR Atmel AVR C/C++ Compiler V4.11A/W32 17/Jan/2006 19:30:54 #
# Copyright 1996-2005 IAR Systems. All rights reserved. #
# #
# Source file = C:\Documents and Settings\andeaper\My #
# Documents\QVCS\Appnotes\AVR109 Self Programming\Source #
# Code\IAR\ATmega2560\serial.c #
# Command line = "C:\Documents and Settings\andeaper\My #
# Documents\QVCS\Appnotes\AVR109 Self Programming\Source #
# Code\IAR\ATmega2560\serial.c" --cpu=m2560 -ms -o #
# "C:\Documents and Settings\andeaper\My #
# Documents\QVCS\Appnotes\AVR109 Self Programming\Source #
# Code\IAR\ATmega2560\Debug\Obj\" -lCN "C:\Documents and #
# Settings\andeaper\My Documents\QVCS\Appnotes\AVR109 #
# Self Programming\Source Code\IAR\ATmega2560\Debug\List\ #
# " -y --initializers_in_flash -z2 --no_cse --no_inline #
# --no_code_motion --no_cross_call --no_clustering #
# --no_tbaa --cross_call_passes=4 --debug #
# -DENABLE_BIT_DEFINITIONS --do_cross_call -e -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0\avr\INC\" -I "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0\avr\INC\CLIB\" #
# --eeprom_size 4096 #
# List file = C:\Documents and Settings\andeaper\My #
# Documents\QVCS\Appnotes\AVR109 Self Programming\Source #
# Code\IAR\ATmega2560\Debug\List\serial.lst #
# Object file = C:\Documents and Settings\andeaper\My #
# Documents\QVCS\Appnotes\AVR109 Self Programming\Source #
# Code\IAR\ATmega2560\Debug\Obj\serial.r90 #
# #
# #
##############################################################################
C:\Documents and Settings\andeaper\My Documents\QVCS\Appnotes\AVR109 Self Programming\Source Code\IAR\ATmega2560\serial.c
1 /*****************************************************************************
2 *
3 * Atmel Corporation
4 *
5 * File : serial.c
6 * Compiler : IAR C 3.10C Kickstart
7 * Revision : $Revision: 2.0 $
8 * Date : $Date: Tuesday, November 29, $
9 * Updated by : $Author: raapeland $
10 *
11 * Support mail : avr@atmel.com
12 *
13 * Target platform : All AVRs with bootloader support
14 *
15 * AppNote : AVR109 - Self-programming
16 *
17 * Description : UART communication routines
18 ****************************************************************************/
19 #include "defines.h"
\ In segment ABSOLUTE, at 0xc6
\ union <unnamed> volatile __io _A_UDR0
\ _A_UDR0:
\ 00000000 DS 1
\ In segment ABSOLUTE, at 0xc4
\ union <unnamed> volatile __io _A_UBRR0
\ _A_UBRR0:
\ 00000000 DS 2
\ In segment ABSOLUTE, at 0xc1
\ union <unnamed> volatile __io _A_UCSR0B
\ _A_UCSR0B:
\ 00000000 DS 1
\ In segment ABSOLUTE, at 0xc0
\ union <unnamed> volatile __io _A_UCSR0A
\ _A_UCSR0A:
\ 00000000 DS 1
20
21
\ In segment FARCODE, align 2, keep-with-next
22 void initbootuart()
\ initbootuart:
23 {
24 BAUD_RATE_LOW_REG = BRREG_VALUE;
\ 00000000 E001 LDI R16, 1
\ 00000002 930000C4 STS 196, R16
25 UART_CONTROL_REG = (1 << ENABLE_RECEIVER_BIT) |
26 (1 << ENABLE_TRANSMITTER_BIT); // enable receive and transmit
\ 00000006 E108 LDI R16, 24
\ 00000008 930000C1 STS 193, R16
27 }
\ 0000000C 9508 RET
28
29
\ In segment FARCODE, align 2, keep-with-next
30 void sendchar(char c)
\ sendchar:
31 {
32 UART_DATA_REG = c; // prepare transmission
\ 00000000 930000C6 STS 198, R16
33 while (!(UART_STATUS_REG & (1 << TRANSMIT_COMPLETE_BIT)));// wait until byte sendt
\ ??sendchar_0:
\ 00000004 911000C0 LDS R17, 192
\ 00000008 2F21 MOV R18, R17
\ 0000000A FF26 SBRS R18, 6
\ 0000000C CFFB RJMP ??sendchar_0
34 UART_STATUS_REG |= (1 << TRANSMIT_COMPLETE_BIT); // delete TXCflag
\ 0000000E 911000C0 LDS R17, 192
\ 00000012 6410 ORI R17, 0x40
\ 00000014 931000C0 STS 192, R17
35 }
\ 00000018 9508 RET
36
37
\ In segment FARCODE, align 2, keep-with-next
38 char recchar(void)
\ recchar:
\ ??recchar_0:
39 {
40 while(!(UART_STATUS_REG & (1 << RECEIVE_COMPLETE_BIT))); // wait for data
\ 00000000 910000C0 LDS R16, 192
\ 00000004 2F10 MOV R17, R16
\ 00000006 FF17 SBRS R17, 7
\ 00000008 CFFB RJMP ??recchar_0
41 return UART_DATA_REG;
\ 0000000A 910000C6 LDS R16, 198
\ 0000000E 9508 RET
42 }
Maximum stack usage in bytes:
Function CSTACK RSTACK
-------- ------ ------
initbootuart 0 3
recchar 0 3
sendchar 0 3
Segment part sizes:
Function/Label Bytes
-------------- -----
_A_UDR0 1
_A_UBRR0 2
_A_UCSR0B 1
_A_UCSR0A 1
initbootuart 14
sendchar 26
??recchar_0 16
5 bytes in segment ABSOLUTE
56 bytes in segment FARCODE
56 bytes of CODE memory
0 bytes of DATA memory (+ 5 bytes shared)
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -