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

📄 main.lst

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

   \                                 In section .text, align 4, keep-with-next
    359          void PartialCRC(unsigned long* ulCRC, const unsigned char *sData,unsigned long ulDataLength)
    360          {
   \                     PartialCRC:
   \   00000000   01402DE9           PUSH     {R0,LR}
   \   00000004   000052E3           CMP      R2,#+0
   \   00000008   0A00000A           BEQ      ??PartialCRC_0
   \                     ??PartialCRC_1:
   \   0000000C   012042E2           SUB      R2,R2,#+1
    361          	while(ulDataLength--)
    362          	{
    363          		*ulCRC = ((*ulCRC) >>8)
    364          			^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]
    365          	}
   \   00000030   000052E3           CMP      R2,#+0
   \   00000034   F4FFFF1A           BNE      ??PartialCRC_1
    366          }
   \                     ??PartialCRC_0:
   \   00000038   0050BDE8           POP      {R12,LR}
   \   0000003C   1EFF2FE1           BX       LR               ;; return
    367          
    368          /*
    369              Reflection is a requirement for the official CRC-32 standard.
    370              You can create CRCs without it, but they won't conform to the standard.
    371          */
    372          

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

   \                                 In section .text, align 4, keep-with-next
    391          void InitializeCRC(void)
    392          {
   \                     InitializeCRC:
   \   00000000   31402DE9           PUSH     {R0,R4,R5,LR}
    393          	unsigned long ulPolynomial = 0x04C11DB7;
    394          	int iCodes;
    395          	int iPos;
    396          	for(iCodes =0; iCodes<=0xFF; iCodes++)
   \   00000004   0040A0E3           MOV      R4,#+0
   \   00000008   ........           LDR      R5,??DataTable14  ;; crc32_table
    397          	{
    398          		crc32_table[iCodes] = Reflect(iCodes,8) << 24;
   \                     ??InitializeCRC_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]
    399          		for(iPos =0; iPos<8;iPos++)
   \   00000020   0800A0E3           MOV      R0,#+8
    400          		{
    401          			crc32_table[iCodes] = (crc32_table[iCodes] << 1)
    402          				^((crc32_table[iCodes] & (unsigned long)(1 << 31))?ulPolynomial:0);
   \                     ??InitializeCRC_1:
   \   00000024   001095E5           LDR      R1,[R5, #+0]
   \   00000028   800411E3           TST      R1,#0x80000000
   \   0000002C   38109F15           LDRNE    R1,??InitializeCRC_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]
    403          		}
   \   00000040   010050E2           SUBS     R0,R0,#+1
   \   00000044   F6FFFF1A           BNE      ??InitializeCRC_1
    404          		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
    405          	}
   \   00000058   014084E2           ADD      R4,R4,#+1
   \   0000005C   400F54E3           CMP      R4,#+256
   \   00000060   E9FFFFBA           BLT      ??InitializeCRC_0
    406          }
   \   00000064   3840BDE8           POP      {R3-R5,LR}
   \   00000068   1EFF2FE1           BX       LR               ;; return
   \                     ??InitializeCRC_2:
   \   0000006C   B71DC104           DC32     0x4c11db7
    407          
    408          /*
    409              Returns the calculated CRC32 (through ulOutCRC) for the given string.
    410          */

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

   \                                 In section .text, align 4, keep-with-next
    423          static unsigned int WhetherEmpty()
    424          {
   \                     WhetherEmpty:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
    425            unsigned int i,j;
    426            unsigned char *tmp;
    427            tmp = SdCodeAddr;
   \   00000004   ........           LDR      R0,??DataTable39  ;; SdCodeAddr
   \   00000008   004090E5           LDR      R4,[R0, #+0]
    428            for(i = 0; i < 16; i++)
   \   0000000C   0050A0E3           MOV      R5,#+0
   \   00000010   0160A0E3           MOV      R6,#+1
   \   00000014   050000EA           B        ??WhetherEmpty_0
    429            {
    430              if(*tmp == 0xFF)
    431              {
    432                j =1;
    433                tmp++;
   \                     ??WhetherEmpty_1:
   \   00000018   014084E2           ADD      R4,R4,#+1
    434                TRACE_INFO("NO data\n\r");
   \   0000001C   40009FE5           LDR      R0,??WhetherEmpty_2  ;; `?<Constant "-I- NO data\\n\\r">`
   \   00000020   ........           BL       printf
    435              }
   \   00000024   015085E2           ADD      R5,R5,#+1
   \   00000028   100055E3           CMP      R5,#+16
   \   0000002C   0900002A           BCS      ??WhetherEmpty_3
   \                     ??WhetherEmpty_0:
   \   00000030   0000D4E5           LDRB     R0,[R4, #+0]
   \   00000034   FF0050E3           CMP      R0,#+255
   \   00000038   F6FFFF0A           BEQ      ??WhetherEmpty_1
    436              else
    437              {
    438               
    439                j=0;
   \   0000003C   0060A0E3           MOV      R6,#+0
    440                TRACE_INFO("data:%x, %x\n\r",*tmp,tmp);
   \   00000040   0420A0E1           MOV      R2,R4
   \   00000044   0010A0E1           MOV      R1,R0
   \   00000048   18009FE5           LDR      R0,??WhetherEmpty_2+0x4  ;; `?<Constant "-I- data:%x, %x\\n\\r">`
   \   0000004C   ........           BL       printf
    441                TRACE_INFO(" has datas\n\r");
   \   00000050   14009FE5           LDR      R0,??WhetherEmpty_2+0x8  ;; `?<Constant "-I-  has datas\\n\\r">`
   \   00000054   ........           BL       printf
    442                tmp++;
    443                break;
    444              }
    445            }
    446            return j;
   \                     ??WhetherEmpty_3:
   \   00000058   0600A0E1           MOV      R0,R6
   \   0000005C   7040BDE8           POP      {R4-R6,LR}
   \   00000060   1EFF2FE1           BX       LR               ;; return
   \                     ??WhetherEmpty_2:
   \   00000064   ........           DC32     `?<Constant "-I- NO data\\n\\r">`
   \   00000068   ........           DC32     `?<Constant "-I- data:%x, %x\\n\\r">`
   \   0000006C   ........           DC32     `?<Constant "-I-  has datas\\n\\r">`
    447            
    448          }
    449          //------------------------------------------------------------------------------
    450          /// LeadApp() function was used to copy the code in dataflash to sdram
    451          //------------------------------------------------------------------------------
    452          

   \                                 In section .text, align 4, keep-with-next
    453          static unsigned int LeadAPP(void)
    454          {
   \                     LeadAPP:

⌨️ 快捷键说明

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