bsp_wwdg.txt
10.7 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
; 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_wwdg.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\bsp_wwdg.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_wwdg.crf ..\..\User\bsp\BSP\bsp_wwdg.c]
THUMB
AREA ||i.FeedDog||, CODE, READONLY, ALIGN=2
FeedDog PROC
;;;83
;;;84 void FeedDog(void)
000000 4807 LDR r0,|L1.32|
;;;85 {
;;;86 if((WWDG->CR&0X7F)<(WWDG->CFR&0X7F)) // 计数器值tr必须小于窗口值wr时才能喂狗,在之前喂狗则太早,会产生看门狗复位
000002 6800 LDR r0,[r0,#0]
000004 4906 LDR r1,|L1.32|
000006 f000007f AND r0,r0,#0x7f
00000a 1d09 ADDS r1,r1,#4
00000c 6809 LDR r1,[r1,#0]
00000e f001017f AND r1,r1,#0x7f
000012 4288 CMP r0,r1
000014 d202 BCS |L1.28|
;;;87 {
;;;88 WWDG_SetCounter(0X7F);
000016 207f MOVS r0,#0x7f
000018 f7ffbffe B.W WWDG_SetCounter
|L1.28|
;;;89 }
;;;90 }
00001c 4770 BX lr
;;;91
ENDP
00001e 0000 DCW 0x0000
|L1.32|
DCD 0x40002c00
AREA ||i.WWDG_IRQHandler||, CODE, READONLY, ALIGN=2
WWDG_IRQHandler PROC
;;;60 //窗口看门狗中断服务程序
;;;61 void WWDG_IRQHandler(void)
000000 b570 PUSH {r4-r6,lr}
;;;62 {
;;;63 static u8 Count = 0;
;;;64
;;;65 WWDG_SetCounter(0x7f); //重设窗口看门狗值
000002 207f MOVS r0,#0x7f
000004 f7fffffe BL WWDG_SetCounter
;;;66 WWDG_ClearFlag(); //清除提前唤醒中断标志位
000008 f7fffffe BL WWDG_ClearFlag
;;;67
;;;68 Count += 1;
00000c 4921 LDR r1,|L2.148|
00000e 7848 LDRB r0,[r1,#1] ; Count
000010 1c40 ADDS r0,r0,#1
000012 b2c0 UXTB r0,r0
000014 7048 STRB r0,[r1,#1]
;;;69 if(Count > 1)return;
000016 2801 CMP r0,#1
000018 d83b BHI |L2.146|
;;;70
;;;71
;;;72 USART_ITConfig(USART6, USART_IT_RXNE, DISABLE);
00001a 4e1f LDR r6,|L2.152|
00001c f2405525 MOV r5,#0x525
000020 2200 MOVS r2,#0
000022 4629 MOV r1,r5
000024 4630 MOV r0,r6
000026 f7fffffe BL USART_ITConfig
;;;73 USART_ITConfig(USART6, USART_IT_TXE, DISABLE);
00002a f2407427 MOV r4,#0x727
00002e 2200 MOVS r2,#0
000030 4621 MOV r1,r4
000032 4630 MOV r0,r6
000034 f7fffffe BL USART_ITConfig
;;;74 USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
000038 4e18 LDR r6,|L2.156|
00003a 2200 MOVS r2,#0
00003c 4629 MOV r1,r5
00003e 4630 MOV r0,r6
000040 f7fffffe BL USART_ITConfig
;;;75 USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
000044 2200 MOVS r2,#0
000046 4621 MOV r1,r4
000048 4630 MOV r0,r6
00004a f7fffffe BL USART_ITConfig
;;;76 USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);
00004e 4e14 LDR r6,|L2.160|
000050 2200 MOVS r2,#0
000052 4629 MOV r1,r5
000054 4630 MOV r0,r6
000056 f7fffffe BL USART_ITConfig
;;;77 USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
00005a 2200 MOVS r2,#0
00005c 4621 MOV r1,r4
00005e 4630 MOV r0,r6
000060 f7fffffe BL USART_ITConfig
;;;78 USART_ITConfig(USART3, USART_IT_RXNE, DISABLE);
000064 4629 MOV r1,r5
000066 4d0f LDR r5,|L2.164|
000068 2200 MOVS r2,#0
00006a 4628 MOV r0,r5
00006c f7fffffe BL USART_ITConfig
;;;79 USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
000070 2200 MOVS r2,#0
000072 4621 MOV r1,r4
000074 4628 MOV r0,r5
000076 f7fffffe BL USART_ITConfig
00007a f3bf8f4f DSB
00007e 480a LDR r0,|L2.168|
000080 6801 LDR r1,[r0,#0]
000082 4a0a LDR r2,|L2.172|
000084 f40161e0 AND r1,r1,#0x700
000088 4311 ORRS r1,r1,r2
00008a 6001 STR r1,[r0,#0]
00008c f3bf8f4f DSB
|L2.144|
000090 e7fe B |L2.144|
|L2.146|
;;;80
;;;81 NVIC_SystemReset();
;;;82 }
000092 bd70 POP {r4-r6,pc}
;;;83
ENDP
|L2.148|
DCD ||.data||
|L2.152|
DCD 0x40011400
|L2.156|
DCD 0x40011000
|L2.160|
DCD 0x40004400
|L2.164|
DCD 0x40004800
|L2.168|
DCD 0xe000ed0c
|L2.172|
DCD 0x05fa0004
AREA ||i.WWDG_Init||, CODE, READONLY, ALIGN=2
WWDG_Init PROC
;;;37
;;;38 void WWDG_Init(u8 tr,u8 wr,u32 fprer)
000000 b5f8 PUSH {r3-r7,lr}
;;;39 {
000002 4605 MOV r5,r0
000004 460e MOV r6,r1
000006 4617 MOV r7,r2
;;;40 NVIC_InitTypeDef NVIC_InitStructure;
;;;41
;;;42 RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG,ENABLE); //使能窗口看门狗时钟
000008 2101 MOVS r1,#1
00000a 02c8 LSLS r0,r1,#11
00000c f7fffffe BL RCC_APB1PeriphClockCmd
;;;43
;;;44 WWDG_CNT=tr&WWDG_CNT; //初始化WWDG_CNT.
000010 4c0f LDR r4,|L3.80|
000012 7820 LDRB r0,[r4,#0] ; WWDG_CNT
000014 4005 ANDS r5,r5,r0
000016 7025 STRB r5,[r4,#0]
;;;45 WWDG_SetPrescaler(fprer); //设置分频值
000018 4638 MOV r0,r7
00001a f7fffffe BL WWDG_SetPrescaler
;;;46 WWDG_SetWindowValue(wr); //设置窗口值
00001e 4630 MOV r0,r6
000020 f7fffffe BL WWDG_SetWindowValue
;;;47 // WWDG_SetCounter(WWDG_CNT);//设置计数值
;;;48 WWDG_Enable(WWDG_CNT); //开启看门狗
000024 7820 LDRB r0,[r4,#0] ; WWDG_CNT
000026 f7fffffe BL WWDG_Enable
;;;49
;;;50 NVIC_InitStructure.NVIC_IRQChannel=WWDG_IRQn; //窗口看门狗中断
00002a 2000 MOVS r0,#0
00002c f88d0000 STRB r0,[sp,#0]
;;;51 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0; //抢占优先级为2
000030 f88d0001 STRB r0,[sp,#1]
;;;52 NVIC_InitStructure.NVIC_IRQChannelSubPriority=0; //子优先级为3
000034 f88d0002 STRB r0,[sp,#2]
;;;53 NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE; //使能窗口看门狗
000038 2001 MOVS r0,#1
00003a f88d0003 STRB r0,[sp,#3]
;;;54 NVIC_Init(&NVIC_InitStructure);
00003e 4668 MOV r0,sp
000040 f7fffffe BL NVIC_Init
;;;55
;;;56 WWDG_ClearFlag();//清除提前唤醒中断标志位
000044 f7fffffe BL WWDG_ClearFlag
;;;57 WWDG_EnableIT();//开启提前唤醒中断
000048 f7fffffe BL WWDG_EnableIT
;;;58 }
00004c bdf8 POP {r3-r7,pc}
;;;59
ENDP
00004e 0000 DCW 0x0000
|L3.80|
DCD ||.data||
AREA ||i.bsp_InitWWDG||, CODE, READONLY, ALIGN=1
bsp_InitWWDG PROC
;;;91
;;;92 void bsp_InitWWDG(void)
000000 217e MOVS r1,#0x7e
;;;93 {
;;;94 WWDG_Init(0x7F,0X7E,WWDG_Prescaler_8); //计数器值为7f,窗口寄存器为5f,分频数为8
000002 f44f72c0 MOV r2,#0x180
000006 207f MOVS r0,#0x7f
000008 f7ffbffe B.W WWDG_Init
;;;95 }
;;;96
ENDP
AREA ||.data||, DATA, ALIGN=0
WWDG_CNT
000000 7f DCB 0x7f
Count
000001 00 DCB 0x00
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\bsp\\BSP\\bsp_wwdg.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___10_bsp_wwdg_c_WWDG_CNT____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___10_bsp_wwdg_c_WWDG_CNT____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___10_bsp_wwdg_c_WWDG_CNT____REVSH|
#line 144
|__asm___10_bsp_wwdg_c_WWDG_CNT____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___10_bsp_wwdg_c_WWDG_CNT____RRX|
#line 300
|__asm___10_bsp_wwdg_c_WWDG_CNT____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***