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

📄 main.lst

📁 本代bootloader通过usb下载代码首先存放在sdram中
💻 LST
📖 第 1 页 / 共 5 页
字号:
    352          //------------------------------------------------------------------------------
    353          //         Exported functions
    354          //------------------------------------------------------------------------------
    355          //my functions ****************************************************************
    356          /*
    357              Calculates the CRC32 by looping through each of the bytes in sData.
    358          
    359              Note: For Example usage example, see FileCRC().
    360          */

   \                                 In section .text, align 4, keep-with-next
    361          void PartialCRC(unsigned long* ulCRC, const unsigned char *sData,unsigned long ulDataLength)
    362          {
   \                     PartialCRC:
   \   00000000   01402DE9           PUSH     {R0,LR}
   \   00000004   000052E3           CMP      R2,#+0
   \   00000008   0A00000A           BEQ      ??PartialCRC_0
   \                     ??PartialCRC_1:
   \   0000000C   012042E2           SUB      R2,R2,#+1
    363          	while(ulDataLength--)
    364          	{
    365          		*ulCRC = ((*ulCRC) >>8)
    366          			^crc32_table[((*ulCRC)&0xFF)^*sData++];
   \   00000010   003090E5           LDR      R3,[R0, #+0]
   \   00000014   FFC003E2           AND      R12,R3,#0xFF
   \   00000018   01E0D1E4           LDRB     LR,[R1], #+1
   \   0000001C   0CC02EE0           EOR      R12,LR,R12
   \   00000020   ........           LDR      LR,??DataTable14  ;; crc32_table
   \   00000024   0CC19EE7           LDR      R12,[LR, +R12, LSL #+2]
   \   00000028   23342CE0           EOR      R3,R12,R3, LSR #+8
   \   0000002C   003080E5           STR      R3,[R0, #+0]
    367          	}
   \   00000030   000052E3           CMP      R2,#+0
   \   00000034   F4FFFF1A           BNE      ??PartialCRC_1
    368          }
   \                     ??PartialCRC_0:
   \   00000038   0050BDE8           POP      {R12,LR}
   \   0000003C   1EFF2FE1           BX       LR               ;; return
    369          
    370          /*
    371              Reflection is a requirement for the official CRC-32 standard.
    372              You can create CRCs without it, but they won't conform to the standard.
    373          */
    374          

   \                                 In section .text, align 4, keep-with-next
    375          unsigned long Reflect(unsigned long ulReflect, const char cChar)
    376          {
   \                     Reflect:
   \   00000000   01402DE9           PUSH     {R0,LR}
    377          	unsigned long ulValue = 0;
   \   00000004   0020A0E3           MOV      R2,#+0
    378          	int iPos;
    379          	for(iPos = 1; iPos < (cChar +1); iPos ++)
   \   00000008   0130A0E3           MOV      R3,#+1
   \   0000000C   01C081E2           ADD      R12,R1,#+1
   \   00000010   0CC8A0E1           MOV      R12,R12, LSL #+16
   \   00000014   2CC8A0E1           MOV      R12,R12, LSR #+16
   \   00000018   02005CE3           CMP      R12,#+2
   \   0000001C   0800003A           BCC      ??Reflect_0
    380          	{
    381          		if(ulReflect &1)
   \                     ??Reflect_1:
   \   00000020   010010E3           TST      R0,#0x1
    382          		{
    383          			ulValue |=(1 << (cChar-iPos));
   \   00000024   01C0A013           MOVNE    R12,#+1
   \   00000028   03E04110           SUBNE    LR,R1,R3
   \   0000002C   1C2E8211           ORRNE    R2,R2,R12, LSL LR
    384          		}
    385          		ulReflect >>= 1;
   \   00000030   A000A0E1           LSR      R0,R0,#+1
    386          	}
   \   00000034   013083E2           ADD      R3,R3,#+1
   \   00000038   01C081E2           ADD      R12,R1,#+1
   \   0000003C   0C0053E1           CMP      R3,R12
   \   00000040   F6FFFFBA           BLT      ??Reflect_1
    387          	return ulValue;
   \                     ??Reflect_0:
   \   00000044   0200A0E1           MOV      R0,R2
   \   00000048   0050BDE8           POP      {R12,LR}
   \   0000004C   1EFF2FE1           BX       LR               ;; return
    388          }
    389          
    390           /*
    391              This function initializes "CRC Lookup Table". You only need to call it once to
    392                  initalize the table before using any of the other CRC32 calculation functions.
    393          */

   \                                 In section .text, align 4, keep-with-next
    394          void Initialize(void)
    395          {
   \                     Initialize:
   \   00000000   31402DE9           PUSH     {R0,R4,R5,LR}
    396          	unsigned long ulPolynomial = 0x04C11DB7;
    397          	int iCodes;
    398          	int iPos;
    399          	for(iCodes =0; iCodes<=0xFF; iCodes++)
   \   00000004   0040A0E3           MOV      R4,#+0
   \   00000008   ........           LDR      R5,??DataTable14  ;; crc32_table
    400          	{
    401          		crc32_table[iCodes] = Reflect(iCodes,8) << 24;
   \                     ??Initialize_0:
   \   0000000C   0810A0E3           MOV      R1,#+8
   \   00000010   0400A0E1           MOV      R0,R4
   \   00000014   ........           BL       Reflect
   \   00000018   000CA0E1           LSL      R0,R0,#+24
   \   0000001C   000085E5           STR      R0,[R5, #+0]
    402          		for(iPos =0; iPos<8;iPos++)
   \   00000020   0800A0E3           MOV      R0,#+8
    403          		{
    404          			crc32_table[iCodes] = (crc32_table[iCodes] << 1)
    405          				^((crc32_table[iCodes] & (unsigned long)(1 << 31))?ulPolynomial:0);
   \                     ??Initialize_1:
   \   00000024   001095E5           LDR      R1,[R5, #+0]
   \   00000028   800411E3           TST      R1,#0x80000000
   \   0000002C   38109F15           LDRNE    R1,??Initialize_2  ;; 0x4c11db7
   \   00000030   0010A003           MOVEQ    R1,#+0
   \   00000034   002095E5           LDR      R2,[R5, #+0]
   \   00000038   821021E0           EOR      R1,R1,R2, LSL #+1
   \   0000003C   001085E5           STR      R1,[R5, #+0]
    406          		}
   \   00000040   010050E2           SUBS     R0,R0,#+1
   \   00000044   F6FFFF1A           BNE      ??Initialize_1
    407          		crc32_table[iCodes] = Reflect(crc32_table[iCodes],32);
   \   00000048   2010A0E3           MOV      R1,#+32
   \   0000004C   000095E5           LDR      R0,[R5, #+0]
   \   00000050   ........           BL       Reflect
   \   00000054   040085E4           STR      R0,[R5], #+4
    408          	}
   \   00000058   014084E2           ADD      R4,R4,#+1
   \   0000005C   400F54E3           CMP      R4,#+256
   \   00000060   E9FFFFBA           BLT      ??Initialize_0
    409          }
   \   00000064   3840BDE8           POP      {R3-R5,LR}
   \   00000068   1EFF2FE1           BX       LR               ;; return
   \                     ??Initialize_2:
   \   0000006C   B71DC104           DC32     0x4c11db7
    410          
    411          /*
    412              Returns the calculated CRC32 (through ulOutCRC) for the given string.
    413          */

   \                                 In section .text, align 4, keep-with-next
    414          unsigned long FullCRC(const unsigned char *sData, unsigned long ulDataLength)
    415          {
   \                     FullCRC:
   \   00000000   01402DE9           PUSH     {R0,LR}
    416              unsigned long ulCRC = 0xffffffff; //Initilaize the CRC.
   \   00000004   0030E0E3           MVN      R3,#+0
   \   00000008   00308DE5           STR      R3,[SP, #+0]
    417              PartialCRC(&ulCRC, sData, ulDataLength);
   \   0000000C   0120A0E1           MOV      R2,R1
   \   00000010   0010A0E1           MOV      R1,R0
   \   00000014   0D00A0E1           MOV      R0,SP
   \   00000018   ........           BL       PartialCRC
    418              return ulCRC  ; 
   \   0000001C   00009DE5           LDR      R0,[SP, #+0]
   \   00000020   0050BDE8           POP      {R12,LR}
   \   00000024   1EFF2FE1           BX       LR               ;; return
    419          	//Finalize the CRC and return.
    420          }
    421          
    422          //------------------------------------------------------------------------------
    423          // The function to test whether the dataflash has datas
    424          //if the dataflash is empty return a value, or return 0.
    425          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    426          static unsigned int WhetherEmpty()
    427          {
   \                     WhetherEmpty:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
    428            unsigned int i,j;
    429            unsigned char *tmp;
    430            tmp = SdCodeAddr;
   \   00000004   ........           LDR      R0,??DataTable66  ;; SdCodeAddr
   \   00000008   004090E5           LDR      R4,[R0, #+0]
    431            j=0;
   \   0000000C   0050A0E3           MOV      R5,#+0
    432            TRACE_INFO("In Whether\n\r");
   \   00000010   54009FE5           LDR      R0,??WhetherEmpty_0  ;; `?<Constant "-I- In Whether\\n\\r">`
   \   00000014   ........           BL       printf
    433            for(i = 0; i < 16; i++)
   \   00000018   1060A0E3           MOV      R6,#+16
    434            {
    435              if(*tmp == 0xFF)
   \                     ??WhetherEmpty_1:
   \   0000001C   0000D4E5           LDRB     R0,[R4, #+0]
   \   00000020   FF0050E3           CMP      R0,#+255
   \   00000024   0400001A           BNE      ??WhetherEmpty_2
    436              {
    437                j =1;
   \   00000028   0150A0E3           MOV      R5,#+1
    438                tmp++;
   \   0000002C   014084E2           ADD      R4,R4,#+1
    439                TRACE_INFO("NO data\n\r");
   \   00000030   38009FE5           LDR      R0,??WhetherEmpty_0+0x4  ;; `?<Constant "-I- NO data\\n\\r">`
   \   00000034   ........           BL       printf
   \   00000038   060000EA           B        ??WhetherEmpty_3
    440              }
    441              else
    442              {
    443               
    444                j=j;
    445                TRACE_INFO("data:%x, %x\n\r",*tmp,tmp);
   \                     ??WhetherEmpty_2:
   \   0000003C   0420A0E1           MOV      R2,R4
   \   00000040   0010A0E1           MOV      R1,R0
   \   00000044   28009FE5           LDR      R0,??WhetherEmpty_0+0x8  ;; `?<Constant "-I- data:%x, %x\\n\\r">`
   \   00000048   ........           BL       printf
    446                TRACE_INFO(" has datas\n\r");
   \   0000004C   24009FE5           LDR      R0,??WhetherEmpty_0+0xC  ;; `?<Constant "-I-  has datas\\n\\r">`
   \   00000050   ........           BL       printf
    447                tmp++;
   \   00000054   014084E2           ADD      R4,R4,#+1
    448               continue;
    449              }
    450            }
   \                     ??WhetherEmpty_3:
   \   00000058   016056E2           SUBS     R6,R6,#+1
   \   0000005C   EEFFFF1A           BNE      ??WhetherEmpty_1
    451            return j;
   \   00000060   0500A0E1           MOV      R0,R5
   \   00000064   7040BDE8           POP      {R4-R6,LR}
   \   00000068   1EFF2FE1           BX       LR               ;; return
   \                     ??WhetherEmpty_0:
   \   0000006C   ........           DC32     `?<Constant "-I- In Whether\\n\\r">`
   \   00000070   ........           DC32     `?<Constant "-I- NO data\\n\\r">`
   \   00000074   ........           DC32     `?<Constant "-I- data:%x, %x\\n\\r">`
   \   00000078   ........           DC32     `?<Constant "-I-  has datas\\n\\r">`

⌨️ 快捷键说明

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