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

📄 ymodem.s79

📁 IAPBootLoader源程序是单片机ARM的在系统编程方法1
💻 S79
📖 第 1 页 / 共 3 页
字号:
        LDR      R0,[SP, #+0]
        _BLF     FLASH_SectorMask,??FLASH_SectorMask??rA
        MOVS     R11,R0
//  184                      FLASH_SectorErase(Sector_Mask);
        MOVS     R0,R11
        _BLF     FLASH_SectorErase,??FLASH_SectorErase??rA
//  185 
//  186                      Send_Byte(ACK);
        MOV      R0,#+6
        BL       Send_Byte
//  187                      Send_Byte(CRC16);
        MOV      R0,#+67
        BL       Send_Byte
        B        ??Ymodem_Receive_19
//  188                    }
//  189                    else   /* Filename packet is empty; end session */
//  190                    {
//  191                      Send_Byte(ACK);
??Ymodem_Receive_12:
        MOV      R0,#+6
        BL       Send_Byte
//  192                      file_done = 1;
        MOV      R0,#+1
        MOVS     R7,R0
//  193                      session_done = 1;
        MOV      R1,#+1
        STR      R1,[SP, #+8]
//  194                      break;
        B        ??Ymodem_Receive_9
//  195                    }
//  196                  }
//  197                  else    /* Data packet */
//  198                  {
//  199                    memcpy(buf_ptr, packet_data + PACKET_HEADER, packet_length);
??Ymodem_Receive_11:
        LDR      R2,[SP, #+4]
        ADD      R1,SP,#+35
        LDR      R0,[SP, #+12]
        _BLF     memcpy,??memcpy??rA
//  200                    Ram_Source = 0x20002000;
        LDR      R0,??Ymodem_Receive_15+0x4  ;; Ram_Source
        MOV      R1,#+536870912
        ORR      R1,R1,#0x2000
        STR      R1,[R0, #+0]
//  201                    for (j=0;(j<packet_length)&&(Flash_Destination < Flash_Offset + size);j+=4)
        MOV      R0,#+0
        MOVS     R6,R0
??Ymodem_Receive_20:
        LDR      R0,[SP, #+4]
        CMP      R6,R0
        BGE      ??Ymodem_Receive_21
        LDR      R0,??Ymodem_Receive_15+0x8  ;; Flash_Destination
        LDR      R0,[R0, #+0]
        LDR      R1,[SP, #+0]
        MOV      R2,#+1073741824
        ORR      R2,R2,#0x2000
        ADDS     R1,R2,R1
        CMP      R0,R1
        BCS      ??Ymodem_Receive_21
//  202                    {
//  203                      /* Program the data received into Flash */
//  204                      FLASH_WordWrite(Flash_Destination,*(u32*)Ram_Source);
        LDR      R0,??Ymodem_Receive_15+0x4  ;; Ram_Source
        LDR      R0,[R0, #+0]
        LDR      R1,[R0, #+0]
        LDR      R0,??Ymodem_Receive_15+0x8  ;; Flash_Destination
        LDR      R0,[R0, #+0]
        _BLF     FLASH_WordWrite,??FLASH_WordWrite??rA
//  205                      if(*(u32*)Flash_Destination != *(u32*)Ram_Source)
        LDR      R0,??Ymodem_Receive_15+0x8  ;; Flash_Destination
        LDR      R0,[R0, #+0]
        LDR      R0,[R0, #+0]
        LDR      R1,??Ymodem_Receive_15+0x4  ;; Ram_Source
        LDR      R1,[R1, #+0]
        LDR      R1,[R1, #+0]
        CMP      R0,R1
        BEQ      ??Ymodem_Receive_22
//  206                      {
//  207                        /* End session */
//  208                        Send_Byte(CAN);
        MOV      R0,#+24
        BL       Send_Byte
//  209                        Send_Byte(CAN);
        MOV      R0,#+24
        BL       Send_Byte
//  210                        return -2;
        MVN      R0,#+1
        B        ??Ymodem_Receive_8
//  211                      }
//  212                      Flash_Destination += 4;                     
??Ymodem_Receive_22:
        LDR      R0,??Ymodem_Receive_15+0x8  ;; Flash_Destination
        LDR      R1,??Ymodem_Receive_15+0x8  ;; Flash_Destination
        LDR      R1,[R1, #+0]
        ADDS     R1,R1,#+4
        STR      R1,[R0, #+0]
//  213                      Ram_Source+=4;
        LDR      R0,??Ymodem_Receive_15+0x4  ;; Ram_Source
        LDR      R1,??Ymodem_Receive_15+0x4  ;; Ram_Source
        LDR      R1,[R1, #+0]
        ADDS     R1,R1,#+4
        STR      R1,[R0, #+0]
//  214                    }                   
        ADDS     R6,R6,#+4
        B        ??Ymodem_Receive_20
//  215 
//  216                    Send_Byte(ACK);
??Ymodem_Receive_21:
        MOV      R0,#+6
        BL       Send_Byte
//  217                  }
//  218                  packets_received ++;
??Ymodem_Receive_19:
        ADDS     R8,R8,#+1
//  219                  session_begin = 1;
        MOV      R0,#+1
        MOVS     R10,R0
        B        ??Ymodem_Receive_9
//  220                }
//  221              }
//  222              break;
//  223            case 1:
//  224              Send_Byte(CAN);
??Ymodem_Receive_3:
        MOV      R0,#+24
        BL       Send_Byte
//  225              Send_Byte(CAN);
        MOV      R0,#+24
        BL       Send_Byte
//  226              return -3;
        MVN      R0,#+2
        B        ??Ymodem_Receive_8
//  227            default:
//  228              if (session_begin > 0)
??Ymodem_Receive_4:
        CMP      R10,#+1
        BLT      ??Ymodem_Receive_23
//  229              {
//  230                errors ++;
        ADDS     R9,R9,#+1
//  231              }
//  232              if (errors > MAX_ERRORS)
??Ymodem_Receive_23:
        CMP      R9,#+6
        BLT      ??Ymodem_Receive_24
//  233              {
//  234                Send_Byte(CAN);
        MOV      R0,#+24
        BL       Send_Byte
//  235                Send_Byte(CAN);
        MOV      R0,#+24
        BL       Send_Byte
//  236                return 0;
        MOV      R0,#+0
        B        ??Ymodem_Receive_8
//  237              }
//  238              Send_Byte(CRC16);
??Ymodem_Receive_24:
        MOV      R0,#+67
        BL       Send_Byte
//  239              break;
//  240          }
//  241          if (file_done != 0)
??Ymodem_Receive_9:
        CMP      R7,#+0
        BEQ      ??Ymodem_Receive_1
//  242          {
//  243          break;
//  244        }
//  245      }
//  246      if (session_done != 0)
        LDR      R0,[SP, #+8]
        CMP      R0,#+0
        BEQ      ??Ymodem_Receive_0
//  247      {
//  248        break;
//  249      }
//  250   }  
//  251   return (s32)size;
        LDR      R0,[SP, #+0]
??Ymodem_Receive_8:
        ADD      SP,SP,#+44       ;; stack cleaning
        CFI CFA R13+1060
        ADD      SP,SP,#+1024
        CFI CFA R13+36
        POP      {R4-R11,PC}      ;; return
        DATA
??Ymodem_Receive_15:
        DC32     file_name
        DC32     Ram_Source
        DC32     Flash_Destination
        CFI EndBlock cfiBlock3
//  252 }

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI NoFunction
        ARM
??SerialKeyPressed??rA:
        LDR      R12,??Subroutine0_0  ;; SerialKeyPressed
        MOV      PC,R12
        DATA
??Subroutine0_0:
        DC32     SerialKeyPressed
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI NoFunction
        ARM
??SerialPutChar??rA:
        LDR      R12,??Subroutine1_0  ;; SerialPutChar
        MOV      PC,R12
        DATA
??Subroutine1_0:
        DC32     SerialPutChar
        CFI EndBlock cfiBlock5

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI NoFunction
        ARM
??Str2Int??rA:
        LDR      R12,??Subroutine2_0  ;; Str2Int
        MOV      PC,R12
        DATA
??Subroutine2_0:
        DC32     Str2Int
        CFI EndBlock cfiBlock6

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon0
        CFI NoFunction
        ARM
??FLASH_SectorMask??rA:
        LDR      R12,??Subroutine3_0  ;; FLASH_SectorMask
        MOV      PC,R12
        DATA
??Subroutine3_0:
        DC32     FLASH_SectorMask
        CFI EndBlock cfiBlock7

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 Using cfiCommon0
        CFI NoFunction
        ARM
??FLASH_SectorErase??rA:
        LDR      R12,??Subroutine4_0  ;; FLASH_SectorErase
        MOV      PC,R12
        DATA
??Subroutine4_0:
        DC32     FLASH_SectorErase
        CFI EndBlock cfiBlock8

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon0
        CFI NoFunction
        ARM
??memcpy??rA:
        LDR      R12,??Subroutine5_0  ;; memcpy
        MOV      PC,R12
        DATA
??Subroutine5_0:
        DC32     memcpy
        CFI EndBlock cfiBlock9

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI NoFunction
        ARM
??FLASH_WordWrite??rA:
        LDR      R12,??Subroutine6_0  ;; FLASH_WordWrite
        MOV      PC,R12
        DATA
??Subroutine6_0:
        DC32     FLASH_WordWrite
        CFI EndBlock cfiBlock10

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?<Initializer for Flash_Destination>`:
        DATA
        DC32 1073750016

        RSEG DATA_ID:CONST:SORT:NOROOT(2)
`?*?DATA_ID`:

        RSEG INITTAB:CODE:ROOT(2)
        DATA
?init?tab?DATA_I:
        DCD      sfe(DATA_I) - sfb(DATA_I), sfb(DATA_I), sfb(DATA_ID)

        RSEG INITTAB:CODE:ROOT(2)
        DATA
?init?tab?DATA_Z:
        DCD      sfe(DATA_Z) - sfb(DATA_Z), sfb(DATA_Z), sfb(DATA_Z)

        END
//  253 /*******************(C)COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
// 
// 1 352 bytes in segment CODE
//     4 bytes in segment DATA_I
//     4 bytes in segment DATA_ID
//   260 bytes in segment DATA_Z
//    24 bytes in segment INITTAB
// 
// 1 268 bytes of CODE  memory (+ 108 bytes shared)
//     4 bytes of CONST memory
//   264 bytes of DATA  memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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