user.txt
17.3 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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
; 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\user.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\user.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\user.crf ..\..\User\bsp\BSP\user.c]
THUMB
AREA ||i.PowerOff_ClearConstFlash||, CODE, READONLY, ALIGN=2
PowerOff_ClearConstFlash PROC
;;;48 //清除系统参数
;;;49 void PowerOff_ClearConstFlash()
000000 b510 PUSH {r4,lr}
;;;50 {
;;;51 __set_PRIMASK(1); /* 关中断 */
000002 2001 MOVS r0,#1
000004 f3808810 MSR PRIMASK,r0
;;;52 FLASH_Unlock();
000008 f7fffffe BL FLASH_Unlock
;;;53 FLASH_EraseSector(bsp_GetSector(FLASH_CONST_DATA_SAVE_ADDRESS),VoltageRange_3);
00000c 4805 LDR r0,|L1.36|
00000e f7fffffe BL bsp_GetSector
000012 2102 MOVS r1,#2
000014 f7fffffe BL FLASH_EraseSector
;;;54 FLASH_Lock();
000018 f7fffffe BL FLASH_Lock
;;;55 __set_PRIMASK(0); /* 开中断 */
00001c 2000 MOVS r0,#0
00001e f3808810 MSR PRIMASK,r0
;;;56 }
000022 bd10 POP {r4,pc}
;;;57
ENDP
|L1.36|
DCD 0x080c0000
AREA ||i.PowerOff_HeadInfo_WriteInfo||, CODE, READONLY, ALIGN=1
PowerOff_HeadInfo_WriteInfo PROC
;;;57
;;;58 void PowerOff_HeadInfo_WriteInfo(unsigned long startAddress,unsigned long len,unsigned long checkSum)
000000 b570 PUSH {r4-r6,lr}
;;;59 {
000002 4604 MOV r4,r0
000004 460e MOV r6,r1
000006 4615 MOV r5,r2
;;;60 FLASH_Unlock();
000008 f7fffffe BL FLASH_Unlock
;;;61 FLASH_ProgramWord(startAddress+0, len);
00000c 4631 MOV r1,r6
00000e 4620 MOV r0,r4
000010 f7fffffe BL FLASH_ProgramWord
;;;62 FLASH_ProgramWord(startAddress+4, checkSum);
000014 4629 MOV r1,r5
000016 1d20 ADDS r0,r4,#4
000018 f7fffffe BL FLASH_ProgramWord
;;;63 FLASH_Lock();
00001c e8bd4070 POP {r4-r6,lr}
000020 f7ffbffe B.W FLASH_Lock
;;;64 }
;;;65
ENDP
AREA ||i.PowerOn_ReadFlash_ConstData||, CODE, READONLY, ALIGN=2
PowerOn_ReadFlash_ConstData PROC
;;;65
;;;66 unsigned char PowerOn_ReadFlash_ConstData()//读取系统参数
000000 b510 PUSH {r4,lr}
;;;67 {
;;;68 unsigned long i;
;;;69 unsigned long CheckSum = 0;
000002 2100 MOVS r1,#0
;;;70 unsigned long address;
;;;71 unsigned long *pFlash;
;;;72
;;;73 pFlash = (unsigned long*)FLASH_CONST_DATA_SAVE_ADDRESS;
000004 4a0e LDR r2,|L3.64|
;;;74
;;;75 if(pFlash[0] > 0x4000)
000006 6810 LDR r0,[r2,#0]
000008 f5b04f80 CMP r0,#0x4000
00000c d901 BLS |L3.18|
;;;76 {
;;;77 return 0;
00000e 2000 MOVS r0,#0
;;;78 }
;;;79
;;;80 for(i = 0; i < pFlash[0]/4; i++)
;;;81 {
;;;82 CheckSum ^= pFlash[2+i];
;;;83 }
;;;84
;;;85 if(CheckSum != pFlash[1])
;;;86 {
;;;87 return 0;
;;;88 }
;;;89
;;;90 address = FLASH_CONST_DATA_SAVE_ADDRESS + 8;
;;;91 address = SystemInfo_ReadFlash(address);
;;;92
;;;93 return 1;
;;;94 }
000010 bd10 POP {r4,pc}
|L3.18|
000012 2000 MOVS r0,#0 ;80
000014 6814 LDR r4,[r2,#0] ;80
000016 e004 B |L3.34|
|L3.24|
000018 1c83 ADDS r3,r0,#2 ;82
00001a f8523023 LDR r3,[r2,r3,LSL #2] ;82
00001e 4059 EORS r1,r1,r3 ;82
000020 1c40 ADDS r0,r0,#1 ;80
|L3.34|
000022 ebb00f94 CMP r0,r4,LSR #2 ;80
000026 d3f7 BCC |L3.24|
000028 6850 LDR r0,[r2,#4] ;85
00002a 4288 CMP r0,r1 ;85
00002c d001 BEQ |L3.50|
00002e 2000 MOVS r0,#0 ;87
000030 bd10 POP {r4,pc}
|L3.50|
000032 4803 LDR r0,|L3.64|
000034 3008 ADDS r0,r0,#8 ;90
000036 f7fffffe BL SystemInfo_ReadFlash
00003a 2001 MOVS r0,#1 ;93
00003c bd10 POP {r4,pc}
;;;95
ENDP
00003e 0000 DCW 0x0000
|L3.64|
DCD 0x080c0000
AREA ||i.PowerOn_WriteFlash_ConstData||, CODE, READONLY, ALIGN=2
PowerOn_WriteFlash_ConstData PROC
;;;95
;;;96 void PowerOn_WriteFlash_ConstData()//写系统FLASH
000000 b508 PUSH {r3,lr}
;;;97 {
;;;98 unsigned long CheckSum = 0;
000002 2000 MOVS r0,#0
000004 9000 STR r0,[sp,#0]
;;;99 unsigned long address;
;;;100
;;;101 address = FLASH_CONST_DATA_SAVE_ADDRESS + 8;
000006 4806 LDR r0,|L4.32|
;;;102 address = SystemInfo_WriteFlash(address,&CheckSum);
000008 4669 MOV r1,sp
00000a f7fffffe BL SystemInfo_WriteFlash
;;;103 address -= FLASH_CONST_DATA_SAVE_ADDRESS;
00000e 4905 LDR r1,|L4.36|
000010 4401 ADD r1,r1,r0
;;;104 address -= 8;
000012 3908 SUBS r1,r1,#8
;;;105 PowerOff_HeadInfo_WriteInfo(FLASH_CONST_DATA_SAVE_ADDRESS,address,CheckSum);
000014 4802 LDR r0,|L4.32|
000016 9a00 LDR r2,[sp,#0]
000018 3808 SUBS r0,r0,#8
00001a f7fffffe BL PowerOff_HeadInfo_WriteInfo
;;;106 }
00001e bd08 POP {r3,pc}
;;;107
ENDP
|L4.32|
DCD 0x080c0008
|L4.36|
DCD 0xf7f40000
AREA ||i.ProccessSetupInfo||, CODE, READONLY, ALIGN=2
ProccessSetupInfo PROC
;;;115
;;;116 void ProccessSetupInfo(u8 Res)
000000 b570 PUSH {r4-r6,lr}
;;;117 {
;;;118 static char Buffer[120];
;;;119 static u16 iii = 0;
;;;120
;;;121 if(iii > 100)
000002 4c0b LDR r4,|L5.48|
000004 2500 MOVS r5,#0
000006 8821 LDRH r1,[r4,#0] ; iii
000008 2964 CMP r1,#0x64
00000a d900 BLS |L5.14|
;;;122 {
;;;123 iii = 0;
00000c 8025 STRH r5,[r4,#0]
|L5.14|
;;;124 }
;;;125 if(Res == 0x24) // $
00000e 2824 CMP r0,#0x24
000010 d100 BNE |L5.20|
;;;126 {
;;;127 iii = 0;
000012 8025 STRH r5,[r4,#0]
|L5.20|
;;;128 }
;;;129 Buffer[iii++] = Res;
000014 8822 LDRH r2,[r4,#0] ; iii
000016 4b07 LDR r3,|L5.52|
000018 1c51 ADDS r1,r2,#1
00001a b289 UXTH r1,r1
00001c 8021 STRH r1,[r4,#0]
00001e 5498 STRB r0,[r3,r2]
;;;130 if(Res == 0x23) // #
000020 2823 CMP r0,#0x23
000022 d103 BNE |L5.44|
;;;131 {
;;;132 proccessSetupInfo((u8 *)Buffer,iii);
000024 4618 MOV r0,r3
000026 f7fffffe BL proccessSetupInfo
;;;133 iii = 0;
00002a 8025 STRH r5,[r4,#0]
|L5.44|
;;;134 }
;;;135 }
00002c bd70 POP {r4-r6,pc}
;;;136
ENDP
00002e 0000 DCW 0x0000
|L5.48|
DCD ||.data||
|L5.52|
DCD ||.bss||
AREA ||i.SystemInfo_ReadFlash||, CODE, READONLY, ALIGN=2
SystemInfo_ReadFlash PROC
;;;32 //从FLASH读取系统信息
;;;33 unsigned long SystemInfo_ReadFlash(unsigned long startAddress)
000000 b530 PUSH {r4,r5,lr}
;;;34 {
;;;35 unsigned long i;
;;;36 unsigned long *pData;
;;;37 unsigned long *pFlash;
;;;38
;;;39 pFlash = (unsigned long*)(startAddress);
000002 4602 MOV r2,r0
;;;40 pData = (unsigned long*)(&sysInfoUnion);
000004 4b06 LDR r3,|L6.32|
;;;41 for(i = 0; i < sizeof(SystemInfoUnion)/4; i++)
000006 2100 MOVS r1,#0
000008 f44f7596 MOV r5,#0x12c
|L6.12|
;;;42 {
;;;43 pData[i] = pFlash[i];
00000c f8524021 LDR r4,[r2,r1,LSL #2]
000010 f8434021 STR r4,[r3,r1,LSL #2]
000014 1c49 ADDS r1,r1,#1 ;41
000016 42a9 CMP r1,r5 ;41
000018 d9f8 BLS |L6.12|
;;;44 }
;;;45 return startAddress + sizeof(SystemInfoUnion);
00001a f20040b4 ADD r0,r0,#0x4b4
;;;46 }
00001e bd30 POP {r4,r5,pc}
;;;47
ENDP
|L6.32|
DCD ||.bss||+0x78
AREA ||i.SystemInfo_WriteFlash||, CODE, READONLY, ALIGN=2
SystemInfo_WriteFlash PROC
;;;11 //校验结果更新到CheckSum
;;;12 unsigned long SystemInfo_WriteFlash(unsigned long startAddress,unsigned long *CheckSum)
000000 e92d47f0 PUSH {r4-r10,lr}
;;;13 {
000004 4680 MOV r8,r0
000006 460f MOV r7,r1
;;;14 unsigned long i;
;;;15 unsigned long address;
;;;16 unsigned long *pData;
;;;17
;;;18 FLASH_Unlock();
000008 f7fffffe BL FLASH_Unlock
;;;19
;;;20 address = 0;
00000c 2500 MOVS r5,#0
;;;21 pData = (unsigned long*)(&sysInfoUnion);
00000e 4e0c LDR r6,|L7.64|
;;;22 for(i = 0; i < sizeof(SystemInfoUnion)/4; address+=4,i++)
000010 2400 MOVS r4,#0
000012 f44f7996 MOV r9,#0x12c
|L7.22|
;;;23 {
;;;24 FLASH_ProgramWord(startAddress+address, pData[i]);
000016 f8561024 LDR r1,[r6,r4,LSL #2]
00001a eb080005 ADD r0,r8,r5
00001e f7fffffe BL FLASH_ProgramWord
;;;25 *CheckSum ^= pData[i];
000022 f8561024 LDR r1,[r6,r4,LSL #2]
000026 6838 LDR r0,[r7,#0]
000028 4048 EORS r0,r0,r1
00002a 6038 STR r0,[r7,#0]
00002c 1d2d ADDS r5,r5,#4 ;22
00002e 1c64 ADDS r4,r4,#1 ;22
000030 454c CMP r4,r9 ;22
000032 d9f0 BLS |L7.22|
;;;26 }
;;;27
;;;28 FLASH_Lock();
000034 f7fffffe BL FLASH_Lock
;;;29 return startAddress + address;
000038 eb080005 ADD r0,r8,r5
;;;30 }
00003c e8bd87f0 POP {r4-r10,pc}
;;;31
ENDP
|L7.64|
DCD ||.bss||+0x78
AREA ||i.initFactoryParam||, CODE, READONLY, ALIGN=2
initFactoryParam PROC
;;;136
;;;137 void initFactoryParam()
000000 b538 PUSH {r3-r5,lr}
;;;138 {
;;;139 initSetup(sysInfoUnion.systemInfo.SystemParameter,FACTORYPARAMNUM);//设置参数
000002 f44f7196 MOV r1,#0x12c
000006 480d LDR r0,|L8.60|
000008 f7fffffe BL initSetup
;;;140 PowerOn_ReadFlash_ConstData();
00000c f7fffffe BL PowerOn_ReadFlash_ConstData
;;;141 while(1)
;;;142 {
;;;143 static int countTime = 0;
;;;144 u8 buff;
;;;145 if(ReadUart(COM1,&buff,1))
;;;146 {
;;;147 ProccessSetupInfo(buff);
;;;148 }
;;;149 bsp_DelayMS(1);
;;;150
;;;151 if(countTime++ > 5000)
000010 4c0b LDR r4,|L8.64|
000012 f2413588 MOV r5,#0x1388
|L8.22|
000016 2201 MOVS r2,#1 ;145
000018 4669 MOV r1,sp ;145
00001a 4610 MOV r0,r2 ;145
00001c f7fffffe BL ReadUart
000020 b118 CBZ r0,|L8.42|
000022 f89d0000 LDRB r0,[sp,#0] ;147
000026 f7fffffe BL ProccessSetupInfo
|L8.42|
00002a 2001 MOVS r0,#1 ;149
00002c f7fffffe BL bsp_DelayMS
000030 6860 LDR r0,[r4,#4] ; countTime
000032 1c41 ADDS r1,r0,#1
000034 6061 STR r1,[r4,#4] ; countTime
000036 42a8 CMP r0,r5
000038 dded BLE |L8.22|
;;;152 {
;;;153 break;
;;;154 }
;;;155 }
;;;156 }
00003a bd38 POP {r3-r5,pc}
;;;157
ENDP
|L8.60|
DCD ||.bss||+0x78
|L8.64|
DCD ||.data||
AREA ||i.proccessSetupInfo||, CODE, READONLY, ALIGN=2
proccessSetupInfo PROC
;;;107
;;;108 void proccessSetupInfo(u8 *RecvBuffer,u16 BufferLength)
000000 b510 PUSH {r4,lr}
;;;109 {
;;;110 if(strncmp("$para", (const char*)RecvBuffer, 5) == 0)//地标动作命令
000002 4601 MOV r1,r0
000004 2205 MOVS r2,#5
000006 a005 ADR r0,|L9.28|
000008 f7fffffe BL strncmp
00000c 2800 CMP r0,#0
00000e d103 BNE |L9.24|
;;;111 {
;;;112 Setup_Process();
000010 e8bd4010 POP {r4,lr}
000014 f7ffbffe B.W Setup_Process
|L9.24|
;;;113 }
;;;114 }
000018 bd10 POP {r4,pc}
;;;115
ENDP
00001a 0000 DCW 0x0000
|L9.28|
00001c 24706172 DCB "$$para",0
000020 6100
000022 00 DCB 0
000023 00 DCB 0
AREA ||.bss||, DATA, NOINIT, ALIGN=2
Buffer
% 120
sysInfoUnion
% 1204
AREA ||.data||, DATA, ALIGN=2
iii
000000 0000 DCW 0x0000
000002 0000 DCB 0x00,0x00
countTime
DCD 0x00000000
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\bsp\\BSP\\user.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___6_user_c_5a2af7ae____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___6_user_c_5a2af7ae____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___6_user_c_5a2af7ae____REVSH|
#line 144
|__asm___6_user_c_5a2af7ae____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___6_user_c_5a2af7ae____RRX|
#line 300
|__asm___6_user_c_5a2af7ae____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***