Index: Boot/prj/MDK/YC3121_Keil.uvprojx
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/Boot/prj/MDK/YC3121_Keil.uvprojx	(revision 793)
+++ /YC3121_demo/ModuleDemo/updata_app/Boot/prj/MDK/YC3121_Keil.uvprojx	(working copy)
@@ -338,7 +338,7 @@
               <MiscControls></MiscControls>
               <Define>__USEKEILCOMPILE__</Define>
               <Undefine></Undefine>
-              <IncludePath>..\..\..\..\..\Librarier\core;..\..\..\..\..\Librarier\sdk</IncludePath>
+              <IncludePath>..\..\..\..\..\Librarier\core;..\..\..\..\..\Librarier\sdk;..\..\user;..\..\..\..\..\Librarier\sdk\yc_usb\scpu_usb_hid_Device_Demo;..\..\..\..\..\Librarier\sdk\yc_usb\libraries\harward_Der;..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\class\HID;..\..\..\..\..\Librarier\sdk\yc_usb\scpu_usb_hid_Device_Demo;..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\core</IncludePath>
             </VariousControls>
           </Cads>
           <Aads>
@@ -392,6 +392,11 @@
               <FileType>1</FileType>
               <FilePath>..\..\..\..\..\Librarier\core\system.c</FilePath>
             </File>
+            <File>
+              <FileName>bt_code.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\core\bt_code.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
@@ -403,9 +408,19 @@
               <FilePath>..\..\user\main.c</FilePath>
             </File>
             <File>
-              <FileName>bt_code.c</FileName>
+              <FileName>ota_ble.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\user\bt_code.c</FilePath>
+              <FilePath>..\..\user\ota_ble.c</FilePath>
+            </File>
+            <File>
+              <FileName>halUSB.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\user\halUSB.c</FilePath>
+            </File>
+            <File>
+              <FileName>otausb.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\user\otausb.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -427,6 +442,46 @@
               <FileType>1</FileType>
               <FilePath>..\..\..\..\..\Librarier\sdk\yc_systick.c</FilePath>
             </File>
+            <File>
+              <FileName>yc_encflash_bulk.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_encflash_bulk.lib</FilePath>
+            </File>
+            <File>
+              <FileName>yc_timer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_timer.c</FilePath>
+            </File>
+            <File>
+              <FileName>yc_qspi.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_qspi.lib</FilePath>
+            </File>
+            <File>
+              <FileName>yc_bt.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_bt.c</FilePath>
+            </File>
+            <File>
+              <FileName>yc_otp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_otp.c</FilePath>
+            </File>
+            <File>
+              <FileName>yc_ipc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_ipc.c</FilePath>
+            </File>
+            <File>
+              <FileName>yc_lpm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_lpm.c</FilePath>
+            </File>
+            <File>
+              <FileName>yc_sysctrl.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_sysctrl.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
@@ -444,6 +499,61 @@
             </File>
           </Files>
         </Group>
+        <Group>
+          <GroupName>USB</GroupName>
+          <Files>
+            <File>
+              <FileName>usb_core.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\harward_Der\usb_core.c</FilePath>
+            </File>
+            <File>
+              <FileName>Usb_dcd.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\harward_Der\Usb_dcd.c</FilePath>
+            </File>
+            <File>
+              <FileName>Usb_dcd_init.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\harward_Der\Usb_dcd_init.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_core.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\core\usbd_core.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_ioreq.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\core\usbd_ioreq.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_req.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\core\usbd_req.c</FilePath>
+            </File>
+            <File>
+              <FileName>usb_main.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\scpu_usb_hid_Device_Demo\usb_main.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_desc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\scpu_usb_hid_Device_Demo\usbd_desc.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_usr.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\scpu_usb_hid_Device_Demo\usbd_usr.c</FilePath>
+            </File>
+            <File>
+              <FileName>usbd_hid_core.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_usb\libraries\SCPU_USB_Device_Library\class\HID\usbd_hid_core.c</FilePath>
+            </File>
+          </Files>
+        </Group>
       </Groups>
     </Target>
   </Targets>
Index: Boot/user/main.c
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/Boot/user/main.c	(revision 793)
+++ /YC3121_demo/ModuleDemo/updata_app/Boot/user/main.c	(working copy)
@@ -1,6 +1,6 @@
 /**
   ******************************************************************************
-  * @file    3121Demo\ModuleDemo\UART\UART_TX_Sendbuf\user\main.c 
+  * @file    3121Demo\ModuleDemo\UART\UART_TX_Sendbuf\user\main.c
   * @author  Yichip Application Team
   * @version V1.0.0
   * @date    15-July-2019
@@ -10,12 +10,12 @@
   *
   * COPYRIGHT 2019 Yichip Microelectronics
   *
-  * The purpose of this firmware is to provide guidance to customers engaged in 
-	* programming work to guide them smoothly to product development, 
+  * The purpose of this firmware is to provide guidance to customers engaged in
+	* programming work to guide them smoothly to product development,
 	* so as to save their time.
 	*
-	* Therefore, Yichip microelectronics shall not be responsible for any direct, 
-	* indirect or consequential damages caused by any content of this gu jiang 
+	* Therefore, Yichip microelectronics shall not be responsible for any direct,
+	* indirect or consequential damages caused by any content of this gu jiang
 	* and/or contained in this code used by the customer in its products.
   *
   ******************************************************************************
@@ -25,41 +25,31 @@
 #include "yc3121.h"
 #include "yc_gpio.h"
 #include "yc_uart.h"
+#include "yc_ipc.h"
+#include "usb_main.h"
+#include "halUSB.h"
+#include "yc_qspi.h"
+#include "yc_encflash_bulk.h"
+#include "ota_ble.h"
+#include "yc_bt.h"
 #include "yc_systick.h"
+#include "yc_qspi.h"
+#include "otausb.h"
+#include "board_config.h"
 
 /* Private typedef -----------------------------------------------------------*/
 /* Private define ------------------------------------------------------------*/
-#define uartBaud 115200
 
 /* Private macro -------------------------------------------------------------*/
 /* Private variables ---------------------------------------------------------*/
 /* Private function prototypes -----------------------------------------------*/
 void UART_Configuration(void);
-void UART_Sendbuf_test(void);
-extern void start_app(void);
-
 
-char cmd[2]={0,0};
-void UART0_IRQHandler(void)
-{
-	MyPrintf("\nboot UART0_IRQHandler");
-	while(UART_IsRXFIFONotEmpty(UART0))
-	{
-		cmd[0] = cmd[1];
-		cmd[1] = UART_ReceiveData(UART0); 
-		MyPrintf("\r%02x ",cmd[1]);
-	}
-
-}
+extern void start_app(void);
+uint8_t  rx_buffer_boot[32] = {0};
+extern _Bool  bBacktoAppFlag;
 
-void SYSTICK_IRQHandler(void)
-{
-	 static uint32_t times = 0;
-	 if((times++)%1000 == 0)
-	 {
-			MyPrintf("\n boot SYSTICK_IRQHandler");
-	 }
-}
+uint32_t APPWRITEADDR = 0x1020000;
 /**
   * @brief  Main program
   * @param  None
@@ -67,22 +57,55 @@
   */
 int main(void)
 {
-	UART_Configuration();
-	UART_Sendbuf_test();
-
-  MyPrintf("boot UART TX Sendbuf Demo !\n\n");
-	UART_SetRxITNum(UART0,1);
-	UART_SetITTimeout(UART0,10);
-	enable_intr(INTR_UART0);
-	SysTick_Config(48000);
-	while (1)
-	{
-		if('U' == cmd[0] && 'P' == cmd[1])
-		{
-			MyPrintf("\nJUMP to app");
-			start_app();                   
-		}
-	}
+    UART_Configuration();
+    MyPrintf("YC3121 OTA BOOT Demo\n");
+    enc_read_flash(0x1000120, rx_buffer_boot, 32);
+    delay_ms(20);
+    if ((rx_buffer_boot[0] == 0xAA) && (rx_buffer_boot[1] == 0x55) && (rx_buffer_boot[2] == 0xAA) && (rx_buffer_boot[3] == 0x55))
+    {
+        /*USB OTA 0xAA55AA55*/
+        IpcInit();
+
+        enc_write_flash_bulk_init();
+
+        enc_earse_flash_app_area(APPWRITEADDR, 320 * 1024);
+
+        MyPrintf("USB HID OTA Demo !\n\n");
+
+        halUsbInit(USB_MODE_HID);
+
+        while (1)
+        {
+            Cmd_check();
+            BackToApp(bBacktoAppFlag);
+        }
+    }
+    else if ((rx_buffer_boot[0] == 0xA5) && (rx_buffer_boot[1] == 0x5A) && (rx_buffer_boot[2] == 0xA5) && (rx_buffer_boot[3] == 0x5A))
+    {
+        /*BT OTA 0xA55AA55A*/
+        enc_write_flash_bulk_init();
+        enc_earse_flash_app_area(APPWRITEADDR, 320 * 1024);
+        MyPrintf("BT OTA Demo !\n\n");
+        BleInit();
+        while (1)
+        {
+            BT_Progress();
+            Ble_Cmd_check();
+            if (BleOtaUpdateStatus())
+            {
+                disable_intr(INTR_BT);
+                MyPrintf("Run App\n");
+                delay_ms(10);
+                enc_erase_flash_32byte(0x1000120);
+                start_app();
+            }
+
+        }
+    }
+    else
+    {
+        start_app();
+    }
 }
 
 /**
@@ -92,40 +115,27 @@
   */
 void UART_Configuration(void)
 {
-	UART_InitTypeDef UART_InitStruct;
+    UART_InitTypeDef UART_InitStruct;
 
-	/* Configure serial ports 0 RX and TX for IO. */
-	GPIO_Config(GPIOA, GPIO_Pin_1, GPCFG_UART0_TXD);
-	GPIO_Config(GPIOA, GPIO_Pin_0, GPCFG_UART0_RXD);
-
-	/* USARTx configured as follow:
-  - BaudRate = 115200 baud  
-  - Word Length = 8 Bits
-  - Stop Bit = 1 Stop Bit
-  - Parity = No Parity
-  - Hardware flow control disabled (RTS and CTS signals)
-  - Receive and transmit enabled
-  */
-	UART_InitStruct.BaudRate = uartBaud;			//Configure serial port baud rate, the baud rate defaults to 128000.
-	UART_InitStruct.DataBits = Databits_8b;
-	UART_InitStruct.StopBits = StopBits_1;
-	UART_InitStruct.Parity = Parity_None;
-	UART_InitStruct.FlowCtrl = FlowCtrl_None;
-	UART_InitStruct.Mode = Mode_duplex;
-	
-	UART_Init(UART0, &UART_InitStruct);
-}
-
-/**
-  * @brief  Serial port 0 string data send test function.
-  * @param  None
-  * @retval None
-  */
-void UART_Sendbuf_test(void)
-{
-	uint8_t buf[] = {"\rThis is serial port 0 string data send test program!\n"};
-	
-	UART_SendBuf(UART0, buf, sizeof(buf)-1);
+    /* Configure serial ports 0 RX and TX for IO. */
+    GPIO_Config(UART0_TX_PORT, UART0_TX_PIN, GPCFG_UART0_TXD);
+    GPIO_Config(UART0_RX_PORT, UART0_RX_PIN, GPCFG_UART0_RXD);
+
+    /* USARTx configured as follow:
+    - BaudRate = 115200 baud
+    - Word Length = 8 Bits
+    - Stop Bit = 1 Stop Bit
+    - Parity = No Parity
+    - Hardware flow control disabled (RTS and CTS signals)
+    - Receive and transmit enabled
+    */
+    UART_InitStruct.BaudRate = UARTBAUD;			//Configure serial port baud rate, the baud rate defaults to 128000.
+    UART_InitStruct.DataBits = Databits_8b;
+    UART_InitStruct.StopBits = StopBits_1;
+    UART_InitStruct.Parity = Parity_None;
+    UART_InitStruct.FlowCtrl = FlowCtrl_None;
+    UART_InitStruct.Mode = Mode_duplex;
+    UART_Init(UART0, &UART_InitStruct);
 }
 
-/************************ (C) COPYRIGHT Yichip Microelectronics *****END OF FILE****/
\ No newline at end of file
+/************************ (C) COPYRIGHT Yichip Microelectronics *****END OF FILE****/
Index: app/prj/MDK/YC3121_Keil.uvprojx
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/app/prj/MDK/YC3121_Keil.uvprojx	(revision 793)
+++ /YC3121_demo/ModuleDemo/updata_app/app/prj/MDK/YC3121_Keil.uvprojx	(working copy)
@@ -405,7 +405,7 @@
             <File>
               <FileName>bt_code.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\user\bt_code.c</FilePath>
+              <FilePath>..\..\..\..\..\Librarier\core\bt_code.c</FilePath>
             </File>
           </Files>
         </Group>
@@ -422,6 +422,21 @@
               <FileType>1</FileType>
               <FilePath>..\..\..\..\..\Librarier\sdk\yc_uart.c</FilePath>
             </File>
+            <File>
+              <FileName>yc_encflash_bulk.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_encflash_bulk.lib</FilePath>
+            </File>
+            <File>
+              <FileName>yc_qspi.lib</FileName>
+              <FileType>4</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_qspi.lib</FilePath>
+            </File>
+            <File>
+              <FileName>yc_otp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\..\..\Librarier\sdk\yc_otp.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
Index: app/user/main.c
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/app/user/main.c	(revision 793)
+++ /YC3121_demo/ModuleDemo/updata_app/app/user/main.c	(working copy)
@@ -1,6 +1,6 @@
 /**
   ******************************************************************************
-  * @file    3121Demo\ModuleDemo\UART\UART_TX_Sendbuf\user\main.c 
+  * @file    3121Demo\ModuleDemo\UART\UART_TX_Sendbuf\user\main.c
   * @author  Yichip Application Team
   * @version V1.0.0
   * @date    15-July-2019
@@ -10,12 +10,12 @@
   *
   * COPYRIGHT 2019 Yichip Microelectronics
   *
-  * The purpose of this firmware is to provide guidance to customers engaged in 
-	* programming work to guide them smoothly to product development, 
+  * The purpose of this firmware is to provide guidance to customers engaged in
+	* programming work to guide them smoothly to product development,
 	* so as to save their time.
 	*
-	* Therefore, Yichip microelectronics shall not be responsible for any direct, 
-	* indirect or consequential damages caused by any content of this gu jiang 
+	* Therefore, Yichip microelectronics shall not be responsible for any direct,
+	* indirect or consequential damages caused by any content of this gu jiang
 	* and/or contained in this code used by the customer in its products.
   *
   ******************************************************************************
@@ -25,56 +25,75 @@
 #include "yc3121.h"
 #include "..\sdk\yc_gpio.h"
 #include "..\sdk\yc_uart.h"
+#include "yc_qspi.h"
+#include "yc_encflash_bulk.h"
+#include "board_config.h"
 
 /* Private typedef -----------------------------------------------------------*/
 /* Private define ------------------------------------------------------------*/
-#define uartBaud 115200
+
 
 /* Private macro -------------------------------------------------------------*/
 /* Private variables ---------------------------------------------------------*/
 /* Private function prototypes -----------------------------------------------*/
 void UART_Configuration(void);
-void UART_Sendbuf_test(void);
-
-
-void UART0_IRQHandler(void)
-{
-	MyPrintf("\napp UART0_IRQHandler");
-	while(UART_IsRXFIFONotEmpty(UART0))
-	{
-		MyPrintf("\r%02x ",UART_ReceiveData(UART0));
-	}
-
-}
-
-void SYSTICK_IRQHandler(void)
-{
-	 static uint32_t times = 0;
-	 if((times++)%1000 == 0)
-	 {
-			MyPrintf("\n app SYSTICK_IRQHandler");
-	 }
-}
 /**
   * @brief  Main program
   * @param  None
   * @retval None
   */
+
+uint8_t tx_buffer_boot[32] = {0};
+
 int main(void)
 {
 	UART_Configuration();
-	UART_Sendbuf_test();
-
-  MyPrintf("app UART TX Sendbuf Demo !\n\n");
-	UART_SetRxITNum(UART0,1);
-	UART_SetITTimeout(UART0,10);
-	enable_intr(INTR_UART0);
+	MyPrintf("YC3121 OTA APP Demo\n");
+	MyPrintf("/*************************/\n");
+	MyPrintf("Please input 'B' or 'U'\n");
+	MyPrintf("B: BLE OTA Updata\n");
+	MyPrintf("U: USB HID OTA Updata\n");
+    MyPrintf("/************************/\n");
+	uint8_t uartretval;
 	while (1)
 	{
-		
+        if(UART_IsRXFIFONotEmpty(UART0))
+        {
+            uartretval = UART_ReceiveData(UART0);
+            if(uartretval == 'U')
+            {
+                MyPrintf("This is USB OTA Update Init\n");
+                enc_erase_flash_32byte(0x1000120);
+                tx_buffer_boot[0] = 0xAA;
+                tx_buffer_boot[1] = 0x55;
+                tx_buffer_boot[2] = 0xAA;
+                tx_buffer_boot[3] = 0x55;
+
+                for (int i = 4; i < 32; i++)
+                {
+                    tx_buffer_boot[i] = 0xFF;
+                }
+                enc_write_flash(0x1000120, tx_buffer_boot, 32);
+                soft_reset();
+            }
+            else if(uartretval == 'B')
+            {
+                MyPrintf("This is BLE OTA Update Init\n");
+                enc_erase_flash_32byte(0x1000120);
+                tx_buffer_boot[0] = 0xA5;
+                tx_buffer_boot[1] = 0x5A;
+                tx_buffer_boot[2] = 0xA5;
+                tx_buffer_boot[3] = 0x5A;
+                for (int i = 4; i < 32; i++)
+                {
+                    tx_buffer_boot[i] = 0xFF;
+                }
+                enc_write_flash(0x1000120, tx_buffer_boot, 32);
+                soft_reset();
+            }
+        }
 	}
 }
-
 /**
   * @brief  Serial port 0 initialization function.
   * @param  None
@@ -85,37 +104,25 @@
 	UART_InitTypeDef UART_InitStruct;
 
 	/* Configure serial ports 0 RX and TX for IO. */
-	GPIO_Config(GPIOA, GPIO_Pin_1, GPCFG_UART0_TXD);
-	GPIO_Config(GPIOA, GPIO_Pin_0, GPCFG_UART0_RXD);
+	GPIO_Config(UART0_TX_PORT, UART0_TX_PIN, GPCFG_UART0_TXD);
+	GPIO_Config(UART0_RX_PORT, UART0_RX_PIN, GPCFG_UART0_RXD);
 
 	/* USARTx configured as follow:
-  - BaudRate = 115200 baud  
-  - Word Length = 8 Bits
-  - Stop Bit = 1 Stop Bit
-  - Parity = No Parity
-  - Hardware flow control disabled (RTS and CTS signals)
-  - Receive and transmit enabled
-  */
-	UART_InitStruct.BaudRate = uartBaud;			//Configure serial port baud rate, the baud rate defaults to 128000.
+     - BaudRate = 115200 baud
+     - Word Length = 8 Bits
+     - Stop Bit = 1 Stop Bit
+     - Parity = No Parity
+     - Hardware flow control disabled (RTS and CTS signals)
+     - Receive and transmit enabled
+    */
+	UART_InitStruct.BaudRate = UARTBAUD;			//Configure serial port baud rate, the baud rate defaults to 128000.
 	UART_InitStruct.DataBits = Databits_8b;
 	UART_InitStruct.StopBits = StopBits_1;
 	UART_InitStruct.Parity = Parity_None;
 	UART_InitStruct.FlowCtrl = FlowCtrl_None;
 	UART_InitStruct.Mode = Mode_duplex;
-	
-	UART_Init(UART0, &UART_InitStruct);
-}
 
-/**
-  * @brief  Serial port 0 string data send test function.
-  * @param  None
-  * @retval None
-  */
-void UART_Sendbuf_test(void)
-{
-	uint8_t buf[] = {"\rThis is serial port 0 string data send test program!\n"};
-	
-	UART_SendBuf(UART0, buf, sizeof(buf)-1);
+	UART_Init(UART0, &UART_InitStruct);
 }
 
 /************************ (C) COPYRIGHT Yichip Microelectronics *****END OF FILE****/
\ No newline at end of file
Index: hex_to_bin/ActivePerl-5.8.4.810-MSWin32-x86.msi
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/ActivePerl-5.8.4.810-MSWin32-x86.msi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/BLE OTA使用说明.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/BLE OTA使用说明.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/OTA JLINK仿真配置.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/OTA JLINK仿真配置.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/f_rom_to_bin.exe
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/f_rom_to_bin.exe
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/f_rom_to_bin.py
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/f_rom_to_bin.py	(nonexistent)
+++ /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/f_rom_to_bin.py	(working copy)
@@ -0,0 +1,34 @@
+import struct
+import sys
+print(sys.argv[0])
+print(sys.argv[1]) #鍙傛暟閮芥槸str
+print(len(sys.argv))
+
+if len(sys.argv) > 2:
+    input_file = sys.argv[2]
+else:
+    input_file = "flash.rom" 
+print("in  file name:",input_file)
+output_file = input_file.replace(".rom",".bin")
+print("out file name:",output_file)
+print(">>>>>>>>>>>>>>>>>>Flash_rom To Bin<<<<<<<<<<<<<<<<<<<<<<<<")
+
+
+#Read data
+print(">>Start Read Data")
+f= open(input_file,"r")
+list_lines=f.readlines()
+f.close()
+
+
+#write data
+a= int(sys.argv[1]) #str杞崲鎴恑nteger
+print(">>start write File From ",a)
+print(list_lines[a])
+fw = open(file=output_file,mode="wb")
+for i in list_lines[a:]:
+    fw.write(struct.pack('L',int(i,16)))
+fw.close()
+
+
+print("************************END***********************")
\ No newline at end of file
Index: hex_to_bin/f_updata_rom_to_bin.exe
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/f_updata_rom_to_bin.exe
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/genapp.bat
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/genapp.bat	(nonexistent)
+++ /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/genapp.bat	(working copy)
@@ -0,0 +1 @@
+f_rom_to_bin.exe 32768 app_flash.rom
Index: hex_to_bin/genbin.bat
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/genbin.bat	(nonexistent)
+++ /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/genbin.bat	(working copy)
@@ -0,0 +1,7 @@
+echo on
+cls
+
+perl hex2rom.pl 1000000 1ffffff  32 ..\app\prj\MDK\Objects\YC3121_keil.hex  .\app_flash.rom
+perl hex2rom.pl 1000000 1ffffff  32 ..\Boot\prj\MDK\Objects\YC3121_keil.hex  .\boot_flash.rom
+
+f_updata_rom_to_bin 128
\ No newline at end of file
Index: hex_to_bin/hex2rom.pl
===================================================================
--- /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/hex2rom.pl	(nonexistent)
+++ /YC3121_demo/ModuleDemo/updata_app/hex_to_bin/hex2rom.pl	(working copy)
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+my @rom = ();
+die "missing start and end address" if(@ARGV < 2);
+
+$addrhi = 0;
+$baseaddr = hex($ARGV[0]);
+$endaddr = hex($ARGV[1]);
+$bits = 32;
+$bits = $ARGV[2] if(@ARGV > 2);
+$endian = 1;
+
+
+$inputfile_addr = $ARGV[3];
+print "\input:  $inputfile_addr\n";
+$outputfile_addr =$ARGV[4];
+print "\output:  $outputfile_addr\n";
+
+
+open(DATA,$inputfile_addr);
+
+while(<DATA>){
+	$line++;
+	$count = (hex substr($_, 1, 2));
+	$addr = (hex substr($_, 3, 4));
+	$type = (hex substr($_, 7, 2));
+	if($type == 2 || $type == 4) {
+		$addrhi = hex(substr($_, 9, 4)) << ($type == 2 ? 4 : 16);
+		printf "type=%d, addr=%x, line=%d\n", $type, $addrhi, $line;
+	}
+	if($type == 0 && $addrhi >= $baseaddr && $addrhi <= $endaddr) {
+		for($x=0; $x<$count; $x++) {
+			$rom[$addrhi - $baseaddr + $addr + $x] = (hex substr($_, 9+2*$x, 2)) ; 
+		}
+	}
+}
+
+#鍒犻櫎鐩爣鏂囦欢
+unlink($outputfile_addr);
+#鍒涘缓鐩爣鏂囦欢
+$outputfile_addr =$ARGV[4];
+$outputfile_addr = '+>'.$outputfile_addr;
+print "$outputfile_addr\n";
+open(DATA1,$outputfile_addr) or die "des file open fail,$!";
+
+if($bits == 1) {
+	for($x=0; $x<@rom; $x++) {
+			printf ("%04x\n", $rom[$x]);
+		}
+		print "\n";
+} else {
+	for($x=0; $x<@rom; $x+=$bits/8) {
+		for($i = 0;$i < $bits/8;$i++) {
+			$tmp = sprintf("%02x",($endian ? $rom[$x+$bits/8-1-$i] : $rom[$x+$i])),
+			print DATA1 "$tmp";
+#			printf "$tmp";
+			}
+		print DATA1 "\n";
+#		printf "\n";
+	}
+}
+$inputfile_addr = $ARGV[3];
+$outputfile_addr =$ARGV[4];
+close(inputfile_addr);
+close(outputfile_addr);
Index: hex_to_bin/yc_3121f_ota_tool.exe
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/yc_3121f_ota_tool.exe
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/二代OTA协议说明.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/二代OTA协议说明.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/使用说明.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/使用说明.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hex_to_bin/遥控器&灯控&键盘OTA_协议-固件升级 遥控器测试协议.xlsx
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: hex_to_bin/遥控器&灯控&键盘OTA_协议-固件升级 遥控器测试协议.xlsx
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
