소스 검색

Fota模拟升级成功,后续需进行和平台联合调试

CHENJIE-PC\QiXiang_CHENJIE 4 년 전
부모
커밋
ec4661214e
4개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 1 1
      inc/Fota.h
  2. 2 2
      inc/app.h
  3. 2 2
      src/Fota.c
  4. 6 6
      src/MainTask.c

+ 1 - 1
inc/Fota.h

@@ -7,7 +7,7 @@
  * 
  ****************************************************************************/
 #include "bsp_custom.h"
-#define Fota_Addres_Begin (0x2A0000)
+
 typedef struct _Fota_Type
 {
     bool Fota_update_error ;

+ 2 - 2
inc/app.h

@@ -33,8 +33,8 @@ extern "C" {
 #define HWVERSION		    0x0102    //硬件主版本,现为V1.2板
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01030000     //驱动层版本号V1.3.0.0
-#define	APPSWVERSION		0x01020101       
-#define APP_CONFIG_FILE_LATEST_VERSION 1
+#define	APPSWVERSION		0x01020102       
+#define APP_CONFIG_FILE_LATEST_VERSION 2
 #define APP_CONFIG_FILE_NAME  "qxappconfig.nvm"
 //--------------------------------------------------------------------------------
 typedef struct AppNVMDataType

+ 2 - 2
src/Fota.c

@@ -23,7 +23,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
     UINT8 Fota_Answer[42];
     UINT8 Fota_Cmd;
     INT8 ret;
-    Fota_S.Fota_Flash_Addres = Fota_Addres_Begin;
+    Fota_S.Fota_Flash_Addres = FLASH_FOTA_REGION_START;
     if(*(DataPtr+30)==0x01)
     {
         Fota_Cmd = *(DataPtr+31);
@@ -44,7 +44,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                 memcpy(&Fota_Answer[24],(DataPtr+24),18);
                 Fota_Answer[42] =  bcc_chk_fota(Fota_Answer,41);
                 tcpipConnectionSend(connectId,Fota_Answer,43,0,0,0);
-                BSP_QSPI_Erase_Safe(FLASH_FOTA_REGION_START, 0x78000); //512k-32k = 480k -> 0x75300
+                BSP_QSPI_Erase_Safe(FLASH_FOTA_REGION_START,Fota_S.Fota_All_Data_Len + 4 - (Fota_S.Fota_All_Data_Len%4)); //512k-32k = 480k -> 0x75300  0x78000
                 break;
             }
             case 0x02:

+ 6 - 6
src/MainTask.c

@@ -151,6 +151,12 @@ static void MainTask(void* arg)
                     appSaveNVMData();
                 }
                 osDelay(5000);
+                if(Fota_update_flag)
+                {
+                    appSetCFUN(0);
+                    osDelay(1000);
+                    EC_SystemReset();
+                }
                 xTimerStop(work_timer, 0);
                 slpManSlpState_t State;
                 uint8_t cnt;
@@ -175,12 +181,6 @@ static void MainTask(void* arg)
                 #ifdef USING_PRINTF
                     printf("which slpstate can go now :%d \n",slpstate);
                 #endif
-                if(Fota_update_flag)
-                {
-                    appSetCFUN(0);
-                    osDelay(1000);
-                    EC_SystemReset();
-                }
                 slpManDeepSlpTimerStart(deepslpTimerID, AppNVMData.sleepTime*1000*60);
                 while(1)
                 {