bsp_exti.txt
16.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
; 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_exti.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\bsp_exti.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_exti.crf ..\..\User\bsp\BSP\bsp_exti.c]
THUMB
AREA ||i.BackupSRAM_ReadData||, CODE, READONLY, ALIGN=2
BackupSRAM_ReadData PROC
;;;120 // 从备份RAM中读出数据
;;;121 u16 BackupSRAM_ReadData(u16 AddrOffset, u8 *pData, u16 DataLen)
000000 b570 PUSH {r4-r6,lr}
;;;122 {
000002 4603 MOV r3,r0
000004 460d MOV r5,r1
;;;123 u32 len;
;;;124
;;;125 if(pData==NULL) return 0;
000006 2d00 CMP r5,#0
000008 d006 BEQ |L1.24|
;;;126 if(DataLen==0) return 0;
00000a b13a CBZ r2,|L1.28|
;;;127 if(AddrOffset >= BACKUP_SRAM_SIZE) return 0;
00000c f44f5180 MOV r1,#0x1000
000010 428b CMP r3,r1
000012 d305 BCC |L1.32|
000014 2000 MOVS r0,#0
;;;128 len = AddrOffset + DataLen;
;;;129 if(len > BACKUP_SRAM_SIZE) len = BACKUP_SRAM_SIZE;
;;;130 len -= AddrOffset;
;;;131 DataLen = len;
;;;132 memcpy(pData, (u8 *)BKPSRAM_BASE+AddrOffset, DataLen);
;;;133
;;;134 return len;
;;;135 }
000016 bd70 POP {r4-r6,pc}
|L1.24|
000018 2000 MOVS r0,#0 ;125
00001a bd70 POP {r4-r6,pc}
|L1.28|
00001c 2000 MOVS r0,#0 ;126
00001e bd70 POP {r4-r6,pc}
|L1.32|
000020 1898 ADDS r0,r3,r2 ;128
000022 4288 CMP r0,r1 ;129
000024 d900 BLS |L1.40|
000026 4608 MOV r0,r1 ;129
|L1.40|
000028 1ac4 SUBS r4,r0,r3 ;130
00002a b2a2 UXTH r2,r4 ;131
00002c 4803 LDR r0,|L1.60|
00002e 1819 ADDS r1,r3,r0 ;132
000030 4628 MOV r0,r5 ;132
000032 f7fffffe BL __aeabi_memcpy
000036 b2a0 UXTH r0,r4 ;134
000038 bd70 POP {r4-r6,pc}
;;;136
ENDP
00003a 0000 DCW 0x0000
|L1.60|
DCD 0x40024000
AREA ||i.BackupSRAM_WriteData||, CODE, READONLY, ALIGN=2
BackupSRAM_WriteData PROC
;;;102 // 写入数据到备份RAM中
;;;103 u16 BackupSRAM_WriteData(u16 AddrOffset, u8 *pData, u16 DataLen)
000000 b510 PUSH {r4,lr}
;;;104 {
;;;105 u32 len;
;;;106
;;;107 if(pData==NULL) return 0;
000002 2900 CMP r1,#0
000004 d006 BEQ |L2.20|
;;;108 if(DataLen==0) return 0;
000006 b13a CBZ r2,|L2.24|
;;;109 if(AddrOffset >= BACKUP_SRAM_SIZE) return 0; // 起始地址有误
000008 f44f5380 MOV r3,#0x1000
00000c 4298 CMP r0,r3
00000e d305 BCC |L2.28|
000010 2000 MOVS r0,#0
;;;110 len = AddrOffset + DataLen;
;;;111 if(len > BACKUP_SRAM_SIZE) len = BACKUP_SRAM_SIZE;
;;;112 len -= AddrOffset; //写入的数据长度
;;;113 DataLen = len;
;;;114 //#define BKPSRAM_BASE ((uint32_t)0x40024000) /*!< Backup SRAM(4 KB) base address
;;;115 memcpy((u8 *)BKPSRAM_BASE+AddrOffset, pData, DataLen);
;;;116
;;;117 return len;
;;;118 }
000012 bd10 POP {r4,pc}
|L2.20|
000014 2000 MOVS r0,#0 ;107
000016 bd10 POP {r4,pc}
|L2.24|
000018 2000 MOVS r0,#0 ;108
00001a bd10 POP {r4,pc}
|L2.28|
00001c 4402 ADD r2,r2,r0 ;110
00001e 429a CMP r2,r3 ;111
000020 d900 BLS |L2.36|
000022 461a MOV r2,r3 ;111
|L2.36|
000024 1a14 SUBS r4,r2,r0 ;112
000026 b2a2 UXTH r2,r4 ;113
000028 4b02 LDR r3,|L2.52|
00002a 4418 ADD r0,r0,r3 ;115
00002c f7fffffe BL __aeabi_memcpy
000030 b2a0 UXTH r0,r4 ;117
000032 bd10 POP {r4,pc}
;;;119
ENDP
|L2.52|
DCD 0x40024000
AREA ||i.EXTI9_5_IRQHandler||, CODE, READONLY, ALIGN=2
EXTI9_5_IRQHandler PROC
;;;63
;;;64 void EXTI9_5_IRQHandler(void) // 掉电 中断函数 PB8-->对应 EXTI9_5_IRQHandler
000000 b510 PUSH {r4,lr}
;;;65 {
;;;66 // 添加电源掉电中断处理代码
;;;67 /** 相应代码 **/
;;;68 // BackupSRAM_WriteData(0,PowOffList.buffer,12);
;;;69 // BreakShortToTwoByte(usRegHoldingBuf,101,(char*)SaveUsRegHoldingBuf);
;;;70 // BackupSRAM_WriteData(0,SaveUsRegHoldingBuf,202);
;;;71 Uart_Printf(COM1,"<*****************开启保存\r\n");
000002 a105 ADR r1,|L3.24|
000004 2001 MOVS r0,#1
000006 f7fffffe BL Uart_Printf
;;;72
;;;73 // 最后一句代码
;;;74 EXTI_ClearITPendingBit(EXTI_Line8);//清除LINE8上的中断标志位
00000a e8bd4010 POP {r4,lr}
00000e f44f7080 MOV r0,#0x100
000012 f7ffbffe B.W EXTI_ClearITPendingBit
;;;75 }
;;;76
ENDP
000016 0000 DCW 0x0000
|L3.24|
000018 3c2a2a2a DCB "<*****************",191,170,198,244,177,163,180,230,"\r"
00001c 2a2a2a2a
000020 2a2a2a2a
000024 2a2a2a2a
000028 2a2abfaa
00002c c6f4b1a3
000030 b4e60d
000033 0a00 DCB "\n",0
000035 00 DCB 0
000036 00 DCB 0
000037 00 DCB 0
AREA ||i.EXTIX_Init||, CODE, READONLY, ALIGN=1
EXTIX_Init PROC
;;;33
;;;34 void EXTIX_Init(void) // 信号处理单元板CPU掉电检测脚PB8 外部中断设置
000000 b53e PUSH {r1-r5,lr}
;;;35 {
;;;36 NVIC_InitTypeDef NVIC_InitStructure;
;;;37 EXTI_InitTypeDef EXTI_InitStructure;
;;;38
;;;39 PowerFailInit(); //电源掉电管脚初始化
000002 f7fffffe BL PowerFailInit
;;;40
;;;41 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); //使能SYSCFG时钟
000006 2101 MOVS r1,#1
000008 0388 LSLS r0,r1,#14
00000a f7fffffe BL RCC_APB2PeriphClockCmd
;;;42
;;;43 SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource8);//PB8 连接到中断线8
00000e 2108 MOVS r1,#8
000010 2001 MOVS r0,#1
000012 f7fffffe BL SYSCFG_EXTILineConfig
;;;44
;;;45 /* 配置EXTI_Line8 */
;;;46 EXTI_InitStructure.EXTI_Line = EXTI_Line8;//LINE8
000016 f44f7080 MOV r0,#0x100
00001a 9000 STR r0,[sp,#0]
;;;47 EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;//中断事件
00001c 2500 MOVS r5,#0
00001e f88d5004 STRB r5,[sp,#4]
;;;48 //EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //上升沿触发 正常0 掉电时1
;;;49 EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; // 下降沿触发 正常 1 掉电0
000022 200c MOVS r0,#0xc
000024 f88d0005 STRB r0,[sp,#5]
;;;50 EXTI_InitStructure.EXTI_LineCmd = ENABLE;//使能LINE8
000028 2401 MOVS r4,#1
00002a f88d4006 STRB r4,[sp,#6]
;;;51 EXTI_Init(&EXTI_InitStructure);//配置
00002e 4668 MOV r0,sp
000030 f7fffffe BL EXTI_Init
;;;52
;;;53 NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;//外部中断 EXTI9_5_IRQHandler
000034 2017 MOVS r0,#0x17
000036 f88d0008 STRB r0,[sp,#8]
;;;54 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;//抢占优先级0
00003a f88d5009 STRB r5,[sp,#9]
;;;55 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;//子优先级2
00003e 2002 MOVS r0,#2
000040 f88d000a STRB r0,[sp,#0xa]
;;;56 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//使能外部中断通道
000044 f88d400b STRB r4,[sp,#0xb]
;;;57 NVIC_Init(&NVIC_InitStructure);//配置
000048 a802 ADD r0,sp,#8
00004a f7fffffe BL NVIC_Init
;;;58 }
00004e bd3e POP {r1-r5,pc}
;;;59
ENDP
AREA ||i.PowerFailInit||, CODE, READONLY, ALIGN=2
PowerFailInit PROC
;;;20 // AGV信号处理单元板电源掉电管脚初始化
;;;21 void PowerFailInit(void) // PB8--电源掉电检测 高--正常 低--掉电
000000 b51c PUSH {r2-r4,lr}
;;;22 {
;;;23 GPIO_InitTypeDef GPIO_InitStructure;
;;;24
;;;25 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); //使能GPIOB 时钟
000002 2101 MOVS r1,#1
000004 2002 MOVS r0,#2
000006 f7fffffe BL RCC_AHB1PeriphClockCmd
;;;26 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; //对应引脚
00000a f44f7080 MOV r0,#0x100
00000e 9000 STR r0,[sp,#0]
;;;27 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //普通输入模式
000010 2000 MOVS r0,#0
000012 f88d0004 STRB r0,[sp,#4]
;;;28 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //100M
000016 2003 MOVS r0,#3
000018 f88d0005 STRB r0,[sp,#5]
;;;29 // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
;;;30 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN ;//下拉 GPIO_PuPd_NOPULL
00001c 2002 MOVS r0,#2
00001e f88d0007 STRB r0,[sp,#7]
;;;31 GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化GPIOB8
000022 4669 MOV r1,sp
000024 4801 LDR r0,|L5.44|
000026 f7fffffe BL GPIO_Init
;;;32 }
00002a bd1c POP {r2-r4,pc}
;;;33
ENDP
|L5.44|
DCD 0x40020400
AREA ||i.agvReadLastCoo||, CODE, READONLY, ALIGN=2
agvReadLastCoo PROC
;;;136
;;;137 void agvReadLastCoo()
000000 b510 PUSH {r4,lr}
;;;138 {
;;;139 // memset(PowOffList.buffer,0,12);
;;;140 // BackupSRAM_ReadData(0,PowOffList.buffer,12);
;;;141 // Uart_Printf(COM1,"启动读取RAMx=%f y=%f w=%f\r\n",PowOffList.PowOffCoordinatePoints.xPoint,
;;;142 // PowOffList.PowOffCoordinatePoints.yPoint,PowOffList.PowOffCoordinatePoints.W);
;;;143 memset(SaveUsRegHoldingBuf,0,500);
000002 f44f71fa MOV r1,#0x1f4
000006 4807 LDR r0,|L6.36|
000008 f7fffffe BL __aeabi_memclr
;;;144 BackupSRAM_ReadData(0,SaveUsRegHoldingBuf,202);
00000c 22ca MOVS r2,#0xca
00000e 4905 LDR r1,|L6.36|
000010 2000 MOVS r0,#0
000012 f7fffffe BL BackupSRAM_ReadData
;;;145 // CombineTwoByteToOneShort(usRegHoldingBuf,101,(char*)SaveUsRegHoldingBuf);
;;;146 Uart_Printf(COM1,"启动读取\r\n");
000016 e8bd4010 POP {r4,lr}
00001a a103 ADR r1,|L6.40|
00001c 2001 MOVS r0,#1
00001e f7ffbffe B.W Uart_Printf
;;;147 }
;;;148
ENDP
000022 0000 DCW 0x0000
|L6.36|
DCD ||.bss||
|L6.40|
000028 c6f4b6af DCB 198,244,182,175,182,193,200,161,"\r\n",0
00002c b6c1c8a1
000030 0d0a00
000033 00 DCB 0
AREA ||i.vBkpSramInit||, CODE, READONLY, ALIGN=2
vBkpSramInit PROC
;;;86 */
;;;87 void vBkpSramInit(void) // 备份 RTC 4K SRAM初始化
000000 b510 PUSH {r4,lr}
;;;88 {
;;;89 /* 电源接口时钟使能(Power interface clock enable) */
;;;90 RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
000002 2101 MOVS r1,#1
000004 0708 LSLS r0,r1,#28
000006 f7fffffe BL RCC_APB1PeriphClockCmd
;;;91
;;;92 /* DBP 位置1 使能对备份域的访问 */
;;;93 PWR_BackupAccessCmd(ENABLE);
00000a 2001 MOVS r0,#1
00000c f7fffffe BL PWR_BackupAccessCmd
;;;94
;;;95 /* 通过将 RCC AHB1 外设时钟使能寄存器 (RCC_AHB1ENR) 中的 BKPSRAMEN 置 1, 使能备份 SRAM 时钟 */
;;;96 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE);
000010 2101 MOVS r1,#1
000012 0488 LSLS r0,r1,#18
000014 f7fffffe BL RCC_AHB1PeriphClockCmd
;;;97
;;;98 //while(PWR_GetFlagStatus(PWR_FLAG_BRR) != SET);
;;;99 PWR->CSR |= 0X0200; // 使能备份调压器,不开启会导致备份SRAM数据丢失!!
000018 4802 LDR r0,|L7.36|
00001a 6841 LDR r1,[r0,#4]
00001c f4417100 ORR r1,r1,#0x200
000020 6041 STR r1,[r0,#4]
;;;100 }
000022 bd10 POP {r4,pc}
;;;101
ENDP
|L7.36|
DCD 0x40007000
AREA ||.bss||, DATA, NOINIT, ALIGN=0
SaveUsRegHoldingBuf
% 500
AREA ||area_number.10||, DATA, NOINIT, ALIGN=2
EXPORTAS ||area_number.10||, ||.bss||
PowOffList
% 12
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\bsp\\BSP\\bsp_exti.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___10_bsp_exti_c_94b23d2e____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___10_bsp_exti_c_94b23d2e____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___10_bsp_exti_c_94b23d2e____REVSH|
#line 144
|__asm___10_bsp_exti_c_94b23d2e____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___10_bsp_exti_c_94b23d2e____RRX|
#line 300
|__asm___10_bsp_exti_c_94b23d2e____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***