Pārlūkot izejas kodu

添加FIFO溢出错误上报

lwy 2 gadi atpakaļ
vecāks
revīzija
e53b7e4936

+ 2 - 2
build_log.txt

@@ -1,6 +1,6 @@
 Build started: Project: ble_app_uart_c_pca10040_s132
-*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
+*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'E:\keil530\Keil_v5\ARM\ARMCC\Bin'
 Build target 'Shoes_FW_APP'
 FromELF: creating hex file...
 ÿþ".\_build\nrf52832_xxaa.axf" - 0 Error(s), 0 Warning(s).
-Build Time Elapsed:  00:00:02
+Build Time Elapsed:  00:00:05

BIN
dfu_readme/app_dfu_package.zip


+ 1 - 1
dfu_readme/自动生成升级固件.bat

@@ -15,7 +15,7 @@ echo=
 
 cd ..
 rem KEIL工具的安装目录
-set UV=C:\Keil_v5\UV4\UV4.exe
+set UV=E:\keil530\Keil_v5\UV4\UV4.exe
 rem 当前目录
 set Front_PRO_PATH=%cd%
 rem 工程目录

+ 1 - 1
drivers/drv_lsm6ds3tr_c.c

@@ -1863,7 +1863,7 @@ int	drv_lsm_get_fifo_group_num(void)
 		
 		lsm6ds3tr_c_fifo_mode_set(&ob_lsm6ds3tr_c.ctx, LSM6DS3TR_C_STREAM_MODE);
 		
-		return 0;
+		return -1;
 	}
 	
 	if(wt)

+ 8 - 0
hal/fml_imu.c

@@ -584,6 +584,8 @@ static int fml_imu_read_data_lsm(void)
 
 		fifo_group_num = fifo_group_num <= FML_IMU_DATA_GROUP_NUM_MAX ? fifo_group_num : FML_IMU_DATA_GROUP_NUM_MAX;
 		
+		if(fifo_group_num == FML_IMU_DATA_GROUP_NUM_MAX)Process_report_task_useTime(PROCESS_REPORT_TASK_USETIME_IMU_FIFO_OVER_NUM);
+		
 		if(fifo_group_num > 0)
 		{
 			for(i=0; i<fifo_group_num; i++)
@@ -624,6 +626,12 @@ static int fml_imu_read_data_lsm(void)
 				}
 			}
 		}
+		else if(fifo_group_num == -1)		//Òì³££¬fifoÒç³ö
+		{
+			Process_report_task_useTime(PROCESS_REPORT_TASK_USETIME_IMU_FIFO_OVERFLOW);
+
+			return 0;
+		}
 		else
 		{
 			return 0;

+ 15 - 15
pca10040/s132/arm5_no_packs/_build/arm_startup_nrf52.lst

@@ -531,21 +531,21 @@ ntf -I..\..\..\..\..\..\external\segger_rtt -I..\..\..\..\..\..\external\utf_co
 nverter -I..\..\..\..\..\..\integration\nrfx -I..\..\..\..\..\..\integration\nr
 fx\legacy -I..\..\..\..\..\..\modules\nrfx -I..\..\..\..\..\..\modules\nrfx\dri
 vers\include -I..\..\..\..\..\..\modules\nrfx\hal -I..\config -I.\RTE\_Shoes_FW
-_APP -IC:\Users\Administrator\AppData\Local\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Cor
-e\Include -IC:\Users\Administrator\AppData\Local\Arm\Packs\NordicSemiconductor\
-nRF_DeviceFamilyPack\8.32.1\Device\Include --predefine="__MICROLIB SETA 1" --pr
-edefine="__UVISION_VERSION SETA 530" --predefine="_RTE_ SETA 1" --predefine="NR
-F52832_XXAA SETA 1" --predefine="_RTE_ SETA 1" --predefine="APP_TIMER_V2 SETA 1
-" --predefine="APP_TIMER_V2_RTC1_ENABLED SETA 1" --predefine="BOARD_PCA10040 SE
-TA 1" --predefine="CONFIG_GPIO_AS_PINRESET SETA 1" --predefine="FLOAT_ABI_HARD 
-SETA 1" --predefine="NRF52 SETA 1" --predefine="NRF52832_XXAA SETA 1" --predefi
-ne="NRF52_PAN_74 SETA 1" --predefine="NRF_SD_BLE_API_VERSION SETA 7" --predefin
-e="S132 SETA 1" --predefine="SOFTDEVICE_PRESENT SETA 1" --predefine="__HEAP_SIZ
-E SETA 8192" --predefine="__STACK_SIZE SETA 8192" --cpreproc_opts=-DAPP_TIMER_V
-2,-DAPP_TIMER_V2_RTC1_ENABLED,-DBOARD_PCA10040,-DCONFIG_GPIO_AS_PINRESET,-DFLOA
-T_ABI_HARD,-DNRF52,-DNRF52832_XXAA,-DNRF52_PAN_74,-DNRF_SD_BLE_API_VERSION=7,-D
-S132,-DSOFTDEVICE_PRESENT,-D__HEAP_SIZE=8192,-D__STACK_SIZE=8192 --list=.\_buil
-d\arm_startup_nrf52.lst RTE\Device\nRF52832_xxAA\arm_startup_nrf52.s
+_APP -IE:\keil530\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include -IE:\keil530\Arm
+\Packs\NordicSemiconductor\nRF_DeviceFamilyPack\8.32.1\Device\Include --predefi
+ne="__MICROLIB SETA 1" --predefine="__UVISION_VERSION SETA 530" --predefine="_R
+TE_ SETA 1" --predefine="NRF52832_XXAA SETA 1" --predefine="_RTE_ SETA 1" --pre
+define="APP_TIMER_V2 SETA 1" --predefine="APP_TIMER_V2_RTC1_ENABLED SETA 1" --p
+redefine="BOARD_PCA10040 SETA 1" --predefine="CONFIG_GPIO_AS_PINRESET SETA 1" -
+-predefine="FLOAT_ABI_HARD SETA 1" --predefine="NRF52 SETA 1" --predefine="NRF5
+2832_XXAA SETA 1" --predefine="NRF52_PAN_74 SETA 1" --predefine="NRF_SD_BLE_API
+_VERSION SETA 7" --predefine="S132 SETA 1" --predefine="SOFTDEVICE_PRESENT SETA
+ 1" --predefine="__HEAP_SIZE SETA 8192" --predefine="__STACK_SIZE SETA 8192" --
+cpreproc_opts=-DAPP_TIMER_V2,-DAPP_TIMER_V2_RTC1_ENABLED,-DBOARD_PCA10040,-DCON
+FIG_GPIO_AS_PINRESET,-DFLOAT_ABI_HARD,-DNRF52,-DNRF52832_XXAA,-DNRF52_PAN_74,-D
+NRF_SD_BLE_API_VERSION=7,-DS132,-DSOFTDEVICE_PRESENT,-D__HEAP_SIZE=8192,-D__STA
+CK_SIZE=8192 --list=.\_build\arm_startup_nrf52.lst RTE\Device\nRF52832_xxAA\arm
+_startup_nrf52.s
 
 
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
pca10040/s132/arm5_no_packs/_build/ble_app_uart_c_pca10040_s132_Shoes_FW_APP.dep


BIN
pca10040/s132/arm5_no_packs/_build/nrf52832_xxaa.axf


+ 9 - 9
pca10040/s132/arm5_no_packs/_build/nrf52832_xxaa.build_log.htm

@@ -5,11 +5,11 @@
 <h2>Tool Versions:</h2>
 IDE-Version: ¦ÌVision V5.30.0.0
 Copyright (C) 2020 ARM Ltd and ARM Germany GmbH. All rights reserved.
-License Information: Ou Administrator, 11, LIC=EXJT4-FD1MZ-JJG6S-L29G4-S14VJ-CPP65
+License Information: lxy Administrator, 11, LIC=76F5U-S1WWA-DY9V3-A71WD-QJ6CF-HP6IP
  
 Tool Versions:
 Toolchain:       MDK-ARM Plus  Version: 5.30.0.0
-Toolchain Path:  C:\Keil_v5\ARM\ARMCC\Bin
+Toolchain Path:  E:\keil530\Keil_v5\ARM\ARMCC\Bin
 C Compiler:      Armcc.exe V5.06 update 6 (build 750)
 Assembler:       Armasm.exe V5.06 update 6 (build 750)
 Linker/Locator:  ArmLink.exe V5.06 update 6 (build 750)
@@ -21,11 +21,11 @@ Target DLL:      Segger\JL2CM3.dll V2.99.38.0
 Dialog DLL:      TCM.DLL V1.42.0.0
  
 <h2>Project:</h2>
-D:\Git_Project\shoes\smart_shoes\nRF5_SDK_17.0.0_9d13099\examples\Shoes1.3\shoe_mcu\pca10040\s132\arm5_no_packs\ble_app_uart_c_pca10040_s132.uvprojx
-Project File Date:  07/18/2022
+F:\exampleProject\test_sleep2\git\examples\long\shoe_mcu\pca10040\s132\arm5_no_packs\ble_app_uart_c_pca10040_s132.uvprojx
+Project File Date:  07/27/2022
 
 <h2>Output:</h2>
-*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
+*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'E:\keil530\Keil_v5\ARM\ARMCC\Bin'
 Build target 'Shoes_FW_APP'
 FromELF: creating hex file...
 ".\_build\nrf52832_xxaa.axf" - 0 Error(s), 0 Warning(s).
@@ -46,19 +46,19 @@ Package Vendor: NordicSemiconductor
 
 <h2>Collection of Component include folders:</h2>
   .\RTE\_Shoes_FW_APP
-  C:\Users\Administrator\AppData\Local\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include
-  C:\Users\Administrator\AppData\Local\Arm\Packs\NordicSemiconductor\nRF_DeviceFamilyPack\8.32.1\Device\Include
+  E:\keil530\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include
+  E:\keil530\Arm\Packs\NordicSemiconductor\nRF_DeviceFamilyPack\8.32.1\Device\Include
 
 <h2>Collection of Component Files used:</h2>
 
    * Component: ARM::CMSIS:CORE:5.3.0
 
    * Component: NordicSemiconductor::Device:Startup:8.32.1
-      Source file:   Device\Source\arm\arm_startup_nrf52.s
       Source file:   Device\Source\system_nrf52.c
       Include file:  Device\Include\system_nrf.h
+      Source file:   Device\Source\arm\arm_startup_nrf52.s
       Include file:  Device\Include\system_nrf52.h
-Build Time Elapsed:  00:00:02
+Build Time Elapsed:  00:00:05
 </pre>
 </body>
 </html>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 298 - 298
pca10040/s132/arm5_no_packs/_build/nrf52832_xxaa.hex


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 183 - 167
pca10040/s132/arm5_no_packs/_build/nrf52832_xxaa.htm


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 6 - 7
pca10040/s132/arm5_no_packs/ble_app_uart_c_pca10040_s132.uvguix.Administrator


+ 4 - 4
pca10040/s132/arm5_no_packs/ble_app_uart_c_pca10040_s132.uvprojx

@@ -6144,8 +6144,8 @@
     <files>
       <file attr="config" category="source" condition="ARM Compiler" name="Device\Source\arm\arm_startup_nrf52.s" version="8.32.1">
         <instance index="0">RTE\Device\nRF52832_xxAA\arm_startup_nrf52.s</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="NordicSemiconductor" Cversion="8.32.1" condition="nRF52832 Device and CMSIS"/>
-        <package license="License/license.txt" name="nRF_DeviceFamilyPack" schemaVersion="1.3" url="http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/" vendor="NordicSemiconductor" version="8.32.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="NordicSemiconductor" Cversion="8.35.0" condition="nRF52832 Device and CMSIS"/>
+        <package license="License/license.txt" name="nRF_DeviceFamilyPack" schemaVersion="1.3" url="http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/" vendor="NordicSemiconductor" version="8.35.0"/>
         <targetInfos>
           <targetInfo name="Shoes_FW_APP"/>
           <targetInfo excluded="1" name="flash_s132_nrf52_7.0.1_softdevice"/>
@@ -6153,8 +6153,8 @@
       </file>
       <file attr="config" category="source" name="Device\Source\system_nrf52.c" version="8.32.1">
         <instance index="0">RTE\Device\nRF52832_xxAA\system_nrf52.c</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="NordicSemiconductor" Cversion="8.32.1" condition="nRF52832 Device and CMSIS"/>
-        <package license="License/license.txt" name="nRF_DeviceFamilyPack" schemaVersion="1.3" url="http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/" vendor="NordicSemiconductor" version="8.32.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="NordicSemiconductor" Cversion="8.35.0" condition="nRF52832 Device and CMSIS"/>
+        <package license="License/license.txt" name="nRF_DeviceFamilyPack" schemaVersion="1.3" url="http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/" vendor="NordicSemiconductor" version="8.35.0"/>
         <targetInfos>
           <targetInfo name="Shoes_FW_APP"/>
           <targetInfo excluded="1" name="flash_s132_nrf52_7.0.1_softdevice"/>

+ 72 - 0
system/system.c

@@ -5,6 +5,17 @@
 #include "hal_wearshoes.h"
 
 
+typedef struct _Task_UseTime
+{
+	uint32_t task_id;
+	uint32_t task_us;
+	uint32_t total_us;
+} Task_UseTime_t;
+
+static int _report_task_useTime_code = 0;
+static bool is_report_task_useTime = false;
+static Task_UseTime_t last_round_task_max_useTime = {0xFFFFFFFF,0,0},cur_round_task_max_useTime = {0xFFFFFFFF,0,0},all_round_task_max_useTime = {0xFFFFFFFF,0,0};
+
 //系统函数
 void FPS_process(void)
 {
@@ -159,6 +170,12 @@ int Process_App(void)
 {
 	int ret = 0;
 	uint8_t i = 0;
+	char buf[256];
+	uint32_t task_useTime = 0;
+	
+	cur_round_task_max_useTime.task_id 	= 0xFFFFFFFF;
+	cur_round_task_max_useTime.task_us 	= 0;
+	cur_round_task_max_useTime.total_us = 0;
 
 	for(i=0;i<process_dex;i++){
 		Except_Get_Cur_Porcess_ID(i);
@@ -167,11 +184,31 @@ int Process_App(void)
 			#if ProcessTime_EN
 			uint32_t useTime = NRF_RTC0->COUNTER;
 			#endif
+			
+			
+			uint32_t cnt1 = NRF_RTC0->COUNTER;
+			
 			if(mProcess[i].Peroid ==0) mProcess[i].cb();
 			else if(TIME_GetTicks()-mProcess[i].tim >= mProcess[i].Peroid ){
 				mProcess[i].tim = TIME_GetTicks();
 				mProcess[i].cb();
 			}
+			
+			uint32_t cnt2 = NRF_RTC0->COUNTER;
+			
+			if(cnt2<cnt1) cnt2 += 16777216;
+			
+			task_useTime = (cnt2-cnt1)/32.768 * 1000;
+			
+			cur_round_task_max_useTime.total_us += task_useTime;
+			
+			if(task_useTime > cur_round_task_max_useTime.task_us)
+			{
+				cur_round_task_max_useTime.task_us = task_useTime;
+				cur_round_task_max_useTime.task_id = i;
+			}
+			
+			
 			#if ProcessTime_EN
 			if(NRF_RTC0->COUNTER<useTime) useTime = (NRF_RTC0->COUNTER+16777216-useTime);
 			else useTime = (NRF_RTC0->COUNTER-useTime);
@@ -180,6 +217,34 @@ int Process_App(void)
 			#endif
 		}	
 	}
+	
+	if(cur_round_task_max_useTime.task_us > all_round_task_max_useTime.task_us)
+	{
+		all_round_task_max_useTime.task_us = cur_round_task_max_useTime.task_us;
+		all_round_task_max_useTime.task_id = cur_round_task_max_useTime.task_id;
+	}
+	
+	if(is_report_task_useTime)
+	{
+		sprintf(buf,"code:%d,report useTime:%d,%d,%d,%d,%d,%d,%d,%d\r\n",_report_task_useTime_code, \
+		                                                   last_round_task_max_useTime.task_id, \
+																											 last_round_task_max_useTime.task_us, \
+																											 last_round_task_max_useTime.total_us, \
+																											 cur_round_task_max_useTime.task_id, \
+																											 cur_round_task_max_useTime.task_us, \
+		                                                   cur_round_task_max_useTime.total_us, \
+		                                                   all_round_task_max_useTime.task_id, \
+		                                                   all_round_task_max_useTime.task_us);
+		Except_TxError(EXCEPT_EXCEPTION,buf);
+		
+		is_report_task_useTime = false;
+	}
+	
+	last_round_task_max_useTime.task_us 	= cur_round_task_max_useTime.task_us;
+	last_round_task_max_useTime.total_us 	= cur_round_task_max_useTime.total_us;
+	last_round_task_max_useTime.task_id 	= cur_round_task_max_useTime.task_id;
+	
+	
 	for(i=0;i<process_dex;i++){
 		if(mProcess[i].holdon){
 			ret = 1;	//不能进入低功耗
@@ -216,6 +281,13 @@ int Process_App(void)
 	return ret;
 }
 
+//触发上报上一轮、当前轮、所有轮任务中最大的耗时任务和ID,因为实时性的原因,所以不作保证性发送。
+void Process_report_task_useTime(int report_task_useTime_code)
+{
+	_report_task_useTime_code = report_task_useTime_code;
+	is_report_task_useTime = true;
+}
+
 //大循环
 void USR_Process(void)
 {

+ 4 - 0
system/system.h

@@ -7,6 +7,9 @@
 #include "SEGGER_RTT.h"
 #include "usr_config.h"
 
+#define		PROCESS_REPORT_TASK_USETIME_IMU_FIFO_OVER_NUM				1
+#define		PROCESS_REPORT_TASK_USETIME_IMU_FIFO_OVERFLOW				2
+
 typedef void (*Sleep_cb)(uint32_t);
 typedef void (*PROCESS_cb)(void);
 typedef struct _PROCESS{	//进程结构体
@@ -36,5 +39,6 @@ void Process_SetHoldOn(PROCESS_cb cb,uint8_t holdon); //app
 void Process_UpdatePeroid(PROCESS_cb cb,uint16_t Peroid);
 uint16_t Process_GetPeroid(PROCESS_cb cb);
 
+void Process_report_task_useTime(int report_task_useTime_code);	//触发上报上一轮、当前轮、所有轮任务中最大的耗时任务和ID,因为实时性的原因,所以不作保证性发送。
 #endif
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels