bsp.txt 13.1 KB
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\bsp.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\bsp.d --cpu=Cortex-M4.fp --apcs=interwork -O1 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I..\..\User\parameter -I..\..\User\LaserMotionCtr -I..\..\User\W5100S -I..\..\User\bsp -I..\..\User\CHASSIS -I..\..\User\CONTROLFUNCTION -I..\..\User\DATAUPDATE -I..\..\User\HARAWARE -I..\..\User\MOTORDRIVER -I..\..\User\NAVAGATION -I..\..\User\PLATFORM -I..\..\User\SENSOR -I.\RTE\_Flash -IC:\Users\YDJ\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\YDJ\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\bsp.crf ..\..\User\bsp\bsp.c]
                          THUMB

                          AREA ||i.BSP_CPU_ClkFreq||, CODE, READONLY, ALIGN=1

                  BSP_CPU_ClkFreq PROC
;;;167    */
;;;168    CPU_INT32U  BSP_CPU_ClkFreq (void)
000000  b51f              PUSH     {r0-r4,lr}
;;;169    {
;;;170        RCC_ClocksTypeDef  rcc_clocks;
;;;171    
;;;172        RCC_GetClocksFreq(&rcc_clocks);
000002  4668              MOV      r0,sp
000004  f7fffffe          BL       RCC_GetClocksFreq
;;;173        return ((CPU_INT32U)rcc_clocks.HCLK_Frequency);
000008  9801              LDR      r0,[sp,#4]
;;;174    }
00000a  b004              ADD      sp,sp,#0x10
00000c  bd10              POP      {r4,pc}
;;;175    
                          ENDP


                          AREA ||i.BSP_Tick_Init||, CODE, READONLY, ALIGN=2

                  BSP_Tick_Init PROC
;;;183    */
;;;184    void BSP_Tick_Init (void)
000000  b510              PUSH     {r4,lr}
;;;185    {
;;;186        CPU_INT32U  cpu_clk_freq;
;;;187        CPU_INT32U  cnts;
;;;188        
;;;189        cpu_clk_freq = BSP_CPU_ClkFreq();                           /* 获取系统时钟  */
000002  f7fffffe          BL       BSP_CPU_ClkFreq
;;;190        
;;;191    #if (OS_VERSION >= 30000u)
;;;192        cnts  = cpu_clk_freq / (CPU_INT32U)OSCfg_TickRate_Hz;     
000006  4909              LDR      r1,|L2.44|
000008  6809              LDR      r1,[r1,#0]  ; OSCfg_TickRate_Hz
00000a  fbb0f0f1          UDIV     r0,r0,r1
00000e  1e40              SUBS     r0,r0,#1
000010  f1b07f80          CMP      r0,#0x1000000
000014  d209              BCS      |L2.42|
000016  f04f21e0          MOV      r1,#0xe000e000
00001a  6148              STR      r0,[r1,#0x14]
00001c  4a04              LDR      r2,|L2.48|
00001e  20f0              MOVS     r0,#0xf0
000020  7010              STRB     r0,[r2,#0]
000022  2000              MOVS     r0,#0
000024  6188              STR      r0,[r1,#0x18]
000026  2007              MOVS     r0,#7
000028  6108              STR      r0,[r1,#0x10]
                  |L2.42|
;;;193    #else
;;;194        cnts  = cpu_clk_freq / (CPU_INT32U)OS_TICKS_PER_SEC;        /* 获得滴答定时器的参数  */
;;;195    #endif
;;;196        SysTick_Config(cnts);              /* 这里默认的是最低优先级 */
;;;197    }
00002a  bd10              POP      {r4,pc}
;;;198    
                          ENDP

                  |L2.44|
                          DCD      OSCfg_TickRate_Hz
                  |L2.48|
                          DCD      0xe000ed23

                          AREA ||i.Get_ChipID||, CODE, READONLY, ALIGN=2

                  Get_ChipID PROC
;;;22     /*应用端程序校验bootloader*/
;;;23     void Get_ChipID(void)
000000  b57f              PUSH     {r0-r6,lr}
;;;24     {
;;;25     	u32 Sum = 0;
000002  2100              MOVS     r1,#0
;;;26     	u32 idsum = 0;
;;;27     	u8 *pFlash;
;;;28     	uint32_t id[3];
;;;29     	
;;;30     	pFlash  = (u8*)ADDR_FLASH_SECTOR_0;/*指向bootloader区域*/
000004  f04f6200          MOV      r2,#0x8000000
;;;31         for(u32 i = 0; i < 0x4000; i++)
000008  2000              MOVS     r0,#0
00000a  1354              ASRS     r4,r2,#13
                  |L3.12|
;;;32         {
;;;33             Sum += pFlash[i];/*以BYTE型将第一个扇区数据全部加起来*/
00000c  5c13              LDRB     r3,[r2,r0]
00000e  4419              ADD      r1,r1,r3
000010  1c40              ADDS     r0,r0,#1              ;31
000012  42a0              CMP      r0,r4                 ;31
000014  d3fa              BCC      |L3.12|
;;;34         }
;;;35     	/*获取到ID号*/
;;;36     	id[0] = *(__I uint32_t *)(0x1FFF7A10 + 0x00);
000016  4a14              LDR      r2,|L3.104|
000018  6810              LDR      r0,[r2,#0]
00001a  9001              STR      r0,[sp,#4]
;;;37     	id[1] = *(__I uint32_t *)(0x1FFF7A10 + 0x04);
00001c  1d13              ADDS     r3,r2,#4
00001e  6818              LDR      r0,[r3,#0]
000020  9002              STR      r0,[sp,#8]
;;;38     	id[2] = *(__I uint32_t *)(0x1FFF7A10 + 0x08);
000022  1d1c              ADDS     r4,r3,#4
000024  6820              LDR      r0,[r4,#0]
000026  9003              STR      r0,[sp,#0xc]
;;;39     	/*将ID号加起来*/
;;;40     	id[0] = id[0] + id[1] + id[2];
000028  e9dd0501          LDRD     r0,r5,[sp,#4]
00002c  4428              ADD      r0,r0,r5
00002e  9d03              LDR      r5,[sp,#0xc]
000030  4428              ADD      r0,r0,r5
000032  9001              STR      r0,[sp,#4]
;;;41     	
;;;42     	/*再将ID号按BYTE加起来*/
;;;43     	idsum = ((id[0] & 0xff000000) >> 24) + ((id[0] & 0x00ff0000) >> 16) + ((id[0] & 0x0000ff00) >> 8) + ((id[0] & 0x000000ff) >> 0);
000034  9801              LDR      r0,[sp,#4]
000036  9d01              LDR      r5,[sp,#4]
000038  f3c04007          UBFX     r0,r0,#16,#8
00003c  eb006015          ADD      r0,r0,r5,LSR #24
000040  f3c52507          UBFX     r5,r5,#8,#8
000044  4428              ADD      r0,r0,r5
000046  9d01              LDR      r5,[sp,#4]
000048  b2ed              UXTB     r5,r5
00004a  4428              ADD      r0,r0,r5
;;;44     	
;;;45     	/*扇区校验和减去ID号按BYTE加起来的数据如果不是一个固定值证明BOOTLOADER被改了*/
;;;46     //	if(Sum - idsum != 2482572)
;;;47     //	Uart_Printf(COM1,"DATA=%d\r\n",Sum - idsum);
;;;48     	if(Sum - idsum != 2486081)
00004c  1a08              SUBS     r0,r1,r0
00004e  4907              LDR      r1,|L3.108|
000050  4288              CMP      r0,r1
000052  d008              BEQ      |L3.102|
;;;49     	{
;;;50     		Uart_Printf(COM1, "ID未注册 %08X %08X %08X\r\n",*(__I uint32_t *)(0x1FFF7A10 + 0x00),*(__I uint32_t *)(0x1FFF7A10 + 0x04),*(__I uint32_t *)(0x1FFF7A10 + 0x08));//串口打印ID号
000054  6820              LDR      r0,[r4,#0]
000056  9000              STR      r0,[sp,#0]
000058  681b              LDR      r3,[r3,#0]
00005a  6812              LDR      r2,[r2,#0]
00005c  a104              ADR      r1,|L3.112|
00005e  2001              MOVS     r0,#1
000060  f7fffffe          BL       Uart_Printf
                  |L3.100|
;;;51     		while(1)
000064  e7fe              B        |L3.100|
                  |L3.102|
;;;52     		{
;;;53     			
;;;54     		}
;;;55     	}
;;;56     }
000066  bd7f              POP      {r0-r6,pc}
;;;57     
                          ENDP

                  |L3.104|
                          DCD      0x1fff7a10
                  |L3.108|
                          DCD      0x0025ef41
                  |L3.112|
000070  4944ceb4          DCB      "ID",206,180,215,162,178,225," %08X %08X %08X\r\n",0
000074  d7a2b2e1
000078  20253038
00007c  58202530
000080  38582025
000084  3038580d
000088  0a00    
00008a  00                DCB      0
00008b  00                DCB      0

                          AREA ||i.bsp_DelayMS||, CODE, READONLY, ALIGN=1

                  bsp_DelayMS PROC
;;;102    */
;;;103    void bsp_DelayMS(uint32_t _ulDelayTime)
000000  f44f717a          MOV      r1,#0x3e8
;;;104    {
;;;105    	bsp_DelayUS(1000*_ulDelayTime);
000004  4348              MULS     r0,r1,r0
000006  f7ffbffe          B.W      bsp_DelayUS
;;;106    }
;;;107    
                          ENDP


                          AREA ||i.bsp_DelayUS||, CODE, READONLY, ALIGN=2

                  bsp_DelayUS PROC
;;;144    */
;;;145    void bsp_DelayUS(uint32_t _ulDelayTime)
000000  b570              PUSH     {r4-r6,lr}
;;;146    {
000002  4606              MOV      r6,r0
;;;147        uint32_t tCnt, tDelayCnt;
;;;148    	uint32_t tStart;
;;;149    		
;;;150    	tStart = (uint32_t)CPU_TS_TmrRd();                       /* 刚进入时的计数器值 */
000004  f7fffffe          BL       CPU_TS_TmrRd
000008  4605              MOV      r5,r0
;;;151    	tCnt = 0;
00000a  2000              MOVS     r0,#0
;;;152    	tDelayCnt = _ulDelayTime * (SystemCoreClock / 1000000);	 /* 需要的节拍数 */ 		      
00000c  4906              LDR      r1,|L5.40|
00000e  4a07              LDR      r2,|L5.44|
000010  6809              LDR      r1,[r1,#0]  ; SystemCoreClock
000012  fbb1f4f2          UDIV     r4,r1,r2
000016  4374              MULS     r4,r6,r4
;;;153    
;;;154    	while(tCnt < tDelayCnt)
000018  e002              B        |L5.32|
                  |L5.26|
;;;155    	{
;;;156    		tCnt = (uint32_t)CPU_TS_TmrRd() - tStart; /* 求减过程中,如果发生第一次32位计数器重新计数,依然可以正确计算 */	
00001a  f7fffffe          BL       CPU_TS_TmrRd
00001e  1b40              SUBS     r0,r0,r5
                  |L5.32|
000020  42a0              CMP      r0,r4                 ;154
000022  d3fa              BCC      |L5.26|
;;;157    	}
;;;158    }
000024  bd70              POP      {r4-r6,pc}
;;;159    
                          ENDP

000026  0000              DCW      0x0000
                  |L5.40|
                          DCD      SystemCoreClock
                  |L5.44|
                          DCD      0x000f4240

                          AREA ||i.bsp_Init||, CODE, READONLY, ALIGN=2

                  bsp_Init PROC
;;;70     int InitFlag = 0;
;;;71     void bsp_Init(void)
000000  b538              PUSH     {r3-r5,lr}
;;;72     {
;;;73     	InitFlag = 1;
000002  4915              LDR      r1,|L6.88|
000004  2001              MOVS     r0,#1
000006  6008              STR      r0,[r1,#0]  ; InitFlag
;;;74     	//系统数据初始化
;;;75     	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
000008  f44f7040          MOV      r0,#0x300
00000c  f7fffffe          BL       NVIC_PriorityGroupConfig
;;;76     	bsp_InitUart();
000010  f7fffffe          BL       bsp_InitUart
;;;77     
;;;78     	vBkpSramInit();
000014  f7fffffe          BL       vBkpSramInit
;;;79     	EXTIX_Init();	
000018  f7fffffe          BL       EXTIX_Init
;;;80     
;;;81     		CAN1_Init(12);
00001c  200c              MOVS     r0,#0xc
00001e  f7fffffe          BL       CAN1_Init
;;;82      
;;;83     		CAN2_Init(12);
000022  200c              MOVS     r0,#0xc
000024  f7fffffe          BL       CAN2_Init
;;;84     
;;;85     	
;;;86     	TIM3_Int_Init(65535,42000-1);//除以2000.0f得到时间单位为秒
000028  f24a440f          MOV      r4,#0xa40f
00002c  f64f75ff          MOV      r5,#0xffff
000030  4621              MOV      r1,r4
000032  4628              MOV      r0,r5
000034  f7fffffe          BL       TIM3_Int_Init
;;;87     	TIM7_Int_Init(65535,42000-1);
000038  4621              MOV      r1,r4
00003a  4628              MOV      r0,r5
00003c  f7fffffe          BL       TIM7_Int_Init
;;;88     
;;;89     		eMBInit(MB_RTU, 0x01, 1, 115200, MB_PAR_NONE);  
000040  2000              MOVS     r0,#0
000042  2201              MOVS     r2,#1
000044  f44f33e1          MOV      r3,#0x1c200
000048  4611              MOV      r1,r2
00004a  9000              STR      r0,[sp,#0]
00004c  f7fffffe          BL       eMBInit
;;;90     		eMBEnable();
000050  e8bd4038          POP      {r3-r5,lr}
000054  f7ffbffe          B.W      eMBEnable
;;;91     
;;;92     }
;;;93     
                          ENDP

                  |L6.88|
                          DCD      ||.data||

                          AREA ||.data||, DATA, ALIGN=2

                  InitFlag
                          DCD      0x00000000

;*** Start embedded assembler ***

#line 1 "..\\..\\User\\bsp\\bsp.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___5_bsp_c_16c45322____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___5_bsp_c_16c45322____REV16| PROC
#line 130

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___5_bsp_c_16c45322____REVSH|
#line 144
|__asm___5_bsp_c_16c45322____REVSH| PROC
#line 145

 revsh r0, r0
 bx lr
	ENDP
	AREA ||.rrx_text||, CODE
	THUMB
	EXPORT |__asm___5_bsp_c_16c45322____RRX|
#line 300
|__asm___5_bsp_c_16c45322____RRX| PROC
#line 301

 rrx r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***