⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ymodem.lst

📁 IAPBootLoader源程序是单片机ARM的在系统编程方法1
💻 LST
📖 第 1 页 / 共 3 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.40A/W32               17/Jan/2007  16:16:23 #
# 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\ymodem #
#                       .c                                                   #
#    Command line    =  "D:\lilian\STR71X\application note\IAP using         #
#                       UART\an2078_IAR(forum)\an2078\IAP_V2.0\common\ymodem #
#                       .c" -lC "D:\lilian\STR71X\application note\IAP       #
#                       using UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\De #
#                       bug\List\" -lA "D:\lilian\STR71X\application         #
#                       note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2. #
#                       0\user\Debug\List\" -o "D:\lilian\STR71X\application #
#                        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" -I                        #
#                       "D:\lilian\STR71X\application note\IAP using         #
#                       UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\..\inclu #
#                       de\" -I "D:\lilian\STR71X\application note\IAP       #
#                       using UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\.. #
#                       \common\" -I ROJ_DIR$\ -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\Li #
#                       st\ymodem.lst                                        #
#    Object file     =  D:\lilian\STR71X\application note\IAP using          #
#                       UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\Debug\Ob #
#                       j\ymodem.r79                                         #
#                                                                            #
#                                                                            #
##############################################################################

D:\lilian\STR71X\application note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2.0\common\ymodem.c
      1          /******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
      2          * File Name          : ymodem.c
      3          * Author             : MCD Application Team
      4          * Date First Issued  : 10/25/2004
      5          * Description        : This file provides all the software functions related to
      6          *                      the ymodem protocol.
      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          #include "common.h"
     20          
     21          #define Flash_Offset   0x40002000  /* Flash user program offset */
     22          

   \                                 In segment DATA_Z, align 4, align-sorted
     23          char file_name[FILE_NAME_LENGTH];
   \                     file_name:
   \   00000000                      DS8 256

   \                                 In segment DATA_I, align 4, align-sorted
     24          u32 Flash_Destination = Flash_Offset;                     
   \                     Flash_Destination:
   \   00000000                      DS8 4
   \   00000004                      REQUIRE `?<Initializer for Flash_Destination>`

   \                                 In segment DATA_Z, align 4, align-sorted
     25          u32 Ram_Source;
   \                     Ram_Source:
   \   00000000                      DS8 4
     26          
     27          /*******************************************************************************
     28          * Function Name  : Receive_Byte
     29          * Description    : Receive byte from sender
     30          * Input 1        : Character
     31          * Input 2        : Timeout
     32          * Return         :  0   --      Byte received                           
     33          *                : -1   --      Timeout   
     34          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
     35          static s32 Receive_Byte (char *c, u32 timeout)
     36          {
   \                     Receive_Byte:
   \   00000000   30402DE9           PUSH     {R4,R5,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
   \   00000008   0150B0E1           MOVS     R5,R1
     37            while (timeout-- > 0)
   \                     ??Receive_Byte_0:
   \   0000000C   0500B0E1           MOVS     R0,R5
   \   00000010   015050E2           SUBS     R5,R0,#+1
   \   00000014   000050E3           CMP      R0,#+0
   \   00000018   0500000A           BEQ      ??Receive_Byte_1
     38            {
     39              if (SerialKeyPressed(c) == 1)
   \   0000001C   0400B0E1           MOVS     R0,R4
   \   00000020   ........           _BLF     SerialKeyPressed,??SerialKeyPressed??rA
   \   00000024   010050E3           CMP      R0,#+1
   \   00000028   F7FFFF1A           BNE      ??Receive_Byte_0
     40              {
     41                return 0;
   \   0000002C   0000A0E3           MOV      R0,#+0
   \   00000030   000000EA           B        ??Receive_Byte_2
     42              }
     43            }
     44            return -1;
   \                     ??Receive_Byte_1:
   \   00000034   0000E0E3           MVN      R0,#+0
   \                     ??Receive_Byte_2:
   \   00000038   3080BDE8           POP      {R4,R5,PC}       ;; return
     45          }
     46          
     47          /*******************************************************************************
     48          * Function Name  : Send_Byte
     49          * Description    : Send a byte 
     50          * Input          : Character
     51          * Return         :  0   --      Byte sent                           
     52          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
     53          static u32 Send_Byte (char c)
     54          {
   \                     Send_Byte:
   \   00000000   10402DE9           PUSH     {R4,LR}
   \   00000004   0040B0E1           MOVS     R4,R0
     55            SerialPutChar(c);
   \   00000008   0400B0E1           MOVS     R0,R4
   \   0000000C   ........           _BLF     SerialPutChar,??SerialPutChar??rA
     56            return 0;
   \   00000010   0000A0E3           MOV      R0,#+0
   \   00000014   1080BDE8           POP      {R4,PC}          ;; return
     57          }
     58          
     59          /*******************************************************************************
     60          * Function Name  : Receive_Packet
     61          * Description    : Receive a packet from sender 
     62          * Input 1        : Data
     63          * Input 2        : Length
     64          * Input 3        : Timeout
     65          * Return         :   0  --      normally return                         
     66          *                :  -1  --      timeout or packet error                 
     67          *                :   1  --      abort by user                           
     68          *                : *length:                                                
     69          *                :   0  --      end of transmission                    
     70          *                :  -1  --      abort by sender                         
     71          *                :  >0  --      packet length                                      
     72          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
     73          static s32 Receive_Packet (char *data, s32 *length, u32 timeout)
     74          {
   \                     Receive_Packet:
   \   00000000   F0412DE9           PUSH     {R4-R8,LR}
   \   00000004   04D04DE2           SUB      SP,SP,#+4
   \   00000008   0040B0E1           MOVS     R4,R0
   \   0000000C   0150B0E1           MOVS     R5,R1
   \   00000010   0260B0E1           MOVS     R6,R2
     75            int i, packet_size;
     76            char c;
     77            *length = 0;
   \   00000014   0000A0E3           MOV      R0,#+0
   \   00000018   000085E5           STR      R0,[R5, #+0]
     78            if (Receive_Byte(&c, timeout) != 0)
   \   0000001C   0610B0E1           MOVS     R1,R6
   \   00000020   0D00B0E1           MOVS     R0,SP
   \   00000024   ........           BL       Receive_Byte
   \   00000028   000050E3           CMP      R0,#+0
   \   0000002C   0100000A           BEQ      ??Receive_Packet_0
     79            {
     80              return -1;
   \   00000030   0000E0E3           MVN      R0,#+0
   \   00000034   400000EA           B        ??Receive_Packet_1
     81            }
     82            switch (c)
   \                     ??Receive_Packet_0:
   \   00000038   0000DDE5           LDRB     R0,[SP, #+0]
   \   0000003C   010050E3           CMP      R0,#+1
   \   00000040   0A00000A           BEQ      ??Receive_Packet_2
   \   00000044   020050E3           CMP      R0,#+2
   \   00000048   0B00000A           BEQ      ??Receive_Packet_3
   \   0000004C   040050E3           CMP      R0,#+4
   \   00000050   0C00000A           BEQ      ??Receive_Packet_4
   \   00000054   180050E3           CMP      R0,#+24
   \   00000058   0C00000A           BEQ      ??Receive_Packet_5
   \   0000005C   410050E3           CMP      R0,#+65
   \   00000060   1800000A           BEQ      ??Receive_Packet_6
   \   00000064   610050E3           CMP      R0,#+97
   \   00000068   1600000A           BEQ      ??Receive_Packet_6
   \   0000006C   170000EA           B        ??Receive_Packet_7
     83            {
     84              case SOH:
     85                packet_size = PACKET_SIZE;
   \                     ??Receive_Packet_2:
   \   00000070   8000A0E3           MOV      R0,#+128
   \   00000074   0080B0E1           MOVS     R8,R0
   \   00000078   160000EA           B        ??Receive_Packet_8
     86                break;
     87              case STX:
     88                packet_size = PACKET_1K_SIZE;
   \                     ??Receive_Packet_3:
   \   0000007C   400EA0E3           MOV      R0,#+1024
   \   00000080   0080B0E1           MOVS     R8,R0
   \   00000084   130000EA           B        ??Receive_Packet_8
     89                break;
     90              case EOT:
     91                return 0;
   \                     ??Receive_Packet_4:
   \   00000088   0000A0E3           MOV      R0,#+0
   \   0000008C   2A0000EA           B        ??Receive_Packet_1
     92              case CAN:
     93                if ((Receive_Byte(&c, timeout) == 0) && (c == CAN))
   \                     ??Receive_Packet_5:
   \   00000090   0610B0E1           MOVS     R1,R6
   \   00000094   0D00B0E1           MOVS     R0,SP
   \   00000098   ........           BL       Receive_Byte
   \   0000009C   000050E3           CMP      R0,#+0
   \   000000A0   0600001A           BNE      ??Receive_Packet_9
   \   000000A4   0000DDE5           LDRB     R0,[SP, #+0]
   \   000000A8   180050E3           CMP      R0,#+24
   \   000000AC   0300001A           BNE      ??Receive_Packet_9
     94                {
     95                  *length = -1;
   \   000000B0   0000E0E3           MVN      R0,#+0
   \   000000B4   000085E5           STR      R0,[R5, #+0]
     96                  return 0;
   \   000000B8   0000A0E3           MOV      R0,#+0
   \   000000BC   1E0000EA           B        ??Receive_Packet_1
     97                }
     98                else
     99                {
    100                  return -1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -