瀏覽代碼

按json格式写读otaMSG.txt

yang684665 1 年之前
父節點
當前提交
86a921addb
共有 82 個文件被更改,包括 14410 次插入6950 次删除
  1. 20 0
      .vscode/c_cpp_properties.json
  2. 9 0
      .vscode/settings.json
  3. 4 1
      app/.vscode/settings.json
  4. 2 2
      app/App/main.c
  5. 4601 455
      app/Proj/JLinkLog.txt
  6. 1051 1064
      app/Proj/Listings/Ringzle.map
  7. 二進制
      app/Proj/Objects/Ringzle.axf
  8. 二進制
      app/Proj/Objects/Ringzle.bin
  9. 155 3
      app/Proj/Objects/Ringzle.build_log.htm
  10. 699 747
      app/Proj/Objects/Ringzle.htm
  11. 2 2
      app/Proj/Objects/Ringzle.sct
  12. 24 24
      app/Proj/Objects/Ringzle_GD32F103C8T6.dep
  13. 二進制
      app/Proj/Objects/device_message.crf
  14. 二進制
      app/Proj/Objects/dlt645_port.crf
  15. 二進制
      app/Proj/Objects/ec800m.crf
  16. 二進制
      app/Proj/Objects/gd32f10x_it.crf
  17. 二進制
      app/Proj/Objects/key.crf
  18. 二進制
      app/Proj/Objects/main.crf
  19. 二進制
      app/Proj/Objects/mqttrecv.crf
  20. 二進制
      app/Proj/Objects/otaevent.crf
  21. 二進制
      app/Proj/Objects/parsedevicemessage.crf
  22. 二進制
      app/Proj/Objects/pc.crf
  23. 二進制
      app/Proj/Objects/systick.crf
  24. 1749 53
      app/Proj/Ringzle.uvguix.IBM
  25. 1 1
      app/Proj/Ringzle.uvprojx
  26. 5 1
      bootloader/.vscode/settings.json
  27. 1 1
      bootloader/CMSIS/Include/gd32f10x.h
  28. 65 0
      bootloader/HW/Include/ec800m.h
  29. 4 9
      bootloader/HW/Include/fmc.h
  30. 3 0
      bootloader/HW/Include/gd32f10x_it.h
  31. 85 0
      bootloader/HW/Include/usart.h
  32. 14 13
      bootloader/HW/Source/boot.c
  33. 80 0
      bootloader/HW/Source/ec800m.c
  34. 6 212
      bootloader/HW/Source/fmc.c
  35. 23 20
      bootloader/HW/Source/gd32f10x_it.c
  36. 136 10
      bootloader/HW/Source/ota_message.c
  37. 207 0
      bootloader/HW/Source/usart.c
  38. 二進制
      bootloader/OBJ/boot.crf
  39. 二進制
      bootloader/OBJ/bootloader.axf
  40. 22 12
      bootloader/OBJ/bootloader.build_log.htm
  41. 560 234
      bootloader/OBJ/bootloader.htm
  42. 5 0
      bootloader/OBJ/bootloader.lnp
  43. 203 28
      bootloader/OBJ/bootloader_bootloader.dep
  44. 二進制
      bootloader/OBJ/delay.crf
  45. 二進制
      bootloader/OBJ/ec800m.crf
  46. 37 0
      bootloader/OBJ/ec800m.d
  47. 二進制
      bootloader/OBJ/fmc.crf
  48. 二進制
      bootloader/OBJ/gd32f10x_dma.crf
  49. 35 0
      bootloader/OBJ/gd32f10x_dma.d
  50. 二進制
      bootloader/OBJ/gd32f10x_exti.crf
  51. 35 0
      bootloader/OBJ/gd32f10x_exti.d
  52. 二進制
      bootloader/OBJ/gd32f10x_fmc.crf
  53. 二進制
      bootloader/OBJ/gd32f10x_fwdgt.crf
  54. 二進制
      bootloader/OBJ/gd32f10x_gpio.crf
  55. 二進制
      bootloader/OBJ/gd32f10x_it.crf
  56. 1 0
      bootloader/OBJ/gd32f10x_it.d
  57. 二進制
      bootloader/OBJ/gd32f10x_misc.crf
  58. 二進制
      bootloader/OBJ/gd32f10x_rcu.crf
  59. 二進制
      bootloader/OBJ/gd32f10x_spi.crf
  60. 二進制
      bootloader/OBJ/gd32f10x_usart.crf
  61. 35 0
      bootloader/OBJ/gd32f10x_usart.d
  62. 二進制
      bootloader/OBJ/gd32f10x_wwdgt.crf
  63. 二進制
      bootloader/OBJ/main.crf
  64. 2 0
      bootloader/OBJ/main.d
  65. 二進制
      bootloader/OBJ/ota_message.crf
  66. 3 0
      bootloader/OBJ/ota_message.d
  67. 二進制
      bootloader/OBJ/spi.crf
  68. 二進制
      bootloader/OBJ/system_gd32f10x.crf
  69. 二進制
      bootloader/OBJ/usart.crf
  70. 35 0
      bootloader/OBJ/usart.d
  71. 二進制
      bootloader/OBJ/w25q32.crf
  72. 94 0
      bootloader/USER/.vscode/c_cpp_properties.json
  73. 2 0
      bootloader/USER/.vscode/keil-assistant.log
  74. 32 0
      bootloader/USER/.vscode/uv4.log
  75. 1 0
      bootloader/USER/.vscode/uv4.log.lock
  76. 3275 3540
      bootloader/USER/JLinkLog.txt
  77. 832 345
      bootloader/USER/Listings/bootloader.map
  78. 95 86
      bootloader/USER/bootloader.uvguix.IBM
  79. 78 50
      bootloader/USER/bootloader.uvoptx
  80. 25 0
      bootloader/USER/bootloader.uvprojx
  81. 51 21
      bootloader/USER/main.c
  82. 6 16
      bootloader/USER/main.h

+ 20 - 0
.vscode/c_cpp_properties.json

@@ -0,0 +1,20 @@
+{
+    "configurations": [
+        {
+            "name": "Win32",
+            "includePath": [
+                "${workspaceFolder}/**"
+            ],
+            "defines": [
+                "_DEBUG",
+                "UNICODE",
+                "_UNICODE"
+            ],
+            "compilerPath": "C:/MinGW/bin/gcc.exe",
+            "cStandard": "c17",
+            "cppStandard": "c++17",
+            "intelliSenseMode": "windows-gcc-arm"
+        }
+    ],
+    "version": 4
+}

+ 9 - 0
.vscode/settings.json

@@ -0,0 +1,9 @@
+{
+    "files.associations": {
+        "fmc.h": "c",
+        "gd32f10x.h": "c",
+        "gd32f10x_libopt.h": "c",
+        "gd32f10x_enet.h": "c",
+        "main.h": "c"
+    }
+}

+ 4 - 1
app/.vscode/settings.json

@@ -6,6 +6,9 @@
         "gd32f10x_enet.h": "c",
         "systick.h": "c",
         "stdio.h": "c",
-        "main.h": "c"
+        "main.h": "c",
+        "device_message.h": "c",
+        "gd32f10x_gpio.h": "c",
+        "gd32f10x_exti.h": "c"
     }
 }

+ 2 - 2
app/App/main.c

@@ -54,7 +54,7 @@ OF SUCH DAMAGE.
 #define UNIQUE_ID 0x1FFFF7E8
 
 
-#define VERSION "V1.0.2" // 版本号写死、通过人工手动控制
+#define VERSION "V1.0.1" // 版本号写死、通过人工手动控制
 
 #define GATEWAYNAME "DTU"
 #define GATEWAYMODE "4G" // 后续此mode可以切换4g
@@ -75,7 +75,7 @@ int main(void)
 	systick_config();
 	nvic_config();
 	/* initilize the LEDs, USART */
-//	W25Q32_Init(); 	//弃用w25q32,改用片内flash存储
+//	W25Q32_Init(); 	//弃用w25q32,改用EC800存储ota文件
 	gd_eval_led_init(LED1);
 	gd_com_init(COM_232);
 	gd_com_init(COM_EC800);

File diff suppressed because it is too large
+ 4601 - 455
app/Proj/JLinkLog.txt


File diff suppressed because it is too large
+ 1051 - 1064
app/Proj/Listings/Ringzle.map


二進制
app/Proj/Objects/Ringzle.axf


二進制
app/Proj/Objects/Ringzle.bin


+ 155 - 3
app/Proj/Objects/Ringzle.build_log.htm

@@ -22,13 +22,165 @@ Dialog DLL:      TCM.DLL V1.53.0.0
  
 <h2>Project:</h2>
 D:\project\dtu_gateway\app\Proj\Ringzle.uvprojx
-Project File Date:  10/25/2023
+Project File Date:  10/28/2023
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\software\MDK5\ARM\ARMCC\Bin'
 Build target 'GD32F103C8T6'
+compiling gd32f10x_it.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\parseDeviceMessage.h(13): warning:  #1295-D: Deprecated declaration Read_Data - give arg types
+  void Read_Data();
+..\App\gd32f10x_it.c: 2 warnings, 0 errors
+compiling ec800m.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\ec800m.c(53): warning:  #188-D: enumerated type mixed with another type
+  	bool timeoutFlag = false;
+..\App\ec800m.c(56): warning:  #188-D: enumerated type mixed with another type
+  		timeoutFlag = true;
+..\App\ec800m.c(70): warning:  #188-D: enumerated type mixed with another type
+  				return true;
+..\App\ec800m.c(77): warning:  #188-D: enumerated type mixed with another type
+  			return false;
+..\App\ec800m.c(121): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(command, CMD_SET_URL, strlen(url)); // CMD_SET_URL "%d\r\n"
+..\App\ec800m.c(128): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(134): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(141): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(151): warning:  #188-D: enumerated type mixed with another type
+  	return true;
+..\App\ec800m.c(163): warning:  #188-D: enumerated type mixed with another type
+  	bool success = false;
+..\App\ec800m.c(173): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(cmd, "AT+QMTCFG=\"qmtping\",0,%d\r\n", keepalive);
+..\App\ec800m.c(214): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf((char *)payload_out,"{\"deviceId\":\"%s\",\"data\":[",gateway->deviceId);//缁勬垚json澶撮儴
+..\App\ec800m.c(249): warning:  #111-D: statement is unreachable
+  								break;
+..\App\ec800m.c(344): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(AT_SUB, "AT+QMTSUB=0,1,\"%s\",0\r\n", commandTopic);
+..\App\ec800m.c(345): warning:  #188-D: enumerated type mixed with another type
+  	bool success = false;
+..\App\ec800m.c: 16 warnings, 0 errors
+compiling systick.c...
+compiling device_message.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\device_message.c(48): warning:  #940-D: missing return statement at end of non-void function "addGatewayParams" 
+  }
+..\App\device_message.c(135): warning:  #223-D: function "sscanf" declared implicitly
+            sscanf((const char *)&string[j * 2], "%2hhx", &byte);
+..\App\device_message.c(127): warning:  #177-D: variable "read_modbus_command"  was declared but never referenced
+  				READ_MODBUS_COMMAND *read_modbus_command =NULL;
+..\App\device_message.c(157): warning:  #177-D: variable "read_dlt645_command"  was declared but never referenced
+  				READ_DLT645_COMMAND *read_dlt645_command = NULL;
+..\App\device_message.c(221): warning:  #223-D: function "sscanf" declared implicitly
+      sscanf(ptr, "%[^\"],", value);
+..\App\device_message.c(222): warning:  #1-D: last line of file ends without a newline
+  }
+..\App\device_message.c: 7 warnings, 0 errors
+compiling mqttRecv.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\parseDeviceMessage.h(13): warning:  #1295-D: Deprecated declaration Read_Data - give arg types
+  void Read_Data();
+..\App\mqttRecv.c(25): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+          for (; i < strlen(UART0_RX_BUF); i++)
+..\App\mqttRecv.c(71): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+                  strcpy(json, (char *)json_buf); // 将JSON数据拷贝到输出缓冲区中
+..\App\mqttRecv.c: 4 warnings, 0 errors
+compiling parseDeviceMessage.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\parseDeviceMessage.h(13): warning:  #1295-D: Deprecated declaration Read_Data - give arg types
+  void Read_Data();
+..\App\parseDeviceMessage.c(71): warning:  #177-D: variable "temp"  was declared but never referenced
+  		char *temp;
+..\App\parseDeviceMessage.c(84): warning:  #940-D: missing return statement at end of non-void function "WaitForUpData" 
+  }
+..\App\parseDeviceMessage.c(205): warning:  #188-D: enumerated type mixed with another type
+  			mmodbus_set16bitOrder(currentDevice->MDBbigLittleFormat);               //璁剧疆澶у皬绔?
+..\App\parseDeviceMessage.c(379): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "uint8_t *"
+      while (MQTT_BUFFER_READ(json))
+..\App\parseDeviceMessage.c(387): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+          strcpy(action1, processStringData(mqtt_sub_json, "action"));
+..\App\parseDeviceMessage.c(440): warning:  #188-D: enumerated type mixed with another type
+  								mmodbus_set16bitOrder(currentDevice->MDBbigLittleFormat);
+..\App\parseDeviceMessage.c(520): warning:  #188-D: enumerated type mixed with another type
+  									mmodbus_set16bitOrder(currentDevice->MDBbigLittleFormat);
+..\App\parseDeviceMessage.c(528): warning:  #177-D: variable "value1"  was declared but never referenced
+                      uint8_t value1;
+..\App\parseDeviceMessage.c: 10 warnings, 0 errors
+compiling main.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\parseDeviceMessage.h(13): warning:  #1295-D: Deprecated declaration Read_Data - give arg types
+  void Read_Data();
+..\App\otaEvent.h(26): warning:  #1295-D: Deprecated declaration check_ota_event - give arg types
+  int8_t check_ota_event();
+..\App\main.c(66): warning:  #1295-D: Deprecated declaration fwdgt_init - give arg types
+  void fwdgt_init();
+..\App\main.c(67): warning:  #1295-D: Deprecated declaration task_fwdgt_reload - give arg types
+  void task_fwdgt_reload();
+..\App\main.c(104): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "uint8_t *"
+   	http_load_config(httpURL);
+..\App\main.c(216): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *"
+  	if (EC800MGetUrl(httpURL,dmabuffer,BufferSize) == true) // 从http获取信息,获取成功则保存到本地
+..\App\main.c: 7 warnings, 0 errors
+compiling PC.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\App\parseDeviceMessage.h(13): warning:  #1295-D: Deprecated declaration Read_Data - give arg types
+  void Read_Data();
+..\App\otaEvent.h(26): warning:  #1295-D: Deprecated declaration check_ota_event - give arg types
+  int8_t check_ota_event();
+..\App\PC.c(25): warning:  #1295-D: Deprecated declaration read_json_config - give arg types
+  void read_json_config();
+..\App\PC.c(264): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const uint8_t *"
+  	uint16_t CRC16=mmodbus_crc16(gatewayConfigData+1,strlen(gatewayConfigData)-1);
+..\App\PC.c(269): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "uint8_t *"
+  	gd_com_232_send(gatewayConfigData,strlen(gatewayConfigData));
+..\App\PC.c(426): warning:  #223-D: function "delay_1ms" declared implicitly
+  		delay_1ms(50);
+..\App\PC.c: 7 warnings, 0 errors
+compiling key.c...
+..\App\device_message.h(99): warning:  #1295-D: Deprecated declaration get_gateway_config_params - give arg types
+  GATEWAY_PARAMS *get_gateway_config_params();
+..\bsp\key.c: 1 warning, 0 errors
+compiling otaEvent.c...
+..\App\otaEvent.h(26): warning:  #1295-D: Deprecated declaration check_ota_event - give arg types
+  int8_t check_ota_event();
+..\App\otaEvent.c(45): warning:  #940-D: missing return statement at end of non-void function "check_ota_event" 
+  }
+..\App\otaEvent.c(78): warning:  #223-D: function "memcpy" declared implicitly
+  						memcpy(w25q32_data+128,ota_data.data + 3,128);
+..\App\otaEvent.c(80): warning:  #223-D: function "memset" declared implicitly
+  						memset(w25q32_data,0,256);
+..\App\otaEvent.c(84): warning:  #223-D: function "memcpy" declared implicitly
+  						memcpy(w25q32_data,ota_data.data + 3,128);
+..\App\otaEvent.c(88): warning:  #223-D: function "memset" declared implicitly
+  					memset(ota_data.data, 0, 133);
+..\App\otaEvent.c(96): warning:  #223-D: function "memset" declared implicitly
+  					memset(ota_data.data, 0, 133);
+..\App\otaEvent.c(127): warning:  #223-D: function "memset" declared implicitly
+  				memset(ota_data.data, 0, 133);
+..\App\otaEvent.c: 8 warnings, 0 errors
+compiling dlt645_port.c...
+..\dlt\port\dlt645_port.c(84): warning:  #223-D: function "memcpy" declared implicitly
+  			memcpy(msg, &(dlt645_port.rxBuf[4]), len-4);
+..\dlt\port\dlt645_port.c(103): warning:  #223-D: function "memset" declared implicitly
+  	memset(dlt645_port.rxBuf, 0, DLT_RXSIZE);
+..\dlt\port\dlt645_port.c: 2 warnings, 0 errors
+linking...
+Program Size: Code=31044 RO-data=1696 RW-data=224 ZI-data=83224  
+FromELF: creating hex file...
 After Build - User command #1: fromelf --bin --output ./Objects/Ringzle.bin ./Objects/Ringzle.axf
-".\Objects\Ringzle.axf" - 0 Error(s), 0 Warning(s).
+".\Objects\Ringzle.axf" - 0 Error(s), 64 Warning(s).
 
 <h2>Software Packages used:</h2>
 
@@ -41,7 +193,7 @@ Package Vendor: GigaDevice
   D:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include
 
 <h2>Collection of Component Files used:</h2>
-Build Time Elapsed:  00:00:01
+Build Time Elapsed:  00:00:05
 </pre>
 </body>
 </html>

File diff suppressed because it is too large
+ 699 - 747
app/Proj/Objects/Ringzle.htm


+ 2 - 2
app/Proj/Objects/Ringzle.sct

@@ -2,8 +2,8 @@
 ; *** Scatter-Loading Description File generated by uVision ***
 ; *************************************************************
 
-LR_IROM1 0x08005000 0x00100000  {    ; load region size_region
-  ER_IROM1 0x08005000 0x00100000  {  ; load address = execution address
+LR_IROM1 0x08037000 0x00100000  {    ; load region size_region
+  ER_IROM1 0x08037000 0x00100000  {  ; load address = execution address
    *.o (RESET, +First)
    *(InRoot$$Sections)
    .ANY (+RO)

File diff suppressed because it is too large
+ 24 - 24
app/Proj/Objects/Ringzle_GD32F103C8T6.dep


二進制
app/Proj/Objects/device_message.crf


二進制
app/Proj/Objects/dlt645_port.crf


二進制
app/Proj/Objects/ec800m.crf


二進制
app/Proj/Objects/gd32f10x_it.crf


二進制
app/Proj/Objects/key.crf


二進制
app/Proj/Objects/main.crf


二進制
app/Proj/Objects/mqttrecv.crf


二進制
app/Proj/Objects/otaevent.crf


二進制
app/Proj/Objects/parsedevicemessage.crf


二進制
app/Proj/Objects/pc.crf


二進制
app/Proj/Objects/systick.crf


File diff suppressed because it is too large
+ 1749 - 53
app/Proj/Ringzle.uvguix.IBM


+ 1 - 1
app/Proj/Ringzle.uvprojx

@@ -275,7 +275,7 @@
               </OCR_RVCT3>
               <OCR_RVCT4>
                 <Type>1</Type>
-                <StartAddress>0x8005000</StartAddress>
+                <StartAddress>0x8037000</StartAddress>
                 <Size>0x100000</Size>
               </OCR_RVCT4>
               <OCR_RVCT5>

+ 5 - 1
bootloader/.vscode/settings.json

@@ -8,6 +8,10 @@
         "delay.h": "c",
         "boot.h": "c",
         "stdint.h": "c",
-        "string.h": "c"
+        "string.h": "c",
+        "usart.h": "c",
+        "ota_message.h": "c",
+        "ec800m.h": "c",
+        "gd32f10x_it.h": "c"
     }
 }

+ 1 - 1
bootloader/CMSIS/Include/gd32f10x.h

@@ -41,7 +41,7 @@ OF SUCH DAMAGE.
 #ifdef cplusplus
  extern "C" {
 #endif 
-
+#define GD32F10X_XD
 /* define GD32F10x */
 #if !defined (GD32F10X_MD) && !defined (GD32F10X_HD) && !defined (GD32F10X_XD) && !defined (GD32F10X_CL)
   /* #define GD32F10X_MD */     /*!< GD32F10X_MD: GD32 Medium density devices */

+ 65 - 0
bootloader/HW/Include/ec800m.h

@@ -0,0 +1,65 @@
+#ifndef _EC800M_H
+#define _EC800M_H
+#include "gd32f10x.h"
+
+
+#define AT(cmd) "AT+"##cmd
+#define RSP_READY "RDY"
+#define RSP_OK "OK"
+#define RSP_CONNECT "CONNECT"
+
+#define CLIENTID "device_test"
+#define CMD_SET_PDP "AT+QICSGP=1,1,\"CTNET\",\"\",\"\",1\r\n" // UNINET?? CMNET?? CTNET??
+#define CMD_SET_ACTIVE "AT+QIACT=1\r\n"
+#define CMD_SET_URL "AT+QHTTPURL=%d\r\n"
+#define CMD_GET "AT+QHTTPGET=100\r\n"
+#define CMD_GET_TO_FILE "AT+QHTTPREADFILE=\"UFS:http.txt\",80\r\n"
+#define CMD_HTTP_GET "QHTTPGET:"
+#define CMD_READ_FILE "AT+QFDWL=http.txt\r\n"
+#define CMD_READ_OTA_MSG_FILE "AT+QFDWL=otaMSG.txt\r\n"
+#define CMD_READ_OTA_DATA_FILE "AT+QFDWL=otaDATA.txt\r\n"
+#define CMD_DEL_OTA_MSG_FILE "AT+QFDEL=otaMSG.txt\r\n"
+#define CMD_DEL_OTA_DATA_FILE "AT+QFDEL=otaDATA.txt\r\n"
+#define ATI "ATI"
+
+#define CMD_MQTT_DISCONNECT "AT+QMTDISC=0\r\n"
+// ??MQTT??3.1.1 ??????--4(mqtt 3.1.1 )3(mqtt 3.1)
+#define CMD_MQTT_VERSION "AT+QMTCFG=\"version\",0,4\r\n"
+#define CMD_MQTT_KEEPALIVE "AT+QMTCFG=\"qmtping\",0,30\r\n" // 30????
+#define CMD_MQTT_OPENET "AT+QMTOPEN=0,\"36.134.23.11\",1883\r\n"
+// #define	CMD_MQTT_CONNECT  "AT+QMTCONN=0,\"%s\",\"%s\",\"%s\"\r\n"//  ?????clientid,username,password
+#define CMD_MQTT_CONNECT "AT+QMTCONN=0,\"device_test\",\"\",\"\"\r\n"
+#define CMD_MQTT_RECEIVE "AT+QMTCFG=\"recv/mode\",0,0,1\r\n"
+#define CMD_MQTT_SEND "AT+QMTCFG=\"send/mode\",0,0,1\r\n"
+// ???? ???????--??????--
+#define CMD_MQTT_SUBSCRIBE "AT+QMTSUB=0,1,\"%s\",0\r\n" // ????????
+#define CMD_SERVICE_Operatortyp						"AT+COPS?\r\n"
+#define CMD_SERVICE_Networktyp						"AT+CREG?\r\n"//7
+#define CMD_SERVICE_Networkstatu					"AT+COPS?\r\n"
+#define CMD_SERVICE_SIMcardstatus					"AT+CLCK=\"SC\",2\r\n"
+#define CMD_SERVICE_SIMcardICCID					"AT+QCCID\r\n"
+#define CMD_SERVICE_IMEInumber						"AT+GSN\r\n"
+#define CMD_SERVICE_Signalstrength				"AT+CSQ\r\n"
+
+
+#define AT_CMD_HEAD 	"AT"
+#define AT_CMD_CFG 		"+QMTCFG="
+#define AT_CMD_TEST 	"?"
+#define AT_CMD_VER		"version"
+
+//#define AT_CMD_T 		"AT+QMTCFG=?\r\n"
+
+#define AT_CMD_T 		"ATI\r\n"
+
+
+#define true 1
+#define false 0
+
+void EC800MPwoerOn(void);
+void EC800MSendCmd(char *buf, uint16_t len);
+
+void EC800MWaitReady(void);
+
+bool WaitResponse(char * expectStr, int timeout);
+
+#endif

+ 4 - 9
bootloader/HW/Include/fmc.h

@@ -12,8 +12,8 @@ void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum);   //
 
 /// 移植修改区 ///
 
-/* FLASH大小:512K */
-#define GD32FLASH_SIZE  0X00080000UL
+/* FLASH大小:3MB */
+#define GD32FLASH_SIZE  0X00300000UL
 
 /* FLASH起始地址 */
 #define GD32FLASH_BASE  FLASH_BASE
@@ -21,19 +21,14 @@ void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum);   //
 /* FLASH结束地址 */
 #define GD32FLASH_END   (GD32FLASH_BASE | GD32FLASH_SIZE)
 
-/* FLASH页大小:2K */
-#define GD32FLASH_PAGE_SIZE (2048U)
+/* FALSH页大小 */
+#define GD32FLASH_PAGE_SIZE 1024
 
 /* FLASH总页数 */
 #define GD32FLASH_PAGE_NUM  (GD32FLASH_SIZE / GD32FLASH_PAGE_SIZE)
 
 /// 导出函数声明 
-void FLASH_Init(void);
 uint32_t FLASH_Read(uint32_t Address, void *Buffer, uint32_t Size);
-uint32_t FLASH_Write(uint32_t Address, const uint16_t *Buffer, uint32_t NumToWrite);
-int FLASH_ErasePage(uint32_t PageAddress, uint32_t NbPages);
-uint32_t FLASH_WriteNotErase(uint32_t Address, const uint16_t *Buffer, uint32_t NumToWrite);
-
 
 #endif
 

+ 3 - 0
bootloader/HW/Include/gd32f10x_it.h

@@ -60,4 +60,7 @@ void PendSV_Handler(void);
 /* this function handles SysTick exception */
 void SysTick_Handler(void);
 
+void USART0_IRQHandler(void);
+void DMA0_Channel4_IRQHandler(void);
+
 #endif /* GD32F10X_IT_H */

+ 85 - 0
bootloader/HW/Include/usart.h

@@ -0,0 +1,85 @@
+#ifndef USART_H
+#define USART_H
+
+#include "gd32f10x.h"
+
+typedef struct usart_data_buf_s
+{
+	uint8_t data[256];
+	uint16_t data_cnt;
+} usart_data_buf_t;
+
+#define DE485_PIN                        GPIO_PIN_8
+#define DE485_GPIO_PORT                  GPIOA
+#define DE485_GPIO_CLK                   RCU_GPIOB
+
+#define EC800M_PER_PIN                   GPIO_PIN_1
+#define EC800M_PER_GPIO_PORT             GPIOC
+#define EC800M_PER_GPIO_CLK              RCU_GPIOC
+
+#define EC800M_RST_PIN                   GPIO_PIN_8
+#define EC800M_RST_GPIO_PORT             GPIOB
+#define EC800M_RST_GPIO_CLK              RCU_GPIOB
+
+#define COMn                             3U
+
+#define COM_EC800                        USART0 //USART1 EC800
+#define COM_EC800_CLK                    RCU_USART0
+#define COM_EC800_TX_PIN                 GPIO_PIN_9
+#define COM_EC800_RX_PIN                 GPIO_PIN_10
+#define COM_EC800_GPIO_PORT              GPIOA
+#define COM_EC800_GPIO_CLK               RCU_GPIOA
+#define COM_EC800_IT_HANDLER             USART0_IRQn
+#define COM_EC800_BAUDRATE							 115200
+
+#define COM_485	                       USART1 //UART2 J2 RS485
+#define COM_485_CLK                    RCU_USART1
+#define COM_485_TX_PIN                 GPIO_PIN_2
+#define COM_485_RX_PIN                 GPIO_PIN_3
+#define COM_485_GPIO_PORT              GPIOA
+#define COM_485_GPIO_CLK               RCU_GPIOA
+#define COM_485_IT_HANDLER             USART1_IRQn
+#define COM_485_BAUDRATE				 				2400
+
+#define COM_232                        USART2 //UART3 J3
+#define COM_232_CLK                    RCU_USART2
+#define COM_232_TX_PIN                 GPIO_PIN_8
+#define COM_232_RX_PIN                 GPIO_PIN_9
+#define COM_232_GPIO_PORT              GPIOD
+#define COM_232_GPIO_CLK               RCU_GPIOD
+#define COM_232_IT_HANDLER             USART2_IRQn
+#define COM_232_BAUDRATE							 115200
+
+//extern usart_data_buf_t usart0_rx_buf;
+//extern usart_data_buf_t usart0_tx_buf;
+
+//extern usart_data_buf_t usart1_rx_buf;
+//extern usart_data_buf_t usart1_tx_buf;
+
+/* configure COM port */
+void gd_com_init(uint32_t com);
+
+void gd_EC800M_pin_init(void);
+
+void gd_pull_EC800M_pwr_up(void);
+
+void gd_pull_EC800M_pwr_down(void);
+
+void gd_pull_EC800M_rst_up(void);
+
+void gd_pull_EC800M_rst_down(void);
+
+void dma_config(void);
+void Clear_DMA_Buffer(void);
+#define UART0_RX_LEN		1024 * 4	
+extern uint8_t UART0_RX_BUF[UART0_RX_LEN];
+extern uint8_t UART0_RX_STAT ;					
+extern uint32_t UART0_RX_NUM ;	
+extern uint8_t UART0_RX_MQTT_SUB_STAT;
+
+	
+void gd_com_sendByte( uint8_t com, uint8_t ch);
+void gd_com_send( uint32_t com, uint8_t *Buf,uint16_t size);
+void nvic_config(void);
+void dma_config_change(char *dmaBuffer,uint32_t bufferSize);
+#endif   

+ 14 - 13
bootloader/HW/Source/boot.c

@@ -11,26 +11,27 @@
 load_a load_A;       
 
 //进入bootloader更新
-void BootLoader_Brance(uint32_t download_byte)
+void BootLoader_Brance(uint32_t app_byte)
 {
 	GD32_EraseFlash(GD32_A_START_PAGE,GD32_A_PAGE_NUM);//擦除A区原有程序
-	for(uint8_t i=0;i<download_byte/GD32_PAGE_SIZE;i++)
+	for(uint8_t i=0;i<app_byte/1024;i++)
 	{
 		task_fwdgt_reload();
-		uint8_t app_programmer[GD32_PAGE_SIZE];
-		memset(app_programmer,0,GD32_PAGE_SIZE);
-		FLASH_Read(GD32_D_SADDR,app_programmer,GD32_PAGE_SIZE);              
-		FLASH_Write(GD32_A_SADDR+i*GD32_PAGE_SIZE,(uint16_t *)&app_programmer,GD32_PAGE_SIZE/2);	//将读出的数据按页写入数据
+		uint8_t app_programmer[1024];
+		memset(app_programmer,0,1024);
+		uint32_t addr=APP_PROGRAMMER_BLOCK*64*1024+i*1024;   //其在w25q32中的地址
+		W25Q32_Read(app_programmer,addr,1024);               
+		GD32_WriteFlash(GD32_A_SADDR+i*1024,(uint32_t *)&app_programmer,1024); //将读出的数据按页写入数据
 	}
 	//将不满1024数据单独写入
-	if(download_byte%GD32_PAGE_SIZE!=0)
+	if(app_byte%1024!=0)
 	{
-		uint32_t startAddress=(download_byte/GD32_PAGE_SIZE)*GD32_PAGE_SIZE;
-		uint8_t app_programmer[GD32_PAGE_SIZE];
-		uint32_t addr=GD32_D_SADDR+startAddress;   														//其在w25q32中的地址
-		memset(app_programmer,0,GD32_PAGE_SIZE);
-		FLASH_Read(addr,app_programmer,GD32_PAGE_SIZE);              
-		FLASH_Write(GD32_A_SADDR+startAddress,(uint16_t *)&app_programmer,GD32_PAGE_SIZE/2);	//将读出的数据按页写入数据
+		uint32_t startAddress=(app_byte/1024)*1024;
+		uint8_t app_programmer[1024];
+		uint32_t addr=APP_PROGRAMMER_BLOCK*64*1024+(app_byte/1024)*1024;   														//其在w25q32中的地址
+		memset(app_programmer,0,1024);
+		W25Q32_Read(app_programmer,addr,app_byte%1024);																					
+		GD32_WriteFlash(GD32_A_SADDR+(app_byte/1024)*1024,(uint32_t *)&app_programmer,app_byte%1024);
 	}
 	clear_ota_message_config_block();  
 	LOAD_A(GD32_A_SADDR);

+ 80 - 0
bootloader/HW/Source/ec800m.c

@@ -0,0 +1,80 @@
+#include "ec800m.h"
+#include "usart.h"
+#include "string.h"
+#include "delay.h"
+
+
+void EC800MPwoerOn(void)
+{
+	rcu_periph_clock_enable(RCU_GPIOD);
+	gpio_init(GPIOD, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_2);
+	gpio_bit_set(GPIOD,GPIO_PIN_2);
+	Delay_Ms(5000);
+	gd_pull_EC800M_pwr_up();
+	gd_pull_EC800M_rst_down();
+	Delay_Ms(50);
+	gd_pull_EC800M_pwr_down();
+	Delay_Ms(320);
+	gd_pull_EC800M_rst_up();
+	Delay_Ms(800);
+	gd_pull_EC800M_pwr_up();
+}
+
+void EC800MSendCmd(char *buf, uint16_t len)
+{
+	uint16_t i;
+	uint16_t data;
+	for (i = 0; i < len; i++)
+	{
+		data = buf[i];
+		usart_data_transmit(COM_EC800, data);
+		while (RESET == usart_flag_get(COM_EC800, USART_FLAG_TBE))
+			;
+	}
+}
+
+void EC800MWaitReady()
+{
+	WaitResponse(RSP_READY, 5000);
+}
+
+/*
+ *  函数名:bool WaitResponse(char *expectStr, int timeout)
+ *  输入参数:expectStr 需要匹配的关键�? timeout超时时间
+ *  输出参数:true flase
+ *  返回值:�?
+ *  函数作用:从UART0_RX_BUF缓冲区中匹配有无对应关键字有关键字则返回true无返回false
+ */
+bool WaitResponse(char *expectStr, int timeout)
+{
+	bool timeoutFlag = false;
+	if (timeout >= 0)
+	{
+		timeoutFlag = true;
+	}
+	// gd_485_send((char *)&UART0_RX_BUF, strlen(UART0_RX_BUF)); 不清楚�?��?�调�?485意义
+
+	while (1)
+	{
+		Delay_Ms(50);
+		if (UART0_RX_STAT > 0)
+		{
+			UART0_RX_STAT = 0;
+			char *p = strstr((char *)&UART0_RX_BUF, expectStr);
+			if (p)
+			{
+				Clear_DMA_Buffer();
+				return true;
+			}
+		}
+		timeout -= 50;
+		if (timeoutFlag == true && timeout <= 0)
+		{
+			Clear_DMA_Buffer();
+			return false;
+		}
+	};
+}
+
+
+

+ 6 - 212
bootloader/HW/Source/fmc.c

@@ -2,61 +2,19 @@
 #include "fmc.h"
 
 
-/*--------------------------------------------------*/
-/*函数名:按页擦除FLASH     							 */
-/*参  数:start:擦除起始页   num:擦几个页    		   */
-/*返回值:无                                         */
-/*
-flash结构:
-0x08000000~0x0807FFFF   bank0(2KB一页,0~255页,共256页)共512KB
-0x08080000~0x082FFFFF   bank1(4KB一页,256~895页,共640页)共2.5MB	这个分区连续读内存需要有延时
-*/
+/*-------------------------------------------------*/
+/*函数名:擦除FLASH                                */
+/*参  数:start:擦除起始扇区   num:擦几个扇区    */
+/*返回值:无                                       */
 /*-------------------------------------------------*/
 void GD32_EraseFlash(uint16_t start, uint16_t num)
 {
 	uint16_t i;        //用于for循环
-	uint16_t j = 0;        
-
-	if ((start <= 896) && (start + num) > 896)
-	{
-		num = 896 - start;
-	}
-	else if (start > 896)
-	{
-		return;
-	}
 
 	fmc_unlock();                                                       //解锁
-	if ((start < 256) && ((start + num) < 256))
-	{
-		for(i = 0; i < num; i++)										//循环num次,一个页一个页的擦除
-		{
-			fmc_page_erase((0x08000000 + start * 2048) + (2048 * i));   //擦除bank0一个页2KB
-		}
+	for(i=0;i<num;i++){                                                 //循环num次,一个扇区一个扇区的擦除
+		fmc_page_erase((0x08000000 + start * 1024) + (1024 * i));       //擦除一个扇区
 	}
-	else if ((start < 256) && ((start + num) > 256))
-	{
-		for(i = 0; i < num; i++)										//循环num次,一个页一个页的擦除
-		{
-			if((start + i) < 256)
-			{
-				fmc_page_erase((0x08000000 + start * 2 * 1024) + (2 * 1024 * i));       //擦除bank0一个页2KB
-			}
-			else
-			{
-				fmc_page_erase(0x08080000 + (4 * 1024 * j));       //擦除bank1一个页4KB
-				j++;
-			}
-		}
-	}
-	else if (start > 256)
-	{
-		for(i = 0; i < num; i++)										//循环num次,一个页一个页的擦除
-		{
-			fmc_page_erase((0x08080000 + (start - 256) * 4 * 1024) + (4 * 1024 * i));   //擦除bank1一个页4KB
-		}
-	}
-	
 	fmc_lock();                                                         //上锁
 } 
 /*---------------------------------------------------------------------*/
@@ -77,30 +35,6 @@ void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum)
 }
 
 
-// /**
-//  * @brief 读取flash数据
-//  * 
-//  * @param rbuff 接收缓冲区
-//  * @param addr 起始地址,32位地址
-//  * @param datalen 数据长度,多少个字节
-//  */
-// void GD32_ReadFlash(uint8_t *rbuff, uint32_t addr, uint32_t datalen)
-// {
-// 	memcpy(rbuff,addr,datalen);
-// }
-
-
-__align(4) static uint16_t FlashBuffer[GD32FLASH_PAGE_SIZE >> 1];
-
-/// 初始化FLASH
-void FLASH_Init(void)
-{
-    fmc_unlock();
-    fmc_flag_clear(FMC_FLAG_BANK0_END);
-    fmc_flag_clear(FMC_FLAG_BANK0_WPERR);
-    fmc_flag_clear(FMC_FLAG_BANK0_PGERR);
-    fmc_lock();
-}
 
 /**
  * 读FLASH
@@ -135,143 +69,3 @@ uint32_t FLASH_Read(uint32_t Address, void *Buffer, uint32_t Size)
     return Size - nread;
 }
 
-/**
- * 写FLASH
- * @param  Address    写入起始地址,!!!要求2字节对齐!!!
- * @param  Buffer     待写入的数据,!!!要求2字节对齐!!!
- * @param  NumToWrite 要写入的数据量,单位:半字,!!!要求2字节对齐!!!
- * @return            实际写入的数据量,单位:字节
- */
-uint32_t FLASH_Write(uint32_t Address, const uint16_t *Buffer, uint32_t NumToWrite)
-{
-    uint32_t i = 0;
-    uint32_t pagepos = 0;         // 页位置
-    uint32_t pageoff = 0;         // 页内偏移地址
-    uint32_t pagefre = 0;         // 页内空余空间
-    uint32_t offset = 0;          // Address在FLASH中的偏移
-    uint32_t nwrite = NumToWrite; // 记录剩余要写入的数据量
-    const uint16_t *pBuffer = (const uint16_t *)Buffer;
-
-    /* 非法地址 */
-    if (Address < GD32FLASH_BASE || Address > (GD32FLASH_END - 2) || NumToWrite == 0 || pBuffer == NULL)
-        return 0;
-
-    /* 解锁FLASH */
-    fmc_unlock();
-
-    /* 计算偏移地址 */
-    offset = Address - GD32FLASH_BASE;
-
-    /* 计算当前页位置 */
-    pagepos = offset / GD32FLASH_PAGE_SIZE;
-
-    /* 计算要写数据的起始地址在当前页内的偏移地址 */
-    pageoff = ((offset % GD32FLASH_PAGE_SIZE) >> 1);
-
-    /* 计算当前页内空余空间 */
-    pagefre = ((GD32FLASH_PAGE_SIZE >> 1) - pageoff);
-
-    /* 要写入的数据量低于当前页空余量 */
-    if (nwrite <= pagefre)
-        pagefre = nwrite;
-
-    while (nwrite != 0)
-    {
-        /* 检查是否超页 */
-        if (pagepos >= GD32FLASH_PAGE_NUM)
-            break;
-
-        /* 读取一页 */
-        FLASH_Read(GD32FLASH_BASE + pagepos * GD32FLASH_PAGE_SIZE, FlashBuffer, GD32FLASH_PAGE_SIZE);
-
-        /* 检查是否需要擦除 */
-        for (i = 0; i < pagefre; i++)
-        {
-            if (*(FlashBuffer + pageoff + i) != 0xFFFF) /* FLASH擦出后默认内容全为0xFF */
-                break;
-        }
-
-        if (i < pagefre)
-        {
-            uint32_t count = 0;
-            uint32_t index = 0;
-
-            if(FLASH_ErasePage(GD32FLASH_BASE + pagepos * GD32FLASH_PAGE_SIZE, 1) < 0)
-                break;
-
-            /* 复制到缓存 */
-            for (index = 0; index < pagefre; index++)
-            {
-                *(FlashBuffer + pageoff + index) = *(pBuffer + index);
-            }
-
-            /* 写回FLASH */
-            count = FLASH_WriteNotErase(GD32FLASH_BASE + pagepos * GD32FLASH_PAGE_SIZE, FlashBuffer, GD32FLASH_PAGE_SIZE >> 1);
-            if (count != (GD32FLASH_PAGE_SIZE >> 1))
-            {
-                nwrite -= count;
-                break;
-            }
-        }
-        else
-        {
-            /* 无需擦除,直接写 */
-            uint32_t count = FLASH_WriteNotErase(Address, pBuffer, pagefre);
-            if (count != pagefre)
-            {
-                nwrite -= count;
-                break;
-            }
-        }
-
-        pBuffer += pagefre;         /* 读取地址递增         */
-        Address += (pagefre << 1);  /* 写入地址递增         */
-        nwrite -= pagefre;          /* 更新剩余未写入数据量 */
-
-        pagepos++;     /* 下一页           */
-        pageoff = 0;   /* 页内偏移地址置零  */
-
-        /* 根据剩余量计算下次写入数据量 */
-        pagefre = nwrite >= (GD32FLASH_PAGE_SIZE >> 1) ? (GD32FLASH_PAGE_SIZE >> 1) : nwrite;
-    }
-
-    /* 加锁FLASH */
-    fmc_lock();
-
-    return ((NumToWrite - nwrite) << 1);
-}
-
-uint32_t FLASH_WriteNotErase(uint32_t Address, const uint16_t *Buffer, uint32_t NumToWrite)
-{
-    uint32_t nwrite = NumToWrite;
-    uint32_t addrmax = GD32FLASH_END - 2;
-
-    while (nwrite)
-    {
-        if (Address > addrmax)
-            break;
-
-        fmc_halfword_program(Address, *Buffer);
-        
-        if ((*(__IO uint16_t*) Address) != *Buffer)
-            break;
-
-        nwrite--;
-        Buffer++;
-        Address += 2;
-    }
-    return (NumToWrite - nwrite);
-}
-
-int FLASH_ErasePage(uint32_t PageAddress, uint32_t NbPages)
-{
-    while(NbPages--)
-    {
-        if(fmc_page_erase(PageAddress) != FMC_READY)
-        {
-            return -1;
-        }
-        PageAddress += GD32FLASH_PAGE_SIZE;
-    }
-    return 0;
-}

+ 23 - 20
bootloader/HW/Source/gd32f10x_it.c

@@ -35,26 +35,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
 OF SUCH DAMAGE.
 */
 #include "gd32f10x_it.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#include "usart.h"
 
 /*!
     \brief      this function handles NMI exception
@@ -158,3 +139,25 @@ void SysTick_Handler(void)
 {
 
 }
+
+// 4G模块
+void USART0_IRQHandler(void)
+{
+    if (RESET != usart_interrupt_flag_get(USART0, USART_INT_FLAG_IDLE)) // 空闲中断
+    {
+        usart_interrupt_flag_clear(USART0, USART_INT_FLAG_IDLE); /* 清除空闲中断标志位 */
+        usart_data_receive(USART0);                              /* 清除接收完成标志位 */
+        dma_channel_disable(DMA0, DMA_CH4);                      /* 关闭DMA传输 */
+//        UART0_RX_NUM = sizeof(UART0_RX_BUF) - dma_transfer_number_get(DMA0, DMA_CH4);
+//        UART0_RX_BUF[UART0_RX_NUM] = '\0'; /* 添加字符串结束符 */
+        UART0_RX_STAT = 0x01;              /* 接受状态 0x01:已接收到数据 */
+//        dma_memory_address_config(DMA0, DMA_CH4, (uint32_t)UART0_RX_BUF);
+//        dma_transfer_number_config(DMA0, DMA_CH4, sizeof(UART0_RX_BUF));
+			  dma_channel_enable(DMA0, DMA_CH4);			  
+    }
+}
+
+void DMA0_Channel4_IRQHandler(void)
+{
+	dma_interrupt_flag_clear(DMA0, DMA_CH4, DMA_INT_FLAG_G);
+}

+ 136 - 10
bootloader/HW/Source/ota_message.c

@@ -1,6 +1,9 @@
 #include "ota_message.h"
 #include "gd32f10x.h"
 #include "w25q32.h"
+#include "ec800m.h"
+#include "usart.h"
+#include "delay.h"
 #include <stdio.h>
 static OTA_MESSAGE ota_message = {0};
 void clear_ota_message_config_block(void);
@@ -27,7 +30,93 @@ int save_ota_message_config_params(OTA_MESSAGE *params)
 		return 0;
 }
 
+// 模块下载download校验值
+static uint16_t checksum(const char *str, uint16_t len)
+{
+  uint16_t sum = 0;
+  uint8_t odd = 0;
+
+  // 如果字符串长度为奇数,则将最后一个字符设置为高8位,低8位设置为0
+  if (len % 2 == 1)
+  {
+    odd = 1;
+    len--;
+  }
 
+  // 将每两个字符作为一个16位的数值进行异或操作
+  for (uint16_t i = 0; i < len; i += 2)
+  {
+    sum ^= ((uint16_t)str[i] << 8) | (uint16_t)str[i + 1];
+  }
+
+  // 如果字符串长度为奇数,则还需要将最后一个字符与0xFF00异或
+  if (odd)
+  {
+    sum ^= (uint16_t)str[len] << 8;
+  }
+  // 返回校验和
+  return sum;
+}
+
+/*
+ *  函数名:static void extract_data_from_buffer(const char* buffer, uint32_t *len_ptr, uint16_t *checkCode_ptr)
+ *  输入参数:buffer字符串
+ *  输出参数:json有效字符串长度len_ptr,checkCode_ptr校验码指针
+ *  返回值:无
+ *  函数作用:eg.   QFDWL: 621,3e23  从json信息最后端取出这段json的有效长度和校验码
+ */
+static void extract_data_from_buffer(const char *buffer, uint32_t *len_ptr, uint16_t *checkCode_ptr)
+{
+  char *start = strstr(buffer, "+QFDWL:");
+  if (start != NULL)
+  {
+    start += 8; // 跳过"+QFDWL:"
+    uint32_t len = 0;
+    sscanf(start, "%u,", &len);     // 读取长度
+    start = strchr(start, ',') + 1; // 跳过逗号
+    uint16_t checkCode = 0;
+    sscanf(start, "%hx", &checkCode); // 读取16进制数据
+    // 将提取的数据存入形参
+    *len_ptr = len;
+    *checkCode_ptr = checkCode;
+  }
+}
+
+bool WaitForUpData(char *dmaBuffer)
+{
+	if (UART0_RX_STAT > 0)
+  	{
+		UART0_RX_STAT = 0;
+		uint32_t len;
+		uint16_t checkCode;
+			char *temp;
+		extract_data_from_buffer(dmaBuffer, &len, &checkCode);
+		uint16_t jsonCheck = checksum(dmaBuffer, len);
+		if (checkCode == jsonCheck)
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
+
+// 提取string字符串
+void parseStringField(const char *data, const char *field, char *value)
+{
+    char *ptr = strstr(data, field) + strlen(field);
+    sscanf(ptr, "%[^\"],", value);
+}
+// 提取int数据如果没有提取到数据则返回-1;提取到返回正确的值
+int parseIntField(const char *data, const char *field)
+{
+    char *ptr = strstr(data, field) + strlen(field);
+    int value;
+    value = strtol(ptr, &ptr, 10);
+    return value;
+}
 
 /*
  *  函数名:load_config_params(CONFIG_PARAMS *params)
@@ -38,15 +127,32 @@ int save_ota_message_config_params(OTA_MESSAGE *params)
  */
 int load_ota_message_config_params()
 {
-		memset(&ota_message, 0, sizeof(OTA_MESSAGE));//清空原先数据
-		// W25Q32_Read((uint8_t *)&ota_message, OTA_EVENT_BLOCK*64*1024, sizeof(OTA_MESSAGE)); //从W25Q32中读取结构体数据
-		FLASH_Read(OTA_EVENT_START_ADDR,&ota_message,sizeof(OTA_MESSAGE));
-		uint32_t *ptr=(uint32_t *)&ota_message;           
-		if(*ptr == 1U)
-		{
-			return 0;
-		}
-		else return -1;
+	//检查校验码
+	uint32_t BufferSize=1024;//最大获取的数据空间
+	char *dmabuffer=malloc(BufferSize);
+	__LOAD_CONFIG:
+	// get data from UFS
+	dma_config_change(dmabuffer,BufferSize);
+	Delay_Ms(1000);
+	EC800MSendCmd(CMD_READ_OTA_MSG_FILE, strlen(CMD_READ_OTA_MSG_FILE)); //"AT+QFDWL=otaMSG.txt\r\n"
+	Delay_Ms(1000);
+	dma_config();
+	if(WaitForUpData(dmabuffer) == false) goto __LOAD_CONFIG;
+	// W25Q32_Read((uint8_t *)&ota_message, OTA_EVENT_BLOCK*64*1024, sizeof(OTA_MESSAGE)); //从W25Q32中读取结构体数据
+	// FLASH_Read(OTA_EVENT_START_ADDR,&ota_message,sizeof(OTA_MESSAGE));
+
+	if(parseIntField(dmabuffer,"\"otaflag\":") == 1U)
+	{
+		ota_message.otaflag = 1;
+		ota_message.XmodemByte = parseIntField(dmabuffer,"\"XmodemByte\":");
+		free(dmabuffer);
+		return 0;
+	}
+	else 
+	{
+		free(dmabuffer);
+		return -1;
+	}
 }
 OTA_MESSAGE *get_config_params()
 {
@@ -61,5 +167,25 @@ OTA_MESSAGE *get_config_params()
  */
 void clear_ota_message_config_block(void)
 {
-	GD32_EraseFlash(210,1);//擦除一块区域的大小
+	// W25Q32_Erase64K(OTA_EVENT_BLOCK);//擦除一块区域的大小
+	//AT+QFDEL="UFS:1.txt" 
+	char string[] = "{otaflag:0,XmodemByte:0}"; 
+	char OPEN_NEW_FILE[] = "AT+QFOPEN=\"otaMSG.txt\",1\r\n";
+	char WRITEFILE[] = "AT+QFWRITE=1,8\r\n";
+	char CLOSEFILE[] = "AT+QFCLOSE=1\r\n";
+	char LOADFILE[] = "AT+QFDWL=otaMSG.txt\r\n";
+
+	EC800MSendCmd(OPEN_NEW_FILE,strlen(OPEN_NEW_FILE));
+	WaitResponse("QFOPEN:", 2000);
+
+	EC800MSendCmd(WRITEFILE,strlen(WRITEFILE));
+	WaitResponse("CONNECT", 2000);
+
+	EC800MSendCmd(string,strlen(string));
+	WaitResponse("QFWRITE", 2000);
+
+	EC800MSendCmd(CLOSEFILE,strlen(CLOSEFILE));
+	WaitResponse("OK", 2000);
+
+	// EC800MSendCmd("AT+QFDEL=\"UFS:otaMSG.txt\r\n\"",27);	//删除文件
 }

+ 207 - 0
bootloader/HW/Source/usart.c

@@ -0,0 +1,207 @@
+#include "usart.h"
+
+
+    /*  \arg        COM_EC800:   EC800
+        \arg        COM_485: 485
+	    \arg        COM_232: 232
+    */
+static rcu_periph_enum COM_CLK[COMn] = {COM_EC800_CLK, COM_485_CLK, COM_232_CLK};
+static uint32_t COM_TX_PIN[COMn] = {COM_EC800_TX_PIN, COM_485_TX_PIN, COM_232_TX_PIN};
+static uint32_t COM_RX_PIN[COMn] = {COM_EC800_RX_PIN, COM_485_RX_PIN, COM_232_RX_PIN};
+static uint32_t COM_GPIO_PORT[COMn] = {COM_EC800_GPIO_PORT, COM_485_GPIO_PORT, COM_232_GPIO_PORT};
+static rcu_periph_enum COM_GPIO_CLK[COMn] = {COM_EC800_GPIO_CLK, COM_485_GPIO_CLK, COM_232_GPIO_CLK};	  
+static uint32_t COM_IT_HANDLER[COMn] = {COM_EC800_IT_HANDLER, COM_485_IT_HANDLER, COM_232_IT_HANDLER};
+static uint32_t COM_BAUDTATE[COMn]={COM_EC800_BAUDRATE,COM_485_BAUDRATE,COM_232_BAUDRATE};
+
+		
+uint8_t UART0_RX_BUF[UART0_RX_LEN];
+uint8_t UART0_RX_STAT = 0;
+uint8_t UART0_RX_MQTT_SUB_STAT=0;            //mqttt订阅信息标志位
+uint32_t UART0_RX_NUM = 0;	
+
+usart_data_buf_t usart1_rx_buf;
+//清除dma buffer内数据
+void Clear_DMA_Buffer(void)
+{
+   UART0_RX_NUM=0;
+   memset(UART0_RX_BUF,0,UART0_RX_LEN);
+}
+
+
+/*!
+    \brief      configure COM port
+    \param[in]  com: COM on the board
+        \arg        COM_EC800:   EC800
+        \arg        COM_485: 485
+	    \arg        COM_232: 232
+    \param[out] none
+    \retval     none
+*/
+void gd_com_init(uint32_t com)
+{
+    uint32_t com_id = 0U;
+    if(COM_EC800 == com)
+	{
+        com_id = 0U;
+    }
+	else if(COM_485 == com)
+	{
+		com_id=1U;
+	}
+	else if(COM_232 == com)
+	{
+        com_id = 2U;
+		//重映射usart2端口
+				rcu_periph_clock_enable(RCU_AF);
+				gpio_pin_remap_config(GPIO_USART2_FULL_REMAP, ENABLE);
+    }
+
+	//nvic_irq_enable(COM_IT_HANDLER[com_id], 0, 0);
+    
+    /* enable GPIO clock */
+				
+    rcu_periph_clock_enable(COM_GPIO_CLK[com_id]);
+
+    /* enable USART clock */
+    rcu_periph_clock_enable(COM_CLK[com_id]);
+		
+		
+    /* connect port to USARTx_Tx */
+    gpio_init(COM_GPIO_PORT[com_id], GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, COM_TX_PIN[com_id]);
+
+    /* connect port to USARTx_Rx */
+    gpio_init(COM_GPIO_PORT[com_id], GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, COM_RX_PIN[com_id]);
+		
+		
+    /* USART configure */
+    usart_deinit(com);
+    usart_baudrate_set(com, COM_BAUDTATE[com_id]);
+    usart_word_length_set(com, USART_WL_8BIT);
+    usart_stop_bit_set(com, USART_STB_1BIT);
+    usart_parity_config(com, USART_PM_NONE);
+    usart_hardware_flow_rts_config(com, USART_RTS_DISABLE);
+    usart_hardware_flow_cts_config(com, USART_CTS_DISABLE);
+    usart_receive_config(com, USART_RECEIVE_ENABLE);
+    usart_transmit_config(com, USART_TRANSMIT_ENABLE);
+    usart_enable(com);
+	// usart_interrupt_enable(com, USART_INT_TBE);
+	  usart_interrupt_enable(com, USART_INT_RBNE);
+   	usart_interrupt_enable(com, USART_INT_IDLE);
+    
+}
+
+/*!
+    \brief      configure EC800M pin
+    \param[out] none 
+    \retval     none
+*/
+void gd_EC800M_pin_init(void)
+{
+    /* enable the EC800M power pin clock */
+    rcu_periph_clock_enable(EC800M_PER_GPIO_CLK);
+    /* configure EC800M GPIO port */ 
+    gpio_init(EC800M_PER_GPIO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, EC800M_PER_PIN);
+
+    GPIO_BC(EC800M_PER_GPIO_PORT) = EC800M_PER_PIN;
+
+    /* enable the EC800M reset pin clock */
+    rcu_periph_clock_enable(EC800M_RST_GPIO_CLK);
+    /* configure EC800M GPIO port */ 
+    gpio_init(EC800M_RST_GPIO_PORT, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, EC800M_RST_PIN);
+
+    GPIO_BC(EC800M_RST_GPIO_PORT) = EC800M_RST_PIN;
+    
+}
+
+void gd_pull_EC800M_pwr_up(void)
+{
+	GPIO_BOP(EC800M_PER_GPIO_PORT) = EC800M_PER_PIN;
+}
+
+void gd_pull_EC800M_pwr_down(void)
+{
+	GPIO_BC(EC800M_PER_GPIO_PORT) = EC800M_PER_PIN;
+}
+
+void gd_pull_EC800M_rst_up(void)
+{
+	GPIO_BOP(EC800M_RST_GPIO_PORT) = EC800M_RST_PIN;
+}
+
+void gd_pull_EC800M_rst_down(void)
+{
+	GPIO_BC(EC800M_RST_GPIO_PORT) = EC800M_RST_PIN;
+}
+
+////////////////////////////////////////////////////////////////////
+//默认的dma配置
+void dma_config(void)
+{
+    dma_parameter_struct dma_init_struct;
+
+    rcu_periph_clock_enable(RCU_DMA0);
+
+    dma_deinit(DMA0, DMA_CH4);
+    dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY;		
+    dma_init_struct.memory_addr = (uint32_t)UART0_RX_BUF;		
+    dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE;	
+    dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT;		
+    dma_init_struct.number = UART0_RX_LEN;						
+    dma_init_struct.periph_addr = (uint32_t)(&USART_DATA(USART0));// ((uint32_t)0x40013804);		
+    dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE;	
+    dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT;	
+    dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;			
+    dma_init(DMA0, DMA_CH4, &dma_init_struct);
+    
+    dma_circulation_disable(DMA0, DMA_CH4);
+    dma_memory_to_memory_disable(DMA0, DMA_CH4);
+
+    usart_dma_transmit_config(USART0, USART_DENT_ENABLE|USART_DENR_ENABLE);
+		//nvic_irq_enable(DMA0_Channel4_IRQn, 2, 2);
+	
+    dma_interrupt_enable(DMA0, DMA_CH4, DMA_INT_FTF|DMA_INT_HTF|DMA_INT_ERR);
+    dma_channel_enable(DMA0, DMA_CH4);
+	 
+
+}
+//手动控制dma搬运的数据地址和大小,在使用完成后需要恢复到默认的dma配置
+void dma_config_change(char *dmaBuffer,uint32_t bufferSize)
+{
+	  dma_parameter_struct dma_init_struct;
+
+    rcu_periph_clock_enable(RCU_DMA0);
+
+    dma_deinit(DMA0, DMA_CH4);
+    dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY;		
+    dma_init_struct.memory_addr = (uint32_t)dmaBuffer;		
+    dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE;	
+    dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT;		
+    dma_init_struct.number = bufferSize;						
+    dma_init_struct.periph_addr = (uint32_t)(&USART_DATA(USART0));// ((uint32_t)0x40013804);		
+    dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE;	
+    dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT;	
+    dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;			
+    dma_init(DMA0, DMA_CH4, &dma_init_struct);
+    
+    dma_circulation_disable(DMA0, DMA_CH4);
+    dma_memory_to_memory_disable(DMA0, DMA_CH4);
+
+    usart_dma_transmit_config(USART0, USART_DENT_ENABLE|USART_DENR_ENABLE);
+		//nvic_irq_enable(DMA0_Channel4_IRQn, 2, 2);
+	
+    dma_interrupt_enable(DMA0, DMA_CH4, DMA_INT_FTF|DMA_INT_ERR);
+    dma_channel_enable(DMA0, DMA_CH4);
+}
+
+
+void nvic_config(void)
+{
+    nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);  // 设置抢占优先级和子优先级的位数为 2
+		nvic_irq_enable(USART0_IRQn, 0, 0);
+		// nvic_irq_enable(USART1_IRQn, 1, 0);
+		// nvic_irq_enable(USART2_IRQn, 2, 0);
+		nvic_irq_enable(DMA0_Channel4_IRQn, 2, 1);
+	
+}
+
+

二進制
bootloader/OBJ/boot.crf


二進制
bootloader/OBJ/bootloader.axf


+ 22 - 12
bootloader/OBJ/bootloader.build_log.htm

@@ -22,31 +22,41 @@ Dialog DLL:      TCM.DLL V1.53.0.0
  
 <h2>Project:</h2>
 D:\project\dtu_gateway\bootloader\USER\bootloader.uvprojx
-Project File Date:  10/27/2023
+Project File Date:  10/28/2023
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\software\MDK5\ARM\ARMCC\Bin'
 Build target 'bootloader'
 compiling main.c...
-main.h(35): warning:  #1295-D: Deprecated declaration task_fwdgt_reload - give arg types
+..\CMSIS\Include\gd32f10x.h(44): warning:  #47-D: incompatible redefinition of macro "GD32F10X_XD" 
+  #define GD32F10X_XD
+main.h(25): warning:  #1295-D: Deprecated declaration task_fwdgt_reload - give arg types
   void task_fwdgt_reload();
 ..\HW\Include\ota_message.h(14): warning:  #1295-D: Deprecated declaration load_ota_message_config_params - give arg types
   extern int load_ota_message_config_params();
 ..\HW\Include\ota_message.h(16): warning:  #1295-D: Deprecated declaration get_config_params - give arg types
   extern OTA_MESSAGE *get_config_params();
-main.c(28): warning:  #167-D: argument of type "OTA_MESSAGE *" is incompatible with parameter of type "const uint16_t *"
-  	FLASH_Write(0x08069000,&ota_message,sizeof(OTA_MESSAGE)/2);
-main.c(15): warning:  #550-D: variable "i"  was set but never used
+..\HW\Include\ec800m.h(26): warning:  #2532-D: support for trigraphs is disabled
+  // ??MQTT??3.1.1 ??????--4(mqtt 3.1.1 )3(mqtt 3.1)
+main.c(15): warning:  #550-D: variable "ota_message"  was set but never used
+  	static OTA_MESSAGE ota_message = {0};
+main.c(18): warning:  #550-D: variable "i"  was set but never used
   	uint32_t i = 0;
-main.c(20): warning:  #177-D: variable "state"  was declared but never referenced
-  	fmc_state_enum state;
-main.c(69): warning:  #1-D: last line of file ends without a newline
+main.c(22): warning:  #177-D: variable "OPEN_FILE"  was declared but never referenced
+  	char OPEN_FILE[] = "AT+QFOPEN=\"otaMSG.txt\",0\r\n";
+main.c(26): warning:  #177-D: variable "LOADFILE"  was declared but never referenced
+  	char LOADFILE[] = "AT+QFDWL=otaMSG.txt\r\n";
+main.c(75): warning:  #111-D: statement is unreachable
+  		ota_data=get_config_params();
+main.c(82): warning:  #111-D: statement is unreachable
+  		LOAD_A(GD32_A_SADDR);
+main.c(99): warning:  #1-D: last line of file ends without a newline
   }
-main.c: 7 warnings, 0 errors
+main.c: 12 warnings, 0 errors
 linking...
-Program Size: Code=3416 RO-data=336 RW-data=28 ZI-data=6148  
+Program Size: Code=6988 RO-data=472 RW-data=120 ZI-data=73992  
 FromELF: creating hex file...
-"..\OBJ\bootloader.axf" - 0 Error(s), 7 Warning(s).
+"..\OBJ\bootloader.axf" - 0 Error(s), 12 Warning(s).
 
 <h2>Software Packages used:</h2>
 
@@ -59,7 +69,7 @@ Package Vendor: GigaDevice
   D:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include
 
 <h2>Collection of Component Files used:</h2>
-Build Time Elapsed:  00:00:01
+Build Time Elapsed:  00:00:02
 </pre>
 </body>
 </html>

File diff suppressed because it is too large
+ 560 - 234
bootloader/OBJ/bootloader.htm


+ 5 - 0
bootloader/OBJ/bootloader.lnp

@@ -8,6 +8,8 @@
 "..\obj\spi.o"
 "..\obj\w25q32.o"
 "..\obj\ota_message.o"
+"..\obj\ec800m.o"
+"..\obj\usart.o"
 "..\obj\gd32f10x_wwdgt.o"
 "..\obj\gd32f10x_misc.o"
 "..\obj\gd32f10x_rcu.o"
@@ -15,6 +17,9 @@
 "..\obj\gd32f10x_fmc.o"
 "..\obj\gd32f10x_spi.o"
 "..\obj\gd32f10x_fwdgt.o"
+"..\obj\gd32f10x_dma.o"
+"..\obj\gd32f10x_exti.o"
+"..\obj\gd32f10x_usart.o"
 "..\obj\main.o"
 --library_type=microlib --strict --scatter "..\OBJ\bootloader.sct"
 --summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols

+ 203 - 28
bootloader/OBJ/bootloader_bootloader.dep

@@ -1,7 +1,7 @@
 Dependencies for Project 'bootloader', Target 'bootloader': (DO NOT MODIFY !)
 CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
 F (..\CMSIS\Source\system_gd32f10x.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\system_gd32f10x.o --omf_browse ..\obj\system_gd32f10x.crf --depend ..\obj\system_gd32f10x.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -34,8 +34,8 @@ I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\CMSIS\Source\startup_gd32f10x_xd.s)(0x6538DC55)(--cpu Cortex-M3 -g --apcs=interwork --pd "__MICROLIB SETA 1"

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

--pd "__UVISION_VERSION SETA 536" --pd "GD32F10X_XD SETA 1" --pd "USE_STDPERIPH_DRIVER SETA 1"

--list .\listings\startup_gd32f10x_xd.lst --xref -o ..\obj\startup_gd32f10x_xd.o --depend ..\obj\startup_gd32f10x_xd.d)
-F (..\HW\Source\boot.c)(0x653BA9E6)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\boot.o --omf_browse ..\obj\boot.crf --depend ..\obj\boot.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+F (..\HW\Source\boot.c)(0x653C670E)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\boot.o --omf_browse ..\obj\boot.crf --depend ..\obj\boot.d)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -68,14 +68,14 @@ I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 I (..\HW\Include\boot.h)(0x6538DC55)
-I (..\USER\main.h)(0x653BA110)
+I (..\USER\main.h)(0x653C6774)
 I (..\HW\Include\delay.h)(0x6538DC55)
-I (..\HW\Include\fmc.h)(0x653B8771)
+I (..\HW\Include\fmc.h)(0x653C6670)
 I (..\HW\Include\w25q32.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdio.h)(0x60252374)
 I (..\HW\Include\ota_message.h)(0x653B9E15)
 F (..\HW\Source\delay.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\delay.o --omf_browse ..\obj\delay.crf --depend ..\obj\delay.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -108,8 +108,8 @@ I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 I (..\HW\Include\delay.h)(0x6538DC55)
-F (..\HW\Source\fmc.c)(0x653BA172)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\fmc.o --omf_browse ..\obj\fmc.crf --depend ..\obj\fmc.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+F (..\HW\Source\fmc.c)(0x653C6608)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\fmc.o --omf_browse ..\obj\fmc.crf --depend ..\obj\fmc.d)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -141,10 +141,10 @@ I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
 I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
-I (..\HW\Include\fmc.h)(0x653B8771)
-F (..\HW\Source\gd32f10x_it.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_it.o --omf_browse ..\obj\gd32f10x_it.crf --depend ..\obj\gd32f10x_it.d)
-I (..\HW\Include\gd32f10x_it.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\HW\Include\fmc.h)(0x653C6670)
+F (..\HW\Source\gd32f10x_it.c)(0x653C81BF)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_it.o --omf_browse ..\obj\gd32f10x_it.crf --depend ..\obj\gd32f10x_it.d)
+I (..\HW\Include\gd32f10x_it.h)(0x653C7FE5)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -176,8 +176,9 @@ I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
 I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
+I (..\HW\Include\usart.h)(0x653C8151)
 F (..\HW\Source\spi.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\spi.o --omf_browse ..\obj\spi.crf --depend ..\obj\spi.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -211,7 +212,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 I (..\HW\Include\spi.h)(0x6538DC55)
 F (..\HW\Source\w25q32.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\w25q32.o --omf_browse ..\obj\w25q32.crf --depend ..\obj\w25q32.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -245,11 +246,11 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 I (..\HW\Include\spi.h)(0x6538DC55)
 I (..\HW\Include\w25q32.h)(0x6538DC55)
-F (..\HW\Source\ota_message.c)(0x653BA795)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\ota_message.o --omf_browse ..\obj\ota_message.crf --depend ..\obj\ota_message.d)
+F (..\HW\Source\ota_message.c)(0x653CE3BE)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\ota_message.o --omf_browse ..\obj\ota_message.crf --depend ..\obj\ota_message.d)
 I (..\HW\Include\ota_message.h)(0x653B9E15)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
-I (..\HW\Include\fmc.h)(0x653B8771)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\HW\Include\fmc.h)(0x653C6670)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
 I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
@@ -281,10 +282,83 @@ I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 I (..\HW\Include\w25q32.h)(0x6538DC55)
+I (..\HW\Include\ec800m.h)(0x653C7780)
+I (..\HW\Include\usart.h)(0x653C8151)
+I (..\HW\Include\delay.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdio.h)(0x60252374)
+F (..\HW\Source\ec800m.c)(0x653CB6AE)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\ec800m.o --omf_browse ..\obj\ec800m.crf --depend ..\obj\ec800m.d)
+I (..\HW\Include\ec800m.h)(0x653C7780)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
+I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
+I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
+I (..\CMSIS\Include\system_gd32f10x.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (..\CMSIS\Include\gd32f10x_libopt.h)(0x653B4F49)
+I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_pmu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_bkp.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exti.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_crc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dma.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dbg.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_adc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dac.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rtc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_timer.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_usart.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_i2c.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_sdio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
+I (..\HW\Include\usart.h)(0x653C8151)
+I (..\HW\Include\delay.h)(0x6538DC55)
+F (..\HW\Source\usart.c)(0x653C7D4D)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\usart.o --omf_browse ..\obj\usart.crf --depend ..\obj\usart.d)
+I (..\HW\Include\usart.h)(0x653C8151)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
+I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
+I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
+I (..\CMSIS\Include\system_gd32f10x.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (..\CMSIS\Include\gd32f10x_libopt.h)(0x653B4F49)
+I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_pmu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_bkp.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exti.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_crc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dma.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dbg.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_adc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dac.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rtc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_timer.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_usart.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_i2c.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_sdio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_wwdgt.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_wwdgt.o --omf_browse ..\obj\gd32f10x_wwdgt.crf --depend ..\obj\gd32f10x_wwdgt.d)
 I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -317,7 +391,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_misc.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_misc.o --omf_browse ..\obj\gd32f10x_misc.crf --depend ..\obj\gd32f10x_misc.d)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -350,7 +424,7 @@ I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 F (..\LIB\Source\gd32f10x_rcu.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_rcu.o --omf_browse ..\obj\gd32f10x_rcu.crf --depend ..\obj\gd32f10x_rcu.d)
 I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -383,7 +457,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_gpio.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_gpio.o --omf_browse ..\obj\gd32f10x_gpio.crf --depend ..\obj\gd32f10x_gpio.d)
 I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -416,7 +490,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_fmc.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_fmc.o --omf_browse ..\obj\gd32f10x_fmc.crf --depend ..\obj\gd32f10x_fmc.d)
 I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -449,7 +523,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_spi.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_spi.o --omf_browse ..\obj\gd32f10x_spi.crf --depend ..\obj\gd32f10x_spi.d)
 I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -482,7 +556,7 @@ I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
 F (..\LIB\Source\gd32f10x_fwdgt.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_fwdgt.o --omf_browse ..\obj\gd32f10x_fwdgt.crf --depend ..\obj\gd32f10x_fwdgt.d)
 I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -513,8 +587,107 @@ I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
 I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
-F (.\main.c)(0x653BABD1)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
-I (..\CMSIS\Include\gd32f10x.h)(0x653B6271)
+F (..\LIB\Source\gd32f10x_dma.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_dma.o --omf_browse ..\obj\gd32f10x_dma.crf --depend ..\obj\gd32f10x_dma.d)
+I (..\LIB\Include\gd32f10x_dma.h)(0x6538DC55)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
+I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
+I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
+I (..\CMSIS\Include\system_gd32f10x.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (..\CMSIS\Include\gd32f10x_libopt.h)(0x653B4F49)
+I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_pmu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_bkp.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exti.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_crc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dbg.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_adc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dac.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rtc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_timer.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_usart.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_i2c.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_sdio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
+F (..\LIB\Source\gd32f10x_exti.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_exti.o --omf_browse ..\obj\gd32f10x_exti.crf --depend ..\obj\gd32f10x_exti.d)
+I (..\LIB\Include\gd32f10x_exti.h)(0x6538DC55)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
+I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
+I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
+I (..\CMSIS\Include\system_gd32f10x.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (..\CMSIS\Include\gd32f10x_libopt.h)(0x653B4F49)
+I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_pmu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_bkp.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_crc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dma.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dbg.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_adc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dac.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rtc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_timer.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_usart.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_i2c.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_sdio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
+F (..\LIB\Source\gd32f10x_usart.c)(0x6538DC55)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\gd32f10x_usart.o --omf_browse ..\obj\gd32f10x_usart.crf --depend ..\obj\gd32f10x_usart.d)
+I (..\LIB\Include\gd32f10x_usart.h)(0x6538DC55)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
+I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
+I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
+I (..\CMSIS\Include\core_cmFunc.h)(0x6538DC55)
+I (..\CMSIS\Include\system_gd32f10x.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\string.h)(0x6025237E)
+I (..\CMSIS\Include\gd32f10x_libopt.h)(0x653B4F49)
+I (..\LIB\Include\gd32f10x_fmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_pmu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_bkp.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rcu.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exti.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_gpio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_crc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dma.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dbg.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_adc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_dac.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_fwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_wwdgt.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_rtc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_timer.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_i2c.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_spi.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_sdio.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_exmc.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
+I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
+I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
+I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
+F (.\main.c)(0x653CE4C6)(--c99 --gnu -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CMSIS\Include -I ..\HW\Include -I ..\LIB\Include

-ID:\software\MDK5\Pack\GigaDevice\GD32F10x_DFP\2.1.0\Device\Include

-D__UVISION_VERSION="536" -DGD32F10X_XD -DUSE_STDPERIPH_DRIVER

-o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
+I (..\CMSIS\Include\gd32f10x.h)(0x653C6D66)
 I (..\CMSIS\Include\core_cm3.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdint.h)(0x6025237E)
 I (..\CMSIS\Include\core_cmInstr.h)(0x6538DC55)
@@ -546,9 +719,11 @@ I (..\LIB\Include\gd32f10x_can.h)(0x6538DC55)
 I (..\LIB\Include\gd32f10x_enet.h)(0x6538DC55)
 I (D:\software\MDK5\ARM\ARMCC\include\stdlib.h)(0x60252374)
 I (..\LIB\Include\gd32f10x_misc.h)(0x6538DC55)
-I (main.h)(0x653BA110)
+I (main.h)(0x653C6774)
 I (..\HW\Include\delay.h)(0x6538DC55)
-I (..\HW\Include\fmc.h)(0x653B8771)
+I (..\HW\Include\fmc.h)(0x653C6670)
 I (..\HW\Include\ota_message.h)(0x653B9E15)
+I (..\HW\Include\usart.h)(0x653C8151)
+I (..\HW\Include\ec800m.h)(0x653C7780)
 I (..\HW\Include\boot.h)(0x6538DC55)
 I (..\HW\Include\w25q32.h)(0x6538DC55)

二進制
bootloader/OBJ/delay.crf


二進制
bootloader/OBJ/ec800m.crf


+ 37 - 0
bootloader/OBJ/ec800m.d

@@ -0,0 +1,37 @@
+..\obj\ec800m.o: ..\HW\Source\ec800m.c
+..\obj\ec800m.o: ..\HW\Include\ec800m.h
+..\obj\ec800m.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\ec800m.o: ..\CMSIS\Include\core_cm3.h
+..\obj\ec800m.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdint.h
+..\obj\ec800m.o: ..\CMSIS\Include\core_cmInstr.h
+..\obj\ec800m.o: ..\CMSIS\Include\core_cmFunc.h
+..\obj\ec800m.o: ..\CMSIS\Include\system_gd32f10x.h
+..\obj\ec800m.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\string.h
+..\obj\ec800m.o: ..\CMSIS\Include\gd32f10x_libopt.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\ec800m.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_pmu.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_bkp.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_rcu.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_gpio.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_crc.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_dbg.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_adc.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_dac.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_fwdgt.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_wwdgt.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_rtc.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_timer.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_i2c.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_sdio.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_exmc.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_can.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_enet.h
+..\obj\ec800m.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
+..\obj\ec800m.o: ..\LIB\Include\gd32f10x_misc.h
+..\obj\ec800m.o: ..\HW\Include\usart.h
+..\obj\ec800m.o: ..\HW\Include\delay.h

二進制
bootloader/OBJ/fmc.crf


二進制
bootloader/OBJ/gd32f10x_dma.crf


+ 35 - 0
bootloader/OBJ/gd32f10x_dma.d

@@ -0,0 +1,35 @@
+..\obj\gd32f10x_dma.o: ..\LIB\Source\gd32f10x_dma.c
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\core_cm3.h
+..\obj\gd32f10x_dma.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdint.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\core_cmInstr.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\core_cmFunc.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\system_gd32f10x.h
+..\obj\gd32f10x_dma.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\string.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\gd32f10x_libopt.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\gd32f10x_dma.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_pmu.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_bkp.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_rcu.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_gpio.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_crc.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_dbg.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_adc.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_dac.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_fwdgt.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_wwdgt.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_rtc.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_timer.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_i2c.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_sdio.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_exmc.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_can.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_enet.h
+..\obj\gd32f10x_dma.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
+..\obj\gd32f10x_dma.o: ..\LIB\Include\gd32f10x_misc.h

二進制
bootloader/OBJ/gd32f10x_exti.crf


+ 35 - 0
bootloader/OBJ/gd32f10x_exti.d

@@ -0,0 +1,35 @@
+..\obj\gd32f10x_exti.o: ..\LIB\Source\gd32f10x_exti.c
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\core_cm3.h
+..\obj\gd32f10x_exti.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdint.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\core_cmInstr.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\core_cmFunc.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\system_gd32f10x.h
+..\obj\gd32f10x_exti.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\string.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\gd32f10x_libopt.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\gd32f10x_exti.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_pmu.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_bkp.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_rcu.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_gpio.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_crc.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_dbg.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_adc.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_dac.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_fwdgt.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_wwdgt.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_rtc.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_timer.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_i2c.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_sdio.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_exmc.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_can.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_enet.h
+..\obj\gd32f10x_exti.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
+..\obj\gd32f10x_exti.o: ..\LIB\Include\gd32f10x_misc.h

二進制
bootloader/OBJ/gd32f10x_fmc.crf


二進制
bootloader/OBJ/gd32f10x_fwdgt.crf


二進制
bootloader/OBJ/gd32f10x_gpio.crf


二進制
bootloader/OBJ/gd32f10x_it.crf


+ 1 - 0
bootloader/OBJ/gd32f10x_it.d

@@ -33,3 +33,4 @@
 ..\obj\gd32f10x_it.o: ..\LIB\Include\gd32f10x_enet.h
 ..\obj\gd32f10x_it.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
 ..\obj\gd32f10x_it.o: ..\LIB\Include\gd32f10x_misc.h
+..\obj\gd32f10x_it.o: ..\HW\Include\usart.h

二進制
bootloader/OBJ/gd32f10x_misc.crf


二進制
bootloader/OBJ/gd32f10x_rcu.crf


二進制
bootloader/OBJ/gd32f10x_spi.crf


二進制
bootloader/OBJ/gd32f10x_usart.crf


+ 35 - 0
bootloader/OBJ/gd32f10x_usart.d

@@ -0,0 +1,35 @@
+..\obj\gd32f10x_usart.o: ..\LIB\Source\gd32f10x_usart.c
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\core_cm3.h
+..\obj\gd32f10x_usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdint.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\core_cmInstr.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\core_cmFunc.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\system_gd32f10x.h
+..\obj\gd32f10x_usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\string.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\gd32f10x_libopt.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\gd32f10x_usart.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_pmu.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_bkp.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_rcu.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_gpio.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_crc.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_dbg.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_adc.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_dac.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_fwdgt.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_wwdgt.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_rtc.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_timer.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_i2c.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_sdio.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_exmc.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_can.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_enet.h
+..\obj\gd32f10x_usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
+..\obj\gd32f10x_usart.o: ..\LIB\Include\gd32f10x_misc.h

二進制
bootloader/OBJ/gd32f10x_wwdgt.crf


二進制
bootloader/OBJ/main.crf


+ 2 - 0
bootloader/OBJ/main.d

@@ -36,5 +36,7 @@
 ..\obj\main.o: ..\HW\Include\delay.h
 ..\obj\main.o: ..\HW\Include\fmc.h
 ..\obj\main.o: ..\HW\Include\ota_message.h
+..\obj\main.o: ..\HW\Include\usart.h
+..\obj\main.o: ..\HW\Include\ec800m.h
 ..\obj\main.o: ..\HW\Include\boot.h
 ..\obj\main.o: ..\HW\Include\w25q32.h

二進制
bootloader/OBJ/ota_message.crf


+ 3 - 0
bootloader/OBJ/ota_message.d

@@ -35,4 +35,7 @@
 ..\obj\ota_message.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
 ..\obj\ota_message.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\ota_message.o: ..\HW\Include\w25q32.h
+..\obj\ota_message.o: ..\HW\Include\ec800m.h
+..\obj\ota_message.o: ..\HW\Include\usart.h
+..\obj\ota_message.o: ..\HW\Include\delay.h
 ..\obj\ota_message.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdio.h

二進制
bootloader/OBJ/spi.crf


二進制
bootloader/OBJ/system_gd32f10x.crf


二進制
bootloader/OBJ/usart.crf


+ 35 - 0
bootloader/OBJ/usart.d

@@ -0,0 +1,35 @@
+..\obj\usart.o: ..\HW\Source\usart.c
+..\obj\usart.o: ..\HW\Include\usart.h
+..\obj\usart.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\usart.o: ..\CMSIS\Include\core_cm3.h
+..\obj\usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdint.h
+..\obj\usart.o: ..\CMSIS\Include\core_cmInstr.h
+..\obj\usart.o: ..\CMSIS\Include\core_cmFunc.h
+..\obj\usart.o: ..\CMSIS\Include\system_gd32f10x.h
+..\obj\usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\string.h
+..\obj\usart.o: ..\CMSIS\Include\gd32f10x_libopt.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\usart.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_pmu.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_bkp.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_rcu.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_exti.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_gpio.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_crc.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_dbg.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_adc.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_dac.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_fwdgt.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_wwdgt.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_rtc.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_timer.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_usart.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_i2c.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_sdio.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_exmc.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_can.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_enet.h
+..\obj\usart.o: D:\software\MDK5\ARM\ARMCC\Bin\..\include\stdlib.h
+..\obj\usart.o: ..\LIB\Include\gd32f10x_misc.h

二進制
bootloader/OBJ/w25q32.crf


+ 94 - 0
bootloader/USER/.vscode/c_cpp_properties.json

@@ -0,0 +1,94 @@
+{
+    "configurations": [
+        {
+            "name": "bootloader",
+            "includePath": [
+                "d:\\project\\dtu_gateway\\bootloader\\USER",
+                "d:\\project\\dtu_gateway\\bootloader\\CMSIS\\Include",
+                "d:\\project\\dtu_gateway\\bootloader\\HW\\Include",
+                "d:\\project\\dtu_gateway\\bootloader\\LIB\\Include",
+                "D:\\software\\MDK5\\ARM\\ARMCC\\include",
+                "D:\\software\\MDK5\\ARM\\ARMCC\\include\\rw",
+                "d:\\project\\dtu_gateway\\bootloader\\CMSIS\\Source",
+                "d:\\project\\dtu_gateway\\bootloader\\HW\\Source",
+                "d:\\project\\dtu_gateway\\bootloader\\LIB\\Source"
+            ],
+            "defines": [
+                "__CC_ARM",
+                "__arm__",
+                "__align(x)=",
+                "__ALIGNOF__(x)=",
+                "__alignof__(x)=",
+                "__asm(x)=",
+                "__forceinline=",
+                "__restrict=",
+                "__global_reg(n)=",
+                "__inline=",
+                "__int64=long long",
+                "__INTADDR__(expr)=0",
+                "__irq=",
+                "__packed=",
+                "__pure=",
+                "__smc(n)=",
+                "__svc(n)=",
+                "__svc_indirect(n)=",
+                "__svc_indirect_r7(n)=",
+                "__value_in_regs=",
+                "__weak=",
+                "__writeonly=",
+                "__declspec(x)=",
+                "__attribute__(x)=",
+                "__nonnull__(x)=",
+                "__register=",
+                "__breakpoint(x)=",
+                "__cdp(x,y,z)=",
+                "__clrex()=",
+                "__clz(x)=0U",
+                "__current_pc()=0U",
+                "__current_sp()=0U",
+                "__disable_fiq()=",
+                "__disable_irq()=",
+                "__dmb(x)=",
+                "__dsb(x)=",
+                "__enable_fiq()=",
+                "__enable_irq()=",
+                "__fabs(x)=0.0",
+                "__fabsf(x)=0.0f",
+                "__force_loads()=",
+                "__force_stores()=",
+                "__isb(x)=",
+                "__ldrex(x)=0U",
+                "__ldrexd(x)=0U",
+                "__ldrt(x)=0U",
+                "__memory_changed()=",
+                "__nop()=",
+                "__pld(...)=",
+                "__pli(...)=",
+                "__qadd(x,y)=0",
+                "__qdbl(x)=0",
+                "__qsub(x,y)=0",
+                "__rbit(x)=0U",
+                "__rev(x)=0U",
+                "__return_address()=0U",
+                "__ror(x,y)=0U",
+                "__schedule_barrier()=",
+                "__semihost(x,y)=0",
+                "__sev()=",
+                "__sqrt(x)=0.0",
+                "__sqrtf(x)=0.0f",
+                "__ssat(x,y)=0",
+                "__strex(x,y)=0U",
+                "__strexd(x,y)=0",
+                "__strt(x,y)=",
+                "__swp(x,y)=0U",
+                "__usat(x,y)=0U",
+                "__wfe()=",
+                "__wfi()=",
+                "__yield()=",
+                "__vfp_status(x,y)=0"
+            ],
+            "intelliSenseMode": "${default}"
+        }
+    ],
+    "version": 4
+}

+ 2 - 0
bootloader/USER/.vscode/keil-assistant.log

@@ -0,0 +1,2 @@
+[info] Log at : 2023/10/28|11:27:20|GMT+0800
+

+ 32 - 0
bootloader/USER/.vscode/uv4.log

@@ -0,0 +1,32 @@
+*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\software\MDK5\ARM\ARMCC\Bin'
+Build target 'bootloader'
+compiling gd32f10x_it.c...
+..\CMSIS\Include\gd32f10x.h(44): warning:  #47-D: incompatible redefinition of macro "GD32F10X_XD" 
+  #define GD32F10X_XD
+..\HW\Source\gd32f10x_it.c: 1 warning, 0 errors
+linking...
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol UART0_RX_STAT (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol dma_channel_disable (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol dma_channel_enable (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol dma_interrupt_flag_clear (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol usart_data_receive (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol usart_interrupt_flag_clear (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol usart_interrupt_flag_get (referred from gd32f10x_it.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol EC800MSendCmd (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol addGatewayParams (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol delay_1ms (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol dma_config (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol dma_config_change (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol extract_data_from_buffer (referred from ota_message.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol EC800MPwoerOn (referred from main.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol EC800MWaitReady (referred from main.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol WaitResponse (referred from main.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol gd_EC800M_pin_init (referred from main.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol gd_com_init (referred from main.o).
+..\OBJ\bootloader.axf: Error: L6218E: Undefined symbol nvic_config (referred from main.o).
+Not enough information to list image symbols.
+Not enough information to list load addresses in the image map.
+Finished: 2 information, 0 warning and 19 error messages.
+"..\OBJ\bootloader.axf" - 19 Error(s), 1 Warning(s).
+Target not created.
+Build Time Elapsed:  00:00:01

+ 1 - 0
bootloader/USER/.vscode/uv4.log.lock

@@ -0,0 +1 @@
+2023/10/28 11:36:37

File diff suppressed because it is too large
+ 3275 - 3540
bootloader/USER/JLinkLog.txt


File diff suppressed because it is too large
+ 832 - 345
bootloader/USER/Listings/bootloader.map


File diff suppressed because it is too large
+ 95 - 86
bootloader/USER/bootloader.uvguix.IBM


+ 78 - 50
bootloader/USER/bootloader.uvoptx

@@ -157,73 +157,41 @@
         <Bp>
           <Number>0</Number>
           <Type>0</Type>
-          <LineNumber>16</LineNumber>
+          <LineNumber>144</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>134220868</Address>
+          <Address>134222734</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
           <SizeOfObject>0</SizeOfObject>
           <BreakByAccess>0</BreakByAccess>
           <BreakIfRCount>1</BreakIfRCount>
-          <Filename>.\main.c</Filename>
+          <Filename>..\HW\Source\ota_message.c</Filename>
           <ExecCommand></ExecCommand>
-          <Expression>\\bootloader\main.c\16</Expression>
+          <Expression>\\bootloader\../HW/Source/ota_message.c\144</Expression>
         </Bp>
         <Bp>
           <Number>1</Number>
           <Type>0</Type>
-          <LineNumber>42</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>134220824</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>.\main.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\bootloader\main.c\42</Expression>
-        </Bp>
-        <Bp>
-          <Number>2</Number>
-          <Type>0</Type>
-          <LineNumber>41</LineNumber>
+          <LineNumber>134</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>134220766</Address>
+          <Address>0</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
           <SizeOfObject>0</SizeOfObject>
           <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
+          <BreakIfRCount>0</BreakIfRCount>
           <Filename>..\HW\Source\ota_message.c</Filename>
           <ExecCommand></ExecCommand>
-          <Expression>\\bootloader\../HW/Source/ota_message.c\41</Expression>
-        </Bp>
-        <Bp>
-          <Number>3</Number>
-          <Type>0</Type>
-          <LineNumber>37</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>134219054</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>..\HW\Source\fmc.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\bootloader\../HW/Source/fmc.c\37</Expression>
+          <Expression></Expression>
         </Bp>
       </Breakpoint>
       <MemoryWindow1>
         <Mm>
           <WinNumber>1</WinNumber>
           <SubType>0</SubType>
-          <ItemText>0x08069000</ItemText>
+          <ItemText>dmabuffer</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow1>
@@ -239,7 +207,7 @@
         <Mm>
           <WinNumber>3</WinNumber>
           <SubType>0</SubType>
-          <ItemText>0x8037000</ItemText>
+          <ItemText>0x08043800</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow3>
@@ -410,6 +378,30 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>10</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\HW\Source\ec800m.c</PathWithFileName>
+      <FilenameWithoutPath>ec800m.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>11</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\HW\Source\usart.c</PathWithFileName>
+      <FilenameWithoutPath>usart.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
@@ -420,7 +412,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>10</FileNumber>
+      <FileNumber>12</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -432,7 +424,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>11</FileNumber>
+      <FileNumber>13</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -444,7 +436,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>12</FileNumber>
+      <FileNumber>14</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -456,7 +448,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>13</FileNumber>
+      <FileNumber>15</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -468,7 +460,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>14</FileNumber>
+      <FileNumber>16</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -480,7 +472,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>15</FileNumber>
+      <FileNumber>17</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -492,7 +484,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>16</FileNumber>
+      <FileNumber>18</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -502,6 +494,42 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>19</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\LIB\Source\gd32f10x_dma.c</PathWithFileName>
+      <FilenameWithoutPath>gd32f10x_dma.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>20</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\LIB\Source\gd32f10x_exti.c</PathWithFileName>
+      <FilenameWithoutPath>gd32f10x_exti.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>21</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\LIB\Source\gd32f10x_usart.c</PathWithFileName>
+      <FilenameWithoutPath>gd32f10x_usart.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
@@ -512,7 +540,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>17</FileNumber>
+      <FileNumber>22</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>

+ 25 - 0
bootloader/USER/bootloader.uvprojx

@@ -433,6 +433,16 @@
               <FileType>1</FileType>
               <FilePath>..\HW\Source\ota_message.c</FilePath>
             </File>
+            <File>
+              <FileName>ec800m.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\HW\Source\ec800m.c</FilePath>
+            </File>
+            <File>
+              <FileName>usart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\HW\Source\usart.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
@@ -473,6 +483,21 @@
               <FileType>1</FileType>
               <FilePath>..\LIB\Source\gd32f10x_fwdgt.c</FilePath>
             </File>
+            <File>
+              <FileName>gd32f10x_dma.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LIB\Source\gd32f10x_dma.c</FilePath>
+            </File>
+            <File>
+              <FileName>gd32f10x_exti.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LIB\Source\gd32f10x_exti.c</FilePath>
+            </File>
+            <File>
+              <FileName>gd32f10x_usart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\LIB\Source\gd32f10x_usart.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>

+ 51 - 21
bootloader/USER/main.c

@@ -3,45 +3,74 @@
 #include "delay.h"
 #include "fmc.h"
 #include "ota_message.h"
-
+#include "usart.h"
+#include "ec800m.h"
 #include "boot.h"
 #include "w25q32.h"
 void task_fwdgt_reload(void);
 OTA_STRUCT UpDataA;           //A区更新用到的结构体
 
-void my_test(void)
+void my_test(void)	//往UFS写好文件
 {
 	static OTA_MESSAGE ota_message = {0};
+	char str[100];
+	char string[] = "{\"otaflag\":1,\"XmodemByte\":102400}"; 
 	uint32_t i = 0;
 	ota_message.otaflag = 1;
 	ota_message.XmodemByte = 200 * 1024;
-	//往地址0x08070000写OTA_MESSAGE结构体
-	// GD32_WriteFlash(OTA_EVENT_START_ADDR,&ota_message,sizeof(OTA_MESSAGE));
-	fmc_state_enum state;
-	// state = fmc_word_program((uint32_t)0x08070000,(uint32_t)(1));
-	// fmc_flag_clear(FMC_FLAG_BANK0_END | FMC_FLAG_BANK0_WPERR | FMC_FLAG_BANK0_PGERR);
-	// state = fmc_word_program((uint32_t)0x08070004,(uint32_t)(100 * 1024));
-	// fmc_flag_clear(FMC_FLAG_BANK0_END | FMC_FLAG_BANK0_WPERR | FMC_FLAG_BANK0_PGERR);
-	// FLASH_WriteNotErase(0x08070000,&ota_message,sizeof(OTA_MESSAGE)/2);
-	// FLASH_ErasePage(0x08069000,1);
-	GD32_EraseFlash(210,1);
-	FLASH_Write(0x08069000,&ota_message,sizeof(OTA_MESSAGE)/2);
-	i = *(uint32_t*)(0x08069000);
-	i = *(uint32_t*)(0x08069004);
-	// FLASH_Write(0x08069008,&ota_message,sizeof(OTA_MESSAGE)/2);
-	
-	Delay_Ms(100);
+	memcpy(str,string,strlen(string)+1);
+	char OPEN_FILE[] = "AT+QFOPEN=\"otaMSG.txt\",0\r\n";
+	char OPEN_NEW_FILE[] = "AT+QFOPEN=\"otaMSG.txt\",1\r\n";
+	char WRITEFILE[] = "AT+QFWRITE=1,33\r\n";
+	char CLOSEFILE[] = "AT+QFCLOSE=1\r\n";
+	char LOADFILE[] = "AT+QFDWL=otaMSG.txt\r\n";
+	// GD32_EraseFlash(420,1);
+	// GD32_WriteFlash(0x08069000,(uint32_t *)&ota_message,sizeof(OTA_MESSAGE)); 
+	// i = *(uint32_t*)(0x08069000);
+	// i = *(uint32_t*)(0x08069004);
+	EC800MSendCmd(OPEN_NEW_FILE,strlen(OPEN_NEW_FILE));
+	memset(str,0,sizeof(str));
+	strcpy(str,(char *)&UART0_RX_BUF);
+	i = WaitResponse("QFOPEN:", 2000);
+
+	EC800MSendCmd(WRITEFILE,strlen(WRITEFILE));
+	memset(str,0,sizeof(str));
+	strcpy(str,(char *)&UART0_RX_BUF);
+	i = WaitResponse("CONNECT", 2000);
+
+	EC800MSendCmd(string,strlen(string));
+	memset(str,0,sizeof(str));
+	strcpy(str,(char *)&UART0_RX_BUF);
+	i = WaitResponse("QFWRITE", 2000);
+
+	EC800MSendCmd(CLOSEFILE,strlen(CLOSEFILE));
+	memset(str,0,sizeof(str));
+	strcpy(str,(char *)&UART0_RX_BUF);
+	i = WaitResponse("OK", 2000);
+
+	free(str);
+	Delay_Ms(10);
 }
 
+
 int main(void)
 {
-	Delay_Init();          
-	W25Q32_Init();	//弃用w25q32改用fmc存储
+	Delay_Init();
+	/* 弃用w25q32改用EC800存储ota文件 */
+	// W25Q32_Init();
+	nvic_config();	
+	gd_com_init(COM_EC800);
+	dma_config();
+	gd_EC800M_pin_init();
+	EC800MPwoerOn();
+	EC800MWaitReady();
+
 	OTA_MESSAGE *ota_data;
 	task_fwdgt_reload();
-	// my_test();
+	my_test();
 	if(load_ota_message_config_params()==0)
 	{
+		while(1){Delay_Ms(1000);};
 		//ota事件产生了,进入Bootloader分支
 		ota_data=get_config_params();
 		BootLoader_Brance(ota_data->XmodemByte);
@@ -49,6 +78,7 @@ int main(void)
 	//没有OTA事件产生跳转A区
 	else
 	{
+		while(1){Delay_Ms(1000);};
 		LOAD_A(GD32_A_SADDR);
 	}
   

+ 6 - 16
bootloader/USER/main.h

@@ -2,24 +2,14 @@
 #define MAIN_H
 
 #include "stdint.h"
-/*
-flash分区设计:
-0x08000000~0x08004FFF   bootleader;20KB=10页
-0x08005000~0x08036FFF   app;200KB=100页
-0x08037000~0x08068FFF	download;200KB=100页
-0x08069000~0x080707FF	OTA_EVENT_BLOCK;2KB=1页
-0x08070800~0x0807FFFF	剩余内存;62KB=31页
-0x08080000~0x082FFFFF   剩余内存;2.5MB=640页
-*/
+
 #define  GD32_FLASH_SADDR   0x08000000                                             //FLASH起始地址
-#define  GD32_PAGE_SIZE     2048                                                   //FLASH扇区大小
-#define  GD32_PAGE_NUM      256                                                   //FLASH总扇区个数
-#define  GD32_B_PAGE_NUM    10                                                     //B区扇区个数
-#define  GD32_A_PAGE_NUM    100                        							   //A区扇区个数
-#define  GD32_D_PAGE_NUM    100                        							   //D区扇区个数
-#define  GD32_A_START_PAGE  GD32_B_PAGE_NUM                                        //APP区起始扇区编号
+#define  GD32_PAGE_SIZE     1024                                                   //FLASH扇区大小
+#define  GD32_PAGE_NUM      1024                                                     //FLASH总扇区个数
+#define  GD32_B_PAGE_NUM    20                                                     //B区扇区个数
+#define  GD32_A_PAGE_NUM    GD32_PAGE_NUM - GD32_B_PAGE_NUM                        //A区扇区个数
+#define  GD32_A_START_PAGE  GD32_B_PAGE_NUM                                        //A区起始扇区编号
 #define  GD32_A_SADDR       GD32_FLASH_SADDR + GD32_A_START_PAGE * GD32_PAGE_SIZE  //A区起始地址
-#define  GD32_D_SADDR       GD32_FLASH_SADDR + (GD32_A_START_PAGE + GD32_A_PAGE_NUM) * GD32_PAGE_SIZE  //D区起始地址
 
 
 #define OTA_INFOCB_SIZE sizeof(OTA_InfoCB)    //OTA相关的信息结构体占用的字节长度