📄 download.s79
字号:
//////////////////////////////////////////////////////////////////////////////
// /
// IAR ARM ANSI C/C++ Compiler V4.40A/W32 17/Jan/2007 16:16:26 /
// Copyright 1999-2005 IAR Systems. All rights reserved. /
// /
// Cpu mode = arm /
// Endian = little /
// Stack alignment = 4 /
// Source file = D:\lilian\STR71X\application note\IAP using /
// UART\an2078_IAR(forum)\an2078\IAP_V2.0\common\downl /
// oad.c /
// Command line = "D:\lilian\STR71X\application note\IAP using /
// UART\an2078_IAR(forum)\an2078\IAP_V2.0\common\downl /
// oad.c" -lC "D:\lilian\STR71X\application note\IAP /
// using UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\D /
// ebug\List\" -lA "D:\lilian\STR71X\application /
// note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2 /
// .0\user\Debug\List\" -o "D:\lilian\STR71X\applicati /
// on note\IAP using UART\an2078_IAR(forum)\an2078\IAP /
// _V2.0\user\Debug\Obj\" -z2 --no_cse --no_unroll /
// --no_inline --no_code_motion --no_tbaa /
// --no_clustering --no_scheduling --debug --cpu_mode /
// arm --endian little --cpu ARM7TDMI --stack_align 4 /
// -e --fpu None --dlib_config "C:\Program Files\IAR /
// Systems\Embedded Workbench /
// 4.0\arm\LIB\dl4tpannl8n.h" --segment /
// code=CODE_Flash -I "D:\lilian\STR71X\application /
// note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2 /
// .0\user\..\include\" -I "D:\lilian\STR71X\applicati /
// on note\IAP using UART\an2078_IAR(forum)\an2078\IAP /
// _V2.0\user\..\common\" -I "C:\Program Files\IAR /
// Systems\Embedded Workbench 4.0\arm\INC\" /
// List file = D:\lilian\STR71X\application note\IAP using /
// UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\Debug\L /
// ist\download.s79 /
// /
// /
//////////////////////////////////////////////////////////////////////////////
NAME download
RTMODEL "StackAlign4", "USED"
RTMODEL "__cpu_mode", "__pcs__arm"
RTMODEL "__data_model", "absolute"
RTMODEL "__dlib_file_descriptor", "0"
RTMODEL "__endian", "little"
RTMODEL "__rt_version", "6"
RSEG CSTACK:DATA:NOROOT(2)
MULTWEAK ??Int2Str??rA
MULTWEAK ??SerialPutString??rA
MULTWEAK ??Ymodem_Receive??rA
PUBLIC SerialDownload
FUNCTION SerialDownload,0203H
LOCFRAME CSTACK, 24, STACK
CFI Names cfiNames0
CFI StackFrame CFA R13 HUGEDATA
CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, CPSR:32, R13:32
CFI Resource R14:32, SPSR:32
CFI VirtualResource ?RET:32
CFI EndNames cfiNames0
CFI Common cfiCommon0 Using cfiNames0
CFI CodeAlign 4
CFI DataAlign 4
CFI ReturnAddress ?RET CODE
CFI CFA R13+0
CFI R0 Undefined
CFI R1 Undefined
CFI R2 Undefined
CFI R3 Undefined
CFI R4 SameValue
CFI R5 SameValue
CFI R6 SameValue
CFI R7 SameValue
CFI R8 SameValue
CFI R9 SameValue
CFI R10 SameValue
CFI R11 SameValue
CFI R12 Undefined
CFI CPSR SameValue
CFI R14 Undefined
CFI SPSR SameValue
CFI ?RET R14
CFI EndCommon cfiCommon0
Int2Str SYMBOL "Int2Str"
SerialPutString SYMBOL "SerialPutString"
Ymodem_Receive SYMBOL "Ymodem_Receive"
??Int2Str??rA SYMBOL "??rA", Int2Str
??SerialPutString??rA SYMBOL "??rA", SerialPutString
??Ymodem_Receive??rA SYMBOL "??rA", Ymodem_Receive
EXTERN Int2Str
FUNCTION Int2Str,0202H
EXTERN SerialPutString
FUNCTION SerialPutString,0202H
EXTERN Ymodem_Receive
FUNCTION Ymodem_Receive,0202H
EXTERN file_name
EXTERN gimagesize
// D:\lilian\STR71X\application note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2.0\common\download.c
// 1 /******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
// 2 * File Name : download.c
// 3 * Author : MCD Application Team
// 4 * Date First Issued : 10/25/2004
// 5 * Description : This file provides the software which allows to download
// 6 * an image to internal Flash.
// 7 ********************************************************************************
// 8 * History:
// 9 * 02/01/2006 : IAP Version 2.0
// 10 * 11/24/2004 : IAP Version 1.0
// 11 ********************************************************************************
// 12 THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
// 13 CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A
// 14 RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
// 15 CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH
// 16 SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN
// 17 IN CONNECTION WITH THEIR PRODUCTS.
// 18 ********************************************************************************/
// 19
// 20 #include "common.h"
// 21
// 22 extern char file_name[FILE_NAME_LENGTH];
// 23 /*******************************************************************************
// 24 * Function Name : SerialDownload
// 25 * Description : Download a file via serial port
// 26 * Input : None
// 27 * Return : None
// 28 *******************************************************************************/
RSEG CODE_Flash:CODE:NOROOT(2)
CFI Block cfiBlock0 Using cfiCommon0
CFI Function SerialDownload
ARM
// 29 void SerialDownload (void)
// 30 {
SerialDownload:
PUSH {R4,R5,LR}
CFI ?RET Frame(CFA, -4)
CFI R5 Frame(CFA, -8)
CFI R4 Frame(CFA, -12)
CFI CFA R13+12
SUB SP,SP,#+12
CFI CFA R13+24
// 31 char Number[10];
// 32 s32 Size, DownloadAddr = 0x20002000;
MOV R0,#+536870912
ORR R0,R0,#0x2000
MOVS R5,R0
// 33 SerialPutString("Waiting for the file to be sent ... (press 'a' to abort)\n\r");
LDR R0,??SerialDownload_0 ;; `?<Constant "Waiting for the file ...">`
_BLF SerialPutString,??SerialPutString??rA
// 34 Size = Ymodem_Receive((char *)DownloadAddr);
MOVS R0,R5
_BLF Ymodem_Receive,??Ymodem_Receive??rA
MOVS R4,R0
// 35 if (Size > 0)
CMP R4,#+1
BLT ??SerialDownload_1
// 36 {
// 37 SerialPutString("\n\n\rTransfer Completed Successfully!\n\r--------------------------------\r\n Name: ");
LDR R0,??SerialDownload_0+0x4 ;; `?<Constant "\\n\\n\\rTransfer Completed...">`
_BLF SerialPutString,??SerialPutString??rA
// 38 SerialPutString(file_name);
LDR R0,??SerialDownload_0+0x8 ;; file_name
_BLF SerialPutString,??SerialPutString??rA
// 39 Int2Str(Number,Size);
MOVS R1,R4
MOVS R0,SP
_BLF Int2Str,??Int2Str??rA
// 40 SerialPutString("\n\r Size: ");
LDR R0,??SerialDownload_0+0xC ;; `?<Constant "\\n\\r Size: ">`
_BLF SerialPutString,??SerialPutString??rA
// 41 SerialPutString(Number);
MOVS R0,SP
_BLF SerialPutString,??SerialPutString??rA
// 42 SerialPutString(" Bytes\r\n");
LDR R0,??SerialDownload_0+0x10 ;; `?<Constant " Bytes\\r\\n">`
_BLF SerialPutString,??SerialPutString??rA
// 43 SerialPutString("-------------------\n");
LDR R0,??SerialDownload_0+0x14 ;; `?<Constant "-------------------\\n">`
_BLF SerialPutString,??SerialPutString??rA
// 44 gimagesize = Size;
LDR R0,??SerialDownload_0+0x18 ;; gimagesize
STR R4,[R0, #+0]
B ??SerialDownload_2
// 45 }
// 46 else if (Size == -1)
??SerialDownload_1:
CMN R4,#+1
BNE ??SerialDownload_3
// 47 {
// 48 SerialPutString("\n\n\rThe image size is higher than 248 KBytes!\n\r");
LDR R0,??SerialDownload_0+0x1C ;; `?<Constant "\\n\\n\\rThe image size is ...">`
_BLF SerialPutString,??SerialPutString??rA
B ??SerialDownload_2
// 49 }
// 50 else if (Size == -2)
??SerialDownload_3:
CMN R4,#+2
BNE ??SerialDownload_4
// 51 {
// 52 SerialPutString("\n\n\rVerification failed!\n\r");
LDR R0,??SerialDownload_0+0x20 ;; `?<Constant "\\n\\n\\rVerification faile...">`
_BLF SerialPutString,??SerialPutString??rA
B ??SerialDownload_2
// 53 }
// 54 else if (Size == -3)
??SerialDownload_4:
CMN R4,#+3
BNE ??SerialDownload_5
// 55 {
// 56 SerialPutString("\r\n\nAborted by user.\n\r");
LDR R0,??SerialDownload_0+0x24 ;; `?<Constant "\\r\\n\\nAborted by user.\\n\\r">`
_BLF SerialPutString,??SerialPutString??rA
B ??SerialDownload_2
// 57 }
// 58 else
// 59 {
// 60 SerialPutString("\n\rFailed to receive the file!\n\r");
??SerialDownload_5:
LDR R0,??SerialDownload_0+0x28 ;; `?<Constant "\\n\\rFailed to receive t...">`
_BLF SerialPutString,??SerialPutString??rA
// 61 }
// 62 return;
??SerialDownload_2:
ADD SP,SP,#+12 ;; stack cleaning
CFI CFA R13+12
POP {R4,R5,PC} ;; return
DATA
??SerialDownload_0:
DC32 `?<Constant "Waiting for the file ...">`
DC32 `?<Constant "\\n\\n\\rTransfer Completed...">`
DC32 file_name
DC32 `?<Constant "\\n\\r Size: ">`
DC32 `?<Constant " Bytes\\r\\n">`
DC32 `?<Constant "-------------------\\n">`
DC32 gimagesize
DC32 `?<Constant "\\n\\n\\rThe image size is ...">`
DC32 `?<Constant "\\n\\n\\rVerification faile...">`
DC32 `?<Constant "\\r\\n\\nAborted by user.\\n\\r">`
DC32 `?<Constant "\\n\\rFailed to receive t...">`
CFI EndBlock cfiBlock0
// 63 }
RSEG CODE_Flash:CODE:NOROOT(2)
CFI Block cfiBlock1 Using cfiCommon0
CFI NoFunction
ARM
??SerialPutString??rA:
LDR R12,??Subroutine0_0 ;; SerialPutString
MOV PC,R12
DATA
??Subroutine0_0:
DC32 SerialPutString
CFI EndBlock cfiBlock1
RSEG CODE_Flash:CODE:NOROOT(2)
CFI Block cfiBlock2 Using cfiCommon0
CFI NoFunction
ARM
??Ymodem_Receive??rA:
LDR R12,??Subroutine1_0 ;; Ymodem_Receive
MOV PC,R12
DATA
??Subroutine1_0:
DC32 Ymodem_Receive
CFI EndBlock cfiBlock2
RSEG CODE_Flash:CODE:NOROOT(2)
CFI Block cfiBlock3 Using cfiCommon0
CFI NoFunction
ARM
??Int2Str??rA:
LDR R12,??Subroutine2_0 ;; Int2Str
MOV PC,R12
DATA
??Subroutine2_0:
DC32 Int2Str
CFI EndBlock cfiBlock3
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "Waiting for the file ...">`:
DATA
DC8 57H, 61H, 69H, 74H, 69H, 6EH, 67H, 20H
DC8 66H, 6FH, 72H, 20H, 74H, 68H, 65H, 20H
DC8 66H, 69H, 6CH, 65H, 20H, 74H, 6FH, 20H
DC8 62H, 65H, 20H, 73H, 65H, 6EH, 74H, 20H
DC8 2EH, 2EH, 2EH, 20H, 28H, 70H, 72H, 65H
DC8 73H, 73H, 20H, 27H, 61H, 27H, 20H, 74H
DC8 6FH, 20H, 61H, 62H, 6FH, 72H, 74H, 29H
DC8 0AH, 0DH, 0
DC8 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\n\\n\\rTransfer Completed...">`:
DATA
DC8 0AH, 0AH, 0DH, 54H, 72H, 61H, 6EH, 73H
DC8 66H, 65H, 72H, 20H, 43H, 6FH, 6DH, 70H
DC8 6CH, 65H, 74H, 65H, 64H, 20H, 53H, 75H
DC8 63H, 63H, 65H, 73H, 73H, 66H, 75H, 6CH
DC8 6CH, 79H, 21H, 0AH, 0DH, 2DH, 2DH, 2DH
DC8 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH
DC8 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH
DC8 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH, 2DH
DC8 2DH, 2DH, 2DH, 2DH, 2DH, 0DH, 0AH, 20H
DC8 4EH, 61H, 6DH, 65H, 3AH, 20H, 0
DC8 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\n\\r Size: ">`:
DATA
DC8 "\012\015 Size: "
DC8 0, 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant " Bytes\\r\\n">`:
DATA
DC8 " Bytes\015\012"
DC8 0, 0, 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "-------------------\\n">`:
DATA
DC8 "-------------------\012"
DC8 0, 0, 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\n\\n\\rThe image size is ...">`:
DATA
DC8 "\012\012\015The image size is higher than 248 KBytes!\012\015"
DC8 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\n\\n\\rVerification faile...">`:
DATA
DC8 "\012\012\015Verification failed!\012\015"
DC8 0, 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\r\\n\\nAborted by user.\\n\\r">`:
DATA
DC8 "\015\012\012Aborted by user.\012\015"
DC8 0, 0
RSEG DATA_C:CONST:SORT:NOROOT(2)
`?<Constant "\\n\\rFailed to receive t...">`:
DATA
DC8 "\012\015Failed to receive the file!\012\015"
END
// 64 /*******************(C)COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
//
// 276 bytes in segment CODE_Flash
// 320 bytes in segment DATA_C
//
// 240 bytes of CODE memory (+ 36 bytes shared)
// 320 bytes of CONST memory
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -