Ver Fonte

test new iap

JY há 8 meses atrás
pai
commit
a62b732218
3 ficheiros alterados com 25 adições e 9 exclusões
  1. 1 0
      HW_RESET_ATY.c
  2. 20 6
      IAP_YMODEM_ATY.c
  3. 4 3
      IAP_YMODEM_ATY.h

+ 1 - 0
HW_RESET_ATY.c

@@ -74,6 +74,7 @@ void JumpToApp(uint32_t addr)
 {
     // Disable global interrupts
     __disable_irq();
+    HAL_DeInit();
     /* execute the new program */
     uint32_t JumpAddress = *(__IO uint32_t*) (addr + 4);
     /* Jump to user application */

+ 20 - 6
IAP_YMODEM_ATY.c

@@ -292,20 +292,34 @@ void Main_Menu(void)
 
 void Main_Cycle(void)
 {
-    uint8_t sKey = 0;
+    uint8_t sKey[2] = {0};
     Interface_PutString("\r\n\r\nS to start\r\n\r\n");
     while(1)
     {
         if(1)
         {
-            if(Interface_Receive(&sKey, 1, RX_TIMEOUT) == HAL_OK)
+            if(Interface_Receive(sKey, 2, RX_TIMEOUT) == HAL_OK)
             {
-                if(sKey == 'S')
+                if(sKey[0] == 'S')
                 {
-                    Interface_Clean();
-                    uint8_t verStr[] = "1_01_250705\r\n";
+                    uint8_t verStr[] = "BLA_V_1_01_250705\r\n";
                     Interface_Transmit(verStr, sizeof(verStr), 100);
-                    Main_Menu();
+                    if(sKey[1] == '3'){
+                        Interface_Clean();
+                        Interface_PutString("\r\nStart program execution...\r\n");
+                        JumpToAppWithReset();
+                    }
+                    else if(sKey[1] == '1'){
+                        Interface_Clean();
+                        if(Interface_Download() != COM_OK){
+                            Interface_PutString("\r\nStart program execution...\r\n");
+                            JumpToAppWithReset();
+                        }
+                    }
+                    else{
+                        Interface_Clean();
+                        Main_Menu();
+                    }
                 }
                 else{
                     Interface_Clean();

+ 4 - 3
IAP_YMODEM_ATY.h

@@ -33,6 +33,7 @@
 
 #include "INCLUDE_ATY.h"
 #include "HW_RESET_ATY.h"
+#include "main.h"
 
 /******************************* For user *************************************/
 // do not forget change USER_VECT_TAB_ADDRESS VECT_TAB_OFFSET at system_stm32f1xx.c
@@ -40,9 +41,9 @@
 // #define IAP_YMODEM_ATY_DBG
 #endif
 
-#ifndef IAP_YMODEM_ATY_USB
-#define IAP_YMODEM_ATY_USB
-#endif
+// #ifndef IAP_YMODEM_ATY_USB
+// #define IAP_YMODEM_ATY_USB
+// #endif
 
 extern UART_HandleTypeDef huart3;
 #define Interface_UART huart3