diff --git a/app/Core/Src/main.c b/app/Core/Src/main.c
index 657a614..8946ca1 100644
--- a/app/Core/Src/main.c
+++ b/app/Core/Src/main.c
@@ -99,7 +99,8 @@ int main(void)
while (1)
{
/* USER CODE END WHILE */
-
+extern int umain(int argc, char const *argv[]) ;
+ umain(0,0);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
diff --git a/app/MDK-ARM/EventRecorderStub.scvd b/app/MDK-ARM/EventRecorderStub.scvd
new file mode 100644
index 0000000..2956b29
--- /dev/null
+++ b/app/MDK-ARM/EventRecorderStub.scvd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/MDK-ARM/app.uvprojx b/app/MDK-ARM/app.uvprojx
index 03e5372..c78c2c8 100644
--- a/app/MDK-ARM/app.uvprojx
+++ b/app/MDK-ARM/app.uvprojx
@@ -189,7 +189,7 @@
0
0
8
- 0
+ 1
0
0
0
@@ -313,7 +313,7 @@
1
- 2
+ 1
0
0
1
@@ -328,7 +328,7 @@
1
0
0
- 5
+ 3
3
1
1
@@ -746,8 +746,8 @@
-
-
+
+
diff --git a/app/MDK-ARM/startup_stm32f103xb.lst b/app/MDK-ARM/startup_stm32f103xb.lst
index c977121..d37afb9 100644
--- a/app/MDK-ARM/startup_stm32f103xb.lst
+++ b/app/MDK-ARM/startup_stm32f103xb.lst
@@ -214,9 +214,9 @@ ARM Macro Assembler Page 4
]
130 00000000 IMPORT __main
131 00000000 IMPORT SystemInit
- 132 00000000 4809 LDR R0, =SystemInit
+ 132 00000000 4806 LDR R0, =SystemInit
133 00000002 4780 BLX R0
- 134 00000004 4809 LDR R0, =__main
+ 134 00000004 4806 LDR R0, =__main
135 00000006 4700 BX R0
136 00000008 ENDP
137 00000008
@@ -442,42 +442,30 @@ ARM Macro Assembler Page 7
280 0000001C ;*******************************************************
************************
281 0000001C IF :DEF:__MICROLIB
- 288 0000001C
- 289 0000001C IMPORT __use_two_region_memory
- 290 0000001C EXPORT __user_initial_stackheap
- 291 0000001C
- 292 0000001C __user_initial_stackheap
- 293 0000001C
- 294 0000001C 4804 LDR R0, = Heap_Mem
- 295 0000001E 4905 LDR R1, =(Stack_Mem + Stack_Size)
- 296 00000020 4A05 LDR R2, = (Heap_Mem + Heap_Size)
- 297 00000022 4B06 LDR R3, = Stack_Mem
- 298 00000024 4770 BX LR
+ 282 0000001C
+ 283 0000001C EXPORT __initial_sp
+ 284 0000001C EXPORT __heap_base
+ 285 0000001C EXPORT __heap_limit
+ 286 0000001C
+ 287 0000001C ELSE
+ 302 ENDIF
+ 303 0000001C
+ 304 0000001C END
+ 00000000
+ 00000000
ARM Macro Assembler Page 8
- 299 00000026
- 300 00000026 00 00 ALIGN
- 301 00000028
- 302 00000028 ENDIF
- 303 00000028
- 304 00000028 END
- 00000000
- 00000000
- 00000000
- 00000400
- 00000200
- 00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
ork --depend=app\startup_stm32f103xb.d -oapp\startup_stm32f103xb.o -I.\RTE\_app
-IC:\Users\h_zha\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include -I
C:\Users\h_zha\AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.4.0\Device\Include
---predefine="__UVISION_VERSION SETA 535" --predefine="_RTE_ SETA 1" --predefine
-="STM32F10X_MD SETA 1" --predefine="_RTE_ SETA 1" --list=startup_stm32f103xb.ls
-t startup_stm32f103xb.s
+--predefine="__MICROLIB SETA 1" --predefine="__UVISION_VERSION SETA 535" --pred
+efine="_RTE_ SETA 1" --predefine="STM32F10X_MD SETA 1" --predefine="_RTE_ SETA
+1" --list=startup_stm32f103xb.lst startup_stm32f103xb.s
@@ -498,9 +486,8 @@ Symbol: Stack_Mem
Definitions
At line 35 in file startup_stm32f103xb.s
Uses
- At line 295 in file startup_stm32f103xb.s
- At line 297 in file startup_stm32f103xb.s
-
+ None
+Comment: Stack_Mem unused
__initial_sp 00000400
Symbol: __initial_sp
@@ -508,7 +495,8 @@ Symbol: __initial_sp
At line 36 in file startup_stm32f103xb.s
Uses
At line 60 in file startup_stm32f103xb.s
-Comment: __initial_sp used once
+ At line 283 in file startup_stm32f103xb.s
+
3 symbols
@@ -530,25 +518,24 @@ Symbol: Heap_Mem
Definitions
At line 47 in file startup_stm32f103xb.s
Uses
- At line 294 in file startup_stm32f103xb.s
- At line 296 in file startup_stm32f103xb.s
-
+ None
+Comment: Heap_Mem unused
__heap_base 00000000
Symbol: __heap_base
Definitions
At line 46 in file startup_stm32f103xb.s
Uses
- None
-Comment: __heap_base unused
+ At line 284 in file startup_stm32f103xb.s
+Comment: __heap_base used once
__heap_limit 00000200
Symbol: __heap_limit
Definitions
At line 48 in file startup_stm32f103xb.s
Uses
- None
-Comment: __heap_limit unused
+ At line 285 in file startup_stm32f103xb.s
+Comment: __heap_limit used once
4 symbols
@@ -1130,15 +1117,7 @@ Symbol: WWDG_IRQHandler
At line 78 in file startup_stm32f103xb.s
At line 184 in file startup_stm32f103xb.s
-__user_initial_stackheap 0000001C
-
-Symbol: __user_initial_stackheap
- Definitions
- At line 292 in file startup_stm32f103xb.s
- Uses
- At line 290 in file startup_stm32f103xb.s
-Comment: __user_initial_stackheap used once
-56 symbols
+55 symbols
@@ -1152,8 +1131,7 @@ Symbol: Heap_Size
At line 43 in file startup_stm32f103xb.s
Uses
At line 47 in file startup_stm32f103xb.s
- At line 296 in file startup_stm32f103xb.s
-
+Comment: Heap_Size used once
Stack_Size 00000400
Symbol: Stack_Size
@@ -1161,8 +1139,7 @@ Symbol: Stack_Size
At line 32 in file startup_stm32f103xb.s
Uses
At line 35 in file startup_stm32f103xb.s
- At line 295 in file startup_stm32f103xb.s
-
+Comment: Stack_Size used once
__Vectors_Size 000000EC
Symbol: __Vectors_Size
@@ -1194,13 +1171,5 @@ Symbol: __main
Uses
At line 134 in file startup_stm32f103xb.s
Comment: __main used once
-__use_two_region_memory 00000000
-
-Symbol: __use_two_region_memory
- Definitions
- At line 289 in file startup_stm32f103xb.s
- Uses
- None
-Comment: __use_two_region_memory unused
-3 symbols
-409 symbols in table
+2 symbols
+406 symbols in table
diff --git a/src/umain.cpp b/src/umain.cpp
index 7548d8d..36db638 100644
--- a/src/umain.cpp
+++ b/src/umain.cpp
@@ -2,6 +2,7 @@
#include
#include
+#include "iwdg.h"
using namespace iflytop;
using namespace std;
@@ -14,6 +15,14 @@ int random(int max) { return SysTick->VAL % max; }
/*******************************************************************************
* MAIN *
*******************************************************************************/
+void Main::generateScheduleTicket() {
+ static uint32_t lastTicket = 0;
+ if (m_hardware.getTicket() != lastTicket) {
+ lastTicket = m_hardware.getTicket();
+ m_ticket++;
+ }
+}
+
void Main::main(int argc, char const *argv[]) {
sys_loggger_enable(true);
ZLOGI(TAG, "setup")
@@ -23,5 +32,6 @@ void Main::main(int argc, char const *argv[]) {
while (true) {
m_hardware.periodicJob();
m_hardware.debug_light_periodicJob();
+ HAL_IWDG_Refresh(&hiwdg);
}
}
diff --git a/src/umain.hpp b/src/umain.hpp
index 169bb8f..fc75647 100644
--- a/src/umain.hpp
+++ b/src/umain.hpp
@@ -29,11 +29,13 @@ namespace iflytop {
class Main {
public:
Hardware m_hardware;
+ int32_t m_ticket; // 保证一个数一个数的递增,但不保证时间准确
Main() {}
void main(int argc, char const *argv[]);
- public:
+ private:
+ void generateScheduleTicket();
};
} // namespace iflytop