Explorar o código

version 1.0.10 add 4g ota

haitao hai 7 meses
pai
achega
d7ebe8ee3b
Modificáronse 100 ficheiros con 9286 adicións e 5741 borrados
  1. 52 14
      app/App/ec800m.c
  2. 1 1
      app/App/ec800m.h
  3. 79 0
      app/App/gd_ota_flash.c
  4. 20 0
      app/App/gd_ota_flash.h
  5. 235 0
      app/App/load_file.c
  6. 7 0
      app/App/load_file.h
  7. 25 6
      app/App/main.c
  8. 2 2
      app/App/parseDeviceMessage.c
  9. 1 1
      app/CMSIS/system_gd32f10x.c
  10. 2695 1087
      app/Proj/JLinkLog.txt
  11. 1309 1160
      app/Proj/Listings/Ringzle.map
  12. BIN=BIN
      app/Proj/Objects/Ringzle.axf
  13. BIN=BIN
      app/Proj/Objects/Ringzle.bin
  14. 5 14
      app/Proj/Objects/Ringzle.build_log.htm
  15. 1457 1235
      app/Proj/Objects/Ringzle.htm
  16. 2 0
      app/Proj/Objects/Ringzle.lnp
  17. 2 2
      app/Proj/Objects/Ringzle.sct
  18. 1462 1384
      app/Proj/Objects/Ringzle_GD32F103C8T6.dep
  19. 2 2
      app/Proj/Objects/Ringzle_sct.Bak
  20. BIN=BIN
      app/Proj/Objects/cjson.crf
  21. BIN=BIN
      app/Proj/Objects/device_message.crf
  22. BIN=BIN
      app/Proj/Objects/dlt645.crf
  23. BIN=BIN
      app/Proj/Objects/dlt645_1997.crf
  24. BIN=BIN
      app/Proj/Objects/dlt645_2007.crf
  25. BIN=BIN
      app/Proj/Objects/dlt645_data.crf
  26. BIN=BIN
      app/Proj/Objects/dlt645_port.crf
  27. BIN=BIN
      app/Proj/Objects/ec800m.crf
  28. BIN=BIN
      app/Proj/Objects/gd32f10x_adc.crf
  29. BIN=BIN
      app/Proj/Objects/gd32f10x_bkp.crf
  30. BIN=BIN
      app/Proj/Objects/gd32f10x_can.crf
  31. BIN=BIN
      app/Proj/Objects/gd32f10x_crc.crf
  32. BIN=BIN
      app/Proj/Objects/gd32f10x_dac.crf
  33. BIN=BIN
      app/Proj/Objects/gd32f10x_dbg.crf
  34. BIN=BIN
      app/Proj/Objects/gd32f10x_dma.crf
  35. BIN=BIN
      app/Proj/Objects/gd32f10x_enet.crf
  36. BIN=BIN
      app/Proj/Objects/gd32f10x_exmc.crf
  37. BIN=BIN
      app/Proj/Objects/gd32f10x_exti.crf
  38. BIN=BIN
      app/Proj/Objects/gd32f10x_fmc.crf
  39. BIN=BIN
      app/Proj/Objects/gd32f10x_fwdgt.crf
  40. BIN=BIN
      app/Proj/Objects/gd32f10x_gpio.crf
  41. BIN=BIN
      app/Proj/Objects/gd32f10x_i2c.crf
  42. BIN=BIN
      app/Proj/Objects/gd32f10x_it.crf
  43. BIN=BIN
      app/Proj/Objects/gd32f10x_misc.crf
  44. BIN=BIN
      app/Proj/Objects/gd32f10x_pmu.crf
  45. BIN=BIN
      app/Proj/Objects/gd32f10x_rcu.crf
  46. BIN=BIN
      app/Proj/Objects/gd32f10x_rtc.crf
  47. BIN=BIN
      app/Proj/Objects/gd32f10x_sdio.crf
  48. BIN=BIN
      app/Proj/Objects/gd32f10x_spi.crf
  49. BIN=BIN
      app/Proj/Objects/gd32f10x_timer.crf
  50. BIN=BIN
      app/Proj/Objects/gd32f10x_usart.crf
  51. BIN=BIN
      app/Proj/Objects/gd32f10x_wwdgt.crf
  52. BIN=BIN
      app/Proj/Objects/key.crf
  53. 1 0
      app/Proj/Objects/key.d
  54. BIN=BIN
      app/Proj/Objects/led.crf
  55. BIN=BIN
      app/Proj/Objects/log.crf
  56. BIN=BIN
      app/Proj/Objects/main.crf
  57. 2 0
      app/Proj/Objects/main.d
  58. BIN=BIN
      app/Proj/Objects/mmodbus.crf
  59. BIN=BIN
      app/Proj/Objects/mqttrecv.crf
  60. BIN=BIN
      app/Proj/Objects/otaevent.crf
  61. BIN=BIN
      app/Proj/Objects/parsedevicemessage.crf
  62. BIN=BIN
      app/Proj/Objects/pc.crf
  63. BIN=BIN
      app/Proj/Objects/ring_buffer.crf
  64. BIN=BIN
      app/Proj/Objects/spi.crf
  65. BIN=BIN
      app/Proj/Objects/system_gd32f10x.crf
  66. BIN=BIN
      app/Proj/Objects/systick.crf
  67. BIN=BIN
      app/Proj/Objects/usart.crf
  68. BIN=BIN
      app/Proj/Objects/w25q32.crf
  69. 210 228
      app/Proj/Ringzle.uvguix.16936
  70. 76 79
      app/Proj/Ringzle.uvoptx
  71. 12 2
      app/Proj/Ringzle.uvprojx
  72. 6 7
      app/bsp/key.c
  73. 0 1
      app/bsp/usart.c
  74. 43 0
      bootloader/HW/Include/ec800.h
  75. 20 0
      bootloader/HW/Include/gd_ota_flash.h
  76. 3 0
      bootloader/HW/Source/boot.c
  77. 429 0
      bootloader/HW/Source/ec800.c
  78. 49 0
      bootloader/HW/Source/gd_ota_flash.c
  79. 2 0
      bootloader/OBJ/ExtDll.iex
  80. BIN=BIN
      bootloader/OBJ/boot.crf
  81. 3 1
      bootloader/OBJ/boot.d
  82. BIN=BIN
      bootloader/OBJ/bootloader.axf
  83. 54 5
      bootloader/OBJ/bootloader.build_log.htm
  84. 635 256
      bootloader/OBJ/bootloader.htm
  85. 4 0
      bootloader/OBJ/bootloader.lnp
  86. 2 2
      bootloader/OBJ/bootloader.sct
  87. 362 245
      bootloader/OBJ/bootloader_bootloader.dep
  88. 2 2
      bootloader/OBJ/bootloader_sct.Bak
  89. BIN=BIN
      bootloader/OBJ/delay.crf
  90. 3 1
      bootloader/OBJ/delay.d
  91. BIN=BIN
      bootloader/OBJ/fmc.crf
  92. 3 1
      bootloader/OBJ/fmc.d
  93. BIN=BIN
      bootloader/OBJ/gd32f10x_fmc.crf
  94. 3 1
      bootloader/OBJ/gd32f10x_fmc.d
  95. BIN=BIN
      bootloader/OBJ/gd32f10x_fwdgt.crf
  96. 3 1
      bootloader/OBJ/gd32f10x_fwdgt.d
  97. BIN=BIN
      bootloader/OBJ/gd32f10x_gpio.crf
  98. 3 1
      bootloader/OBJ/gd32f10x_gpio.d
  99. BIN=BIN
      bootloader/OBJ/gd32f10x_it.crf
  100. 0 0
      bootloader/OBJ/gd32f10x_it.d

+ 52 - 14
app/App/ec800m.c

@@ -38,7 +38,7 @@ void EC800MSendCmd(char *buf, uint16_t len)
 
 void EC800MWaitReady()
 {
-	WaitResponse(RSP_READY, 0);
+	if(WaitResponse(RSP_READY, 5000)==false) NVIC_SystemReset();
 }
 
 /*
@@ -100,7 +100,7 @@ void EC800MSetPDP()
 	delay_1ms(200);
 	EC800MSendCmd(CMD_SET_ACTIVE, strlen(CMD_SET_ACTIVE));
 	WaitResponse(RSP_OK, 1000);
-	delay_1ms(200);
+	delay_1ms(2000);
 	
 }
 
@@ -109,8 +109,9 @@ void EC800MSetPDP()
 #define AT_SEEK "AT+QFSEEK=1,0,0\r\n"
 #define AT_128SEEK "AT+QFSEEK=1,128,0\r\n"
 #define AT_128Read "AT+QFREAD=1,128\r\n"
-#define AT_LIST    "AT+QFLST=*\r\n"
+#define AT_LIST    "AT+QFLST=\"*\"\r\n"
 #define AT_QFLDS   "AT+QFLDS=\"UFS\"\r\n"
+
 //分包宏
 
 
@@ -124,6 +125,9 @@ void EC800MSetPDP()
 bool EC800MGetUrl(char *url,char *dmaBuffer,uint32_t bufferSize)
 {
 	// Set url
+	EC800MSendCmd(AT_LIST, strlen(AT_LIST));
+	if(WaitResponse("http.txt", 100)==true)
+		return false;
 	
 	char command[100];
 	sprintf(command, CMD_SET_URL, strlen(url)); // CMD_SET_URL "%d\r\n"
@@ -134,27 +138,33 @@ bool EC800MGetUrl(char *url,char *dmaBuffer,uint32_t bufferSize)
 	EC800MSendCmd(url, strlen(url)); // 输入URL
 	if (WaitResponse(RSP_OK, 5000) == false)
 		return false;
-
+	task_fwdgt_reload();
 	// Send get request
 	delay_1ms(200);
 	EC800MSendCmd(CMD_GET, strlen(CMD_GET)); // 向服务器发送get请求
 	if (WaitResponse("QHTTPGET:", 5000) == false)
 		return false;
-
+	task_fwdgt_reload();
 	// read to UFS
 
 	delay_1ms(200);
 	EC800MSendCmd(CMD_GET_TO_FILE, strlen(CMD_GET_TO_FILE)); //"AT+QHTTPREADFILE=\"UFS:http.txt\",80\r\n"
 	if (WaitResponse("QHTTPREADFILE:", 5000) == false)
 		return false;
-
+	task_fwdgt_reload();
+	
+	EC800MSendCmd("AT+QFLST=\"*\"\r\n", strlen("AT+QFLST=\"*\"\r\n"));
+	if(WaitResponse("http.txt", 100)==true)
+		
+	return false;
 	// get data from UFS
 	delay_1ms(1000);
-	dma_config_change(dmaBuffer,bufferSize);
+	task_fwdgt_reload();	dma_config_change(dmaBuffer,bufferSize);
 	delay_1ms(1000);
+	task_fwdgt_reload();
 	EC800MSendCmd(CMD_READ_FILE, strlen(CMD_READ_FILE)); //"AT+QFDWL=http.txt\r\n"
-	delay_1ms(6000);
-	
+	delay_1ms(1000);
+	task_fwdgt_reload();
 	return true;
 	
 }
@@ -231,7 +241,7 @@ void MQTTPublish(void)
 {
 	GATEWAY_PARAMS *gateway;
 	gateway=get_gateway_config_params();
-	char *payload_out=malloc(25*1024);         //要发送的字符串
+	char *payload_out=malloc(30*1024);         //要发送的字符串
 	char mqtt_publish[200];        //发送字符串的指令
 	sprintf((char *)payload_out,"{\"deviceId\":\"%s\",\"data\":[",gateway->deviceId);//组成json头部
 	
@@ -343,12 +353,20 @@ void MQTTPublish(void)
 __END__WHILE:
 	if(strlen(payload_out)>40)//小于这个值组成的字符串证明没有数据采集到、就不进行发布
 	{
-		sprintf(payload_out+strlen(payload_out)-1,"]}\0");
+		sprintf(payload_out+strlen(payload_out)-1,"]}");
 		sprintf((char *)mqtt_publish, "AT+QMTPUBEX=0,0,0,0,\"%s\",%d\r\n", gateway->messageTopic, strlen(payload_out));
+		
 		EC800MSendCmd(mqtt_publish, strlen(mqtt_publish));
-		WaitResponse("QMTPUBEX", 1000);	
-		delay_1ms(50);
-		EC800MSendCmd(payload_out, strlen(payload_out));
+		bool success=WaitResponse(">", 1000);
+		if(success)
+		{
+			delay_1ms(50);
+			EC800MSendCmd(payload_out, strlen(payload_out));
+		}
+		else
+		{
+			NVIC_SystemReset();
+		}
 	}
 		free(payload_out);
 		payload_out=NULL;
@@ -373,3 +391,23 @@ void MQTTSubTopic(uint8_t *commandTopic)
 		retry_count++;
 	} while (!success && retry_count < 3);
 }
+
+#define AT_DELETE_FILE "AT+QFDEL=\"UFS:http.txt\"\r\n"
+void delete_config_file()
+{
+	dma_config();
+	EC800MSendCmd(AT_DELETE_FILE, strlen(AT_DELETE_FILE));
+	WaitResponse("OK", 1000);	
+}
+
+
+
+
+
+
+
+
+
+
+
+

+ 1 - 1
app/App/ec800m.h

@@ -68,5 +68,5 @@ bool EC800MGetUrl(char *url,char *dmaBuffer,uint32_t bufferSize);
 void MQTTPublish(void);
 void MQTTSubTopic(uint8_t *commandTopic);
 void ec800m_information_service(GATEWAY_PARAMS *gateway);
-
+void delete_config_file();
 #endif

+ 79 - 0
app/App/gd_ota_flash.c

@@ -0,0 +1,79 @@
+#include "gd_ota_flash.h"
+#include "gd32f10x_fmc.h"
+#include "systick.h"
+#include "string.h"
+
+void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum);
+void GD32_EraseFlash(uint16_t start, uint16_t num);
+
+//读取soft版本信息
+int read_soft_version()
+{
+	
+}
+
+
+
+
+void write_soft_version(BOOT_MESSAGE *save_message)
+{
+	GD32_EraseFlash(FMC_Page,1);
+	GD32_WriteFlash(FMC_WRITE_START_ADDR,(uint32_t *)save_message,sizeof(BOOT_MESSAGE));
+}
+
+/*-------------------------------------------------*/
+/*函数名:擦除FLASH                                */
+/*参  数:start:擦除起始扇区   num:擦几个扇区    */
+/*返回值:无                                       */
+/*-------------------------------------------------*/
+void GD32_EraseFlash(uint16_t start, uint16_t num)
+{
+	uint16_t i;
+
+	fmc_unlock();
+	for (i = 0; i < num; i++)
+	{
+		fmc_page_erase((0x08000000 + start * 1024) + (1024 * i));
+	}
+	fmc_lock();
+}
+/*---------------------------------------------------------------------*/
+/*函数名:写入FLASH                                                    */ 
+/*参  数:saddr:写入地址 wdata:写入数据指针  wnum:写入多少个字节    */
+/*返回值:无                                                           */
+/*---------------------------------------------------------------------*/
+void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum)
+{
+	fmc_unlock();
+	while (wnum > 0)
+	{
+		fmc_word_program(saddr, *wdata);
+		wnum -= 4;
+		saddr += 4;
+		wdata++;
+	}
+	fmc_lock();
+}
+//读取GD32flash
+void GD32_READ_OTA(BOOT_MESSAGE *READ)
+{
+	uint32_t data=FMC_READ(FMC_WRITE_START_ADDR);
+	delay_1ms(10);
+	memcpy(READ,&data,4);
+}
+
+//对系统存储版本信息进行初始化
+void soft_init()
+{
+	BOOT_MESSAGE *currentBoot=malloc(sizeof(BOOT_MESSAGE));
+	GD32_READ_OTA(currentBoot);
+	if(currentBoot->VERSION_H ==0 && currentBoot->VERSION_L==0 && currentBoot->VERSION_M==0 )
+	{
+		currentBoot->VERSION_H=1;currentBoot->VERSION_L=0;currentBoot->VERSION_M=0;currentBoot->UP_FLAG=0;
+	}
+	write_soft_version(currentBoot);
+	free(currentBoot);
+	
+}
+
+

+ 20 - 0
app/App/gd_ota_flash.h

@@ -0,0 +1,20 @@
+#ifndef GD_OTA_FLASH_H
+#define GD_OTA_FLASH_H
+#include <stdint.h>
+//µÚ124Ò³
+#define FMC_READ(addrx) (*(volatile uint32_t *)(uint32_t)(addrx))
+#define FMC_WRITE_START_ADDR    ((uint32_t)0x08005000U+0xFA000) //ÆðʼµØÖ· 
+#define FMC_Page 1020
+
+typedef struct _BOOT_MESSAGE
+{
+	uint8_t VERSION_H;
+	uint8_t VERSION_M;
+	uint8_t VERSION_L;
+	uint8_t UP_FLAG;
+}BOOT_MESSAGE;
+void soft_init();
+void write_soft_version();
+void GD32_READ_OTA(BOOT_MESSAGE *READ);
+void write_soft_version(BOOT_MESSAGE *save_message);
+#endif

+ 235 - 0
app/App/load_file.c

@@ -0,0 +1,235 @@
+#include "load_file.h"
+#include <stdlib.h>
+#include "ec800m.h"
+#include "usart.h"
+#include <string.h>
+#include "gd_ota_flash.h"
+#include "systick.h"
+#include "main.h"
+
+#define readHttpfile(cmd, filename, time_out) sprintf(cmd, "AT+QHTTPREADFILE=\"UFS:%s\",%d\r\n", filename, time_out)
+#define cmdHttpSetUrlLen(cmd,urlLen) sprintf(cmd,"AT+QHTTPURL=%d\r\n",urlLen)
+#define cmdHttpGET(cmd) sprintf(cmd,"AT+QHTTPGET=100\r\n")
+#define cmdReadFile(cmd,filename) sprintf(cmd,"AT+QFDWL=%s\r\n",filename)
+#define cmdOpenFile(cmd,filename) sprintf(cmd,"AT+QFOPEN=\"%s\",2\r\n",filename)
+#define cmdReadHTTP(cmd) sprintf(cmd,"AT+QHTTPREAD=10")
+#define cmdDeletFile(cmd,filename) sprintf(cmd,"AT+QFDEL=\"UFS:%s\"\r\n",filename)
+
+
+bool extract_url_and_version(char *data,char* url, char* version) ;
+int update_version(BOOT_MESSAGE *old_version, const char *new_version);
+
+int load_file_config(char *url)
+{
+	char cmd[50];
+	//设置服务器URL len
+	cmdHttpSetUrlLen(cmd,strlen(url));
+	EC800MSendCmd(cmd,strlen(cmd));
+	WaitResponse(RSP_CONNECT, 500);
+	delay_1ms(200);
+	//发送服务器url
+	EC800MSendCmd(url,strlen(url));
+	if(WaitResponse(RSP_OK, 500)!=true) return -1;
+	delay_1ms(200);
+	//向对应服务器发送get请求
+	cmdHttpGET(cmd);
+	EC800MSendCmd(cmd,strlen(cmd));
+	if(WaitResponse("QHTTPGET:", 5000)!=true) return -1;
+	delay_1ms(200);	
+	
+	//把请求获取的数据通过文件系统保存
+	readHttpfile(cmd,"bin.txt",80);
+	EC800MSendCmd(cmd,strlen(cmd));
+  if(WaitResponse(RSP_OK, 5000)!=true) return -1;	
+	task_fwdgt_reload();
+	delay_1ms(1000);
+	task_fwdgt_reload();
+	delay_1ms(1000);	
+	return 1;
+	
+}
+//检查程序版本是否要升级
+//参数url从此处获取程序  http://gpu.ringzle.com:8082/iot/vesion/control/getDeviceVersionInfo/DTU/4G
+int check_soft_version(char *url,char *version)
+{
+	char versionUrl[100];
+	sprintf(versionUrl,"http://gpu.ringzle.com:8082/iot/vesion/control/getDeviceVersionInfo/DTU/4G");
+	
+	char cmd[50];
+	//设置服务器URL len
+	cmdHttpSetUrlLen(cmd,strlen(versionUrl));
+	EC800MSendCmd(cmd,strlen(cmd));
+	WaitResponse(RSP_CONNECT, 5000);
+	delay_1ms(200);
+	//发送服务器url
+	EC800MSendCmd(versionUrl,strlen(versionUrl));
+	if(WaitResponse(RSP_OK, 5000)!=true) return -1;
+	//向对应服务器发送get请求
+	delay_1ms(200);
+	cmdHttpGET(cmd);
+	EC800MSendCmd(cmd,strlen(cmd));
+	delay_1ms(100);
+	if(WaitResponse("QHTTPGET", 5000)!=true) return -1;
+	//读取网页响应信息
+	delay_1ms(200);
+	readHttpfile(cmd,"version.txt",80);
+	EC800MSendCmd(cmd,strlen(cmd));
+  if(WaitResponse(RSP_OK, 5000)!=true) return -1;
+	delay_1ms(1000);
+	cmdReadFile(cmd,"version.txt");
+	EC800MSendCmd(cmd,strlen(cmd));
+			task_fwdgt_reload();
+	delay_1ms(1000);
+	if(extract_url_and_version( (char *)&UART0_RX_BUF,url,version)!=true)return -1;
+	return 1;
+}
+
+
+// 提取URL和版本的函数
+bool extract_url_and_version(char* data, char* url, char* version) {
+    char *ok_ptr, *json_start, *json_end, *url_start, *url_end, *version_start, *version_end;
+
+    // 检查是否含有OK
+    ok_ptr = strstr(data, "OK");
+    if (ok_ptr == NULL) {
+        return false;
+    }
+
+    // 寻找{}中的内容
+    json_start = strstr(data, "{");
+    if (json_start == NULL) {
+        return false;
+    }
+    json_end = strstr(json_start, "}");
+    if (json_end == NULL) {
+        return false;
+    }
+
+    // 提取URL
+    url_start = strstr(json_start, "\"url\":\"");
+    if (url_start == NULL) {
+        return false;
+    }
+    url_start += strlen("\"url\":\"");
+    url_end = strstr(url_start, "\"");
+    if (url_end == NULL) {
+        return false;
+    }
+    strncpy(url, url_start, url_end - url_start);
+    url[url_end - url_start] = '\0';
+
+    // 提取版本
+    version_start = strstr(json_start, "\"version\":\"");
+    if (version_start == NULL) {
+        return false;
+    }
+    version_start += strlen("\"version\":\"");
+    version_end = strstr(version_start, "\"");
+    if (version_end == NULL) {
+        return false;
+    }
+    strncpy(version, version_start, version_end - version_start);
+    version[version_end - version_start] = '\0';
+
+    return true;
+}
+
+
+int update_version(BOOT_MESSAGE *old_version, const char *new_version) {
+    // 解析新版本号
+    char *token;
+    token = strtok((char *)new_version, ".");
+    uint8_t new_version_h = atoi(token);
+    token = strtok(NULL, ".");
+    uint8_t new_version_m = atoi(token);
+    token = strtok(NULL, ".");
+    uint8_t new_version_l = atoi(token);
+		if(new_version_h>old_version->VERSION_H)
+		{
+			//发生版本更新
+			old_version->VERSION_H=new_version_h;
+			old_version->VERSION_M=new_version_m;
+			old_version->VERSION_L=new_version_l;
+			old_version->UP_FLAG=1;
+			return 1;
+		}
+		else if(new_version_m > old_version->VERSION_M)
+		{
+			old_version->VERSION_H=new_version_h;
+			old_version->VERSION_M=new_version_m;
+			old_version->VERSION_L=new_version_l;
+			old_version->UP_FLAG=1;
+			return 1;
+		}
+		else if(new_version_l > old_version->VERSION_L)
+		{
+			old_version->VERSION_H=new_version_h;
+			old_version->VERSION_M=new_version_m;
+			old_version->VERSION_L=new_version_l;
+			old_version->UP_FLAG=1;
+			return 1;
+		}
+		else
+		{
+			return 0;
+		}
+		
+}
+void delete_file()
+{
+	char cmd[50];
+	cmdDeletFile(cmd,"version.txt");
+	EC800MSendCmd(cmd,strlen(cmd));
+	WaitResponse(RSP_OK, 5000);
+	
+	cmdDeletFile(cmd,"bin.txt");
+	EC800MSendCmd(cmd,strlen(cmd));
+	WaitResponse(RSP_OK, 5000);
+}
+
+void check_update(void)
+{
+	char *bin_url=malloc(100);
+	char *version=malloc(20);
+		task_fwdgt_reload();	
+  delete_file();
+	if(check_soft_version(bin_url,version))//检查提取url
+	{
+			//判断两个版本号
+			BOOT_MESSAGE *old_version=malloc(sizeof(BOOT_MESSAGE));
+			GD32_READ_OTA(old_version);
+			delay_1ms(100);
+			task_fwdgt_reload();
+			if(update_version(old_version,version)==1)
+			{
+				if(load_file_config(bin_url)==1)
+				{
+					//列出所有file
+					delay_1ms(200);
+					EC800MSendCmd("AT+QFLST=\"*\"\r\n", strlen("AT+QFLST=\"*\"\r\n"));
+					if(WaitResponse("bin.txt", 100)==true)
+					{
+						//文件加载成功写入标志位
+						write_soft_version(old_version);
+						NVIC_SystemReset();
+					}
+				}
+			}
+			free(old_version);
+	}
+	free(bin_url);
+	free(version);
+}
+
+void save_version(char *version)
+{
+		BOOT_MESSAGE current_version;
+		char *token;
+    token = strtok(version, ".");
+    current_version.VERSION_H = atoi(token);
+    token = strtok(NULL, ".");
+    current_version.VERSION_M = atoi(token);
+    token = strtok(NULL, ".");
+    current_version.VERSION_L = atoi(token);
+		write_soft_version(&current_version);
+}

+ 7 - 0
app/App/load_file.h

@@ -0,0 +1,7 @@
+#ifndef LOAD_FILE_H
+#define LOAD_FILE_H
+int load_file_config(char *url);
+int check_soft_version(char *url,char *version);
+void check_update(void);
+void save_version(char *version);
+#endif

+ 25 - 6
app/App/main.c

@@ -52,10 +52,12 @@ OF SUCH DAMAGE.
 #include "w25q32.h"
 #include "key.h"
 #include "device_alive.h"
+#include "load_file.h"
+#include "gd_ota_flash.h"
 #define UNIQUE_ID 0x1FFFF7E8
 
 
-#define VERSION "V1.2.0" // 版本号写死、通过人工手动控制
+#define VERSION "1.0.10" // 版本号写死、必须和云端程序版本相同
 
 #define GATEWAYNAME "DTU"
 #define GATEWAYMODE "4G" // 后续此mode可以切换4g
@@ -69,13 +71,17 @@ void task_fwdgt_reload();
 
 int main(void)
   {
+		
+	//开启看门狗
+	fwdgt_init();
 	/* configure systick */
 	rcu_osci_on(RCU_HXTAL);
 	systick_config();
 	nvic_config();
+		
+	save_version(VERSION);
 	/* initilize the LEDs, USART */
-	W25Q32_Init();
-	gd_eval_led_init(LED1);
+	gd_eval_led_init(LED1);   
 	gd_com_init(COM_232);
 	gd_com_init(COM_EC800);
 	dma_config();
@@ -84,7 +90,18 @@ int main(void)
 	EC800MPwoerOn();
 	EC800MWaitReady();
 	EC800MSetPDP();
+		
+
+	
+	
+	
 	
+	config_485_port(9600,2400,8,1,2);
+	gd_485_DE_pin_init();
+	//检查是否要进入程序跟新
+	check_update();
+	
+
 	char *strID = malloc(24);
 	
 	readID(strID);
@@ -92,7 +109,7 @@ int main(void)
 	GATEWAY_PARAMS *gateway;
 	gateway = get_gateway_config_params();
 	
-	strcpy((char *)&gateway->gatewayId, strID);
+	strcpy((char *)&gateway->gatewayId, strID);  
 	strcpy((char *)&gateway->gatewayMode, GATEWAYMODE);
 	strcpy((char *)&gateway->gateName,GATEWAYNAME);
 	
@@ -123,8 +140,6 @@ int main(void)
 	mmodbus_init(1);
 	dlt645_init(10);
 
-	//开启看门狗
-//	fwdgt_init();
 	while (1)
 	{
 		check_ota_event();                              //检测是否有ota事件产生
@@ -143,6 +158,7 @@ void MQTT_Alarm_clock(int32_t time, GATEWAY_PARAMS *gateway)
 {
 	while (1)
 	{
+		gd_eval_led_toggle(LED1);
 		if (time <= 0 || time_arrive(15*60*1000))
 		{
 			Read_Data();
@@ -213,6 +229,9 @@ void http_load_config(uint8_t *httpURL)
 	uint32_t BufferSize=46*1024;//最大获取的数据空间
 	char *dmabuffer=malloc(BufferSize);
 	__LOAD_CONFIG:
+	dma_config();
+	delay_1ms(1000);
+	task_fwdgt_reload();
 	if (EC800MGetUrl(httpURL,dmabuffer,BufferSize) == true) // 从http获取信息,获取成功则保存到本地
 	{
 		if(WaitForUpData(dmabuffer)==false) goto __LOAD_CONFIG;

+ 2 - 2
app/App/parseDeviceMessage.c

@@ -679,9 +679,9 @@ void parseMQTTData(GATEWAY_PARAMS *gateway)
         // 上传对应的响应信息
         sprintf((char *)mqtt_publish, "AT+QMTPUBEX=0,0,0,0,\"%s\",%d\r\n", gateway->messageTopic, strlen(payload_out));
         EC800MSendCmd(mqtt_publish, strlen(mqtt_publish));
-        WaitResponse("<", 1000);
+        WaitResponse("<", 3000);
         EC800MSendCmd(payload_out, strlen(payload_out));
-        WaitResponse(RSP_OK, 1000);
+        WaitResponse(RSP_OK, 3000);
       }
       cJSON_Delete(mqtt_sub_json);
     }

+ 1 - 1
app/CMSIS/system_gd32f10x.c

@@ -42,7 +42,7 @@ OF SUCH DAMAGE.
 #define __HXTAL           (HXTAL_VALUE)            /* high speed crystal oscillator frequency */
 #define __SYS_OSC_CLK     (__IRC8M)                /* main oscillator frequency */
 
-#define VECT_TAB_OFFSET  (uint32_t)0x5000            /* vector table base offset */
+#define VECT_TAB_OFFSET  (uint32_t)0x19000            /* vector table base offset */
 
 /* select a system clock by uncommenting the following line */
 /* use IRC8M */

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2695 - 1087
app/Proj/JLinkLog.txt


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1309 - 1160
app/Proj/Listings/Ringzle.map


BIN=BIN
app/Proj/Objects/Ringzle.axf


BIN=BIN
app/Proj/Objects/Ringzle.bin


+ 5 - 14
app/Proj/Objects/Ringzle.build_log.htm

@@ -17,27 +17,18 @@ Library Manager: ArmAr.exe V5.06 update 6 (build 750)
 Hex Converter:   FromElf.exe V5.06 update 6 (build 750)
 CPU DLL:         SARMCM3.DLL V5.29.0.0
 Dialog DLL:      DCM.DLL V1.17.3.0
-Target DLL:      Segger\JL2CM3.dll V2.99.36.0
+Target DLL:      CMSIS_AGDI.dll V1.32.0.0
 Dialog DLL:      TCM.DLL V1.36.5.0
  
 <h2>Project:</h2>
-D:\Project\dtu_gateway\app\Proj\Ringzle.uvprojx
-Project File Date:  10/16/2023
+C:\Users\16936\Desktop\dtu_gateway\app\Proj\Ringzle.uvprojx
+Project File Date:  04/10/2024
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\workSoftware\stm32Software\mdk\mdkcore\ARM\ARMCC\Bin'
 Build target 'GD32F103C8T6'
-compiling dlt645_port.c...
-..\dlt\port\dlt645_port.c(125): warning:  #223-D: function "memcpy" declared implicitly
-  			memcpy(msg, &(dlt645_port.rxBuf[4]), len-4);
-..\dlt\port\dlt645_port.c(144): 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=31968 RO-data=1692 RW-data=236 ZI-data=83260  
-FromELF: creating hex file...
 After Build - User command #1: fromelf --bin --output ./Objects/Ringzle.bin ./Objects/Ringzle.axf
-".\Objects\Ringzle.axf" - 0 Error(s), 2 Warning(s).
+".\Objects\Ringzle.axf" - 0 Error(s), 0 Warning(s).
 
 <h2>Software Packages used:</h2>
 
@@ -51,7 +42,7 @@ Package Vendor: GigaDevice
   D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include
 
 <h2>Collection of Component Files used:</h2>
-Build Time Elapsed:  00:00:01
+Build Time Elapsed:  00:00:00
 </pre>
 </body>
 </html>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1457 - 1235
app/Proj/Objects/Ringzle.htm


+ 2 - 0
app/Proj/Objects/Ringzle.lnp

@@ -13,6 +13,8 @@
 ".\objects\pc.o"
 ".\objects\otaevent.o"
 ".\objects\device_alive.o"
+".\objects\load_file.o"
+".\objects\gd_ota_flash.o"
 ".\objects\gd32f10x_adc.o"
 ".\objects\gd32f10x_bkp.o"
 ".\objects\gd32f10x_can.o"

+ 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 0x08019000 0x000E6000  {    ; load region size_region
+  ER_IROM1 0x08019000 0x000E6000  {  ; load address = execution address
    *.o (RESET, +First)
    *(InRoot$$Sections)
    .ANY (+RO)

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1462 - 1384
app/Proj/Objects/Ringzle_GD32F103C8T6.dep


+ 2 - 2
app/Proj/Objects/Ringzle_sct.Bak

@@ -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 0x08019000 0x000FA000  {    ; load region size_region
+  ER_IROM1 0x08019000 0x000FA000  {  ; load address = execution address
    *.o (RESET, +First)
    *(InRoot$$Sections)
    .ANY (+RO)

BIN=BIN
app/Proj/Objects/cjson.crf


BIN=BIN
app/Proj/Objects/device_message.crf


BIN=BIN
app/Proj/Objects/dlt645.crf


BIN=BIN
app/Proj/Objects/dlt645_1997.crf


BIN=BIN
app/Proj/Objects/dlt645_2007.crf


BIN=BIN
app/Proj/Objects/dlt645_data.crf


BIN=BIN
app/Proj/Objects/dlt645_port.crf


BIN=BIN
app/Proj/Objects/ec800m.crf


BIN=BIN
app/Proj/Objects/gd32f10x_adc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_bkp.crf


BIN=BIN
app/Proj/Objects/gd32f10x_can.crf


BIN=BIN
app/Proj/Objects/gd32f10x_crc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_dac.crf


BIN=BIN
app/Proj/Objects/gd32f10x_dbg.crf


BIN=BIN
app/Proj/Objects/gd32f10x_dma.crf


BIN=BIN
app/Proj/Objects/gd32f10x_enet.crf


BIN=BIN
app/Proj/Objects/gd32f10x_exmc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_exti.crf


BIN=BIN
app/Proj/Objects/gd32f10x_fmc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_fwdgt.crf


BIN=BIN
app/Proj/Objects/gd32f10x_gpio.crf


BIN=BIN
app/Proj/Objects/gd32f10x_i2c.crf


BIN=BIN
app/Proj/Objects/gd32f10x_it.crf


BIN=BIN
app/Proj/Objects/gd32f10x_misc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_pmu.crf


BIN=BIN
app/Proj/Objects/gd32f10x_rcu.crf


BIN=BIN
app/Proj/Objects/gd32f10x_rtc.crf


BIN=BIN
app/Proj/Objects/gd32f10x_sdio.crf


BIN=BIN
app/Proj/Objects/gd32f10x_spi.crf


BIN=BIN
app/Proj/Objects/gd32f10x_timer.crf


BIN=BIN
app/Proj/Objects/gd32f10x_usart.crf


BIN=BIN
app/Proj/Objects/gd32f10x_wwdgt.crf


BIN=BIN
app/Proj/Objects/key.crf


+ 1 - 0
app/Proj/Objects/key.d

@@ -34,3 +34,4 @@
 .\objects\key.o: ..\bsp\key.h
 .\objects\key.o: ..\App\systick.h
 .\objects\key.o: ..\App\device_message.h
+.\objects\key.o: ..\App\ec800m.h

BIN=BIN
app/Proj/Objects/led.crf


BIN=BIN
app/Proj/Objects/log.crf


BIN=BIN
app/Proj/Objects/main.crf


+ 2 - 0
app/Proj/Objects/main.d

@@ -53,3 +53,5 @@
 .\objects\main.o: ..\bsp\w25q32.h
 .\objects\main.o: ..\bsp\key.h
 .\objects\main.o: ..\App\device_alive.h
+.\objects\main.o: ..\App\load_file.h
+.\objects\main.o: ..\App\gd_ota_flash.h

BIN=BIN
app/Proj/Objects/mmodbus.crf


BIN=BIN
app/Proj/Objects/mqttrecv.crf


BIN=BIN
app/Proj/Objects/otaevent.crf


BIN=BIN
app/Proj/Objects/parsedevicemessage.crf


BIN=BIN
app/Proj/Objects/pc.crf


BIN=BIN
app/Proj/Objects/ring_buffer.crf


BIN=BIN
app/Proj/Objects/spi.crf


BIN=BIN
app/Proj/Objects/system_gd32f10x.crf


BIN=BIN
app/Proj/Objects/systick.crf


BIN=BIN
app/Proj/Objects/usart.crf


BIN=BIN
app/Proj/Objects/w25q32.crf


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 210 - 228
app/Proj/Ringzle.uvguix.16936


+ 76 - 79
app/Proj/Ringzle.uvoptx

@@ -103,7 +103,7 @@
         <bEvRecOn>1</bEvRecOn>
         <bSchkAxf>0</bSchkAxf>
         <bTchkAxf>0</bTchkAxf>
-        <nTsel>4</nTsel>
+        <nTsel>3</nTsel>
         <sDll></sDll>
         <sDllPa></sDllPa>
         <sDlgDll></sDlgDll>
@@ -114,9 +114,14 @@
         <tDlgDll></tDlgDll>
         <tDlgPa></tDlgPa>
         <tIfile></tIfile>
-        <pMon>Segger\JL2CM3.dll</pMon>
+        <pMon>BIN\CMSIS_AGDI.dll</pMon>
       </DebugOpt>
       <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>ST-LINKIII-KEIL_SWO</Key>
+          <Name>-U -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0GD32F10x_XD.FLM -FS08000000 -FL0100000 -FP0($$Device:GD32F103VG$Flash\GD32F10x_XD.FLM)</Name>
+        </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGUARM</Key>
@@ -135,7 +140,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>CMSIS_AGDI</Key>
-          <Name>-X"Any" -UAny -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0GD32F10x_XD.FLM -FS08000000 -FL0100000 -FP0($$Device:GD32F103VG$Flash\GD32F10x_XD.FLM)</Name>
+          <Name>-X"Any" -UAny -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0GD32F10x_XD.FLM -FS08000000 -FL0100000 -FP0($$Device:GD32F103VG$Flash\GD32F10x_XD.FLM)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -157,39 +162,7 @@
         <Bp>
           <Number>0</Number>
           <Type>0</Type>
-          <LineNumber>124</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>134256344</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>..\dlt\port\dlt645_port.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\Ringzle\../dlt/port/dlt645_port.c\124</Expression>
-        </Bp>
-        <Bp>
-          <Number>1</Number>
-          <Type>0</Type>
-          <LineNumber>419</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>134261850</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>..\App\parseDeviceMessage.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\Ringzle\../App/parseDeviceMessage.c\419</Expression>
-        </Bp>
-        <Bp>
-          <Number>2</Number>
-          <Type>0</Type>
-          <LineNumber>123</LineNumber>
+          <LineNumber>120</LineNumber>
           <EnabledFlag>1</EnabledFlag>
           <Address>0</Address>
           <ByteObject>0</ByteObject>
@@ -198,7 +171,7 @@
           <SizeOfObject>0</SizeOfObject>
           <BreakByAccess>0</BreakByAccess>
           <BreakIfRCount>0</BreakIfRCount>
-          <Filename>..\dlt\port\dlt645_port.c</Filename>
+          <Filename>..\App\main.c</Filename>
           <ExecCommand></ExecCommand>
           <Expression></Expression>
         </Bp>
@@ -206,8 +179,8 @@
       <MemoryWindow1>
         <Mm>
           <WinNumber>1</WinNumber>
-          <SubType>3</SubType>
-          <ItemText>&amp;dlt645_port.index</ItemText>
+          <SubType>8</SubType>
+          <ItemText>UART0_RX_BUF</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow1>
@@ -258,7 +231,7 @@
 
   <Group>
     <GroupName>CMSIS</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -278,7 +251,7 @@
 
   <Group>
     <GroupName>Startup</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -446,6 +419,30 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>15</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\App\load_file.c</PathWithFileName>
+      <FilenameWithoutPath>load_file.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>16</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\App\gd_ota_flash.c</PathWithFileName>
+      <FilenameWithoutPath>gd_ota_flash.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
@@ -456,7 +453,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>15</FileNumber>
+      <FileNumber>17</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -468,7 +465,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>16</FileNumber>
+      <FileNumber>18</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -480,7 +477,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>17</FileNumber>
+      <FileNumber>19</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -492,7 +489,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>18</FileNumber>
+      <FileNumber>20</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -504,7 +501,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>19</FileNumber>
+      <FileNumber>21</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -516,7 +513,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>20</FileNumber>
+      <FileNumber>22</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -528,7 +525,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>21</FileNumber>
+      <FileNumber>23</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -540,7 +537,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>22</FileNumber>
+      <FileNumber>24</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -552,7 +549,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>23</FileNumber>
+      <FileNumber>25</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -564,7 +561,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>24</FileNumber>
+      <FileNumber>26</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -576,7 +573,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>25</FileNumber>
+      <FileNumber>27</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -588,7 +585,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>26</FileNumber>
+      <FileNumber>28</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -600,7 +597,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>27</FileNumber>
+      <FileNumber>29</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -612,7 +609,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>28</FileNumber>
+      <FileNumber>30</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -624,7 +621,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>29</FileNumber>
+      <FileNumber>31</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -636,7 +633,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>30</FileNumber>
+      <FileNumber>32</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -648,7 +645,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>31</FileNumber>
+      <FileNumber>33</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -660,7 +657,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>32</FileNumber>
+      <FileNumber>34</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -672,7 +669,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>33</FileNumber>
+      <FileNumber>35</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -684,7 +681,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>34</FileNumber>
+      <FileNumber>36</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -696,7 +693,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>35</FileNumber>
+      <FileNumber>37</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -708,7 +705,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>36</FileNumber>
+      <FileNumber>38</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -720,7 +717,7 @@
     </File>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>37</FileNumber>
+      <FileNumber>39</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -734,13 +731,13 @@
 
   <Group>
     <GroupName>bsp</GroupName>
-    <tvExp>1</tvExp>
+    <tvExp>0</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>38</FileNumber>
+      <FileNumber>40</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -752,7 +749,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>39</FileNumber>
+      <FileNumber>41</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -764,7 +761,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>40</FileNumber>
+      <FileNumber>42</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -776,7 +773,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>41</FileNumber>
+      <FileNumber>43</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -788,7 +785,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>42</FileNumber>
+      <FileNumber>44</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -800,7 +797,7 @@
     </File>
     <File>
       <GroupNumber>5</GroupNumber>
-      <FileNumber>43</FileNumber>
+      <FileNumber>45</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -820,7 +817,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>6</GroupNumber>
-      <FileNumber>44</FileNumber>
+      <FileNumber>46</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -834,13 +831,13 @@
 
   <Group>
     <GroupName>dlt</GroupName>
-    <tvExp>1</tvExp>
+    <tvExp>0</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>7</GroupNumber>
-      <FileNumber>45</FileNumber>
+      <FileNumber>47</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -852,7 +849,7 @@
     </File>
     <File>
       <GroupNumber>7</GroupNumber>
-      <FileNumber>46</FileNumber>
+      <FileNumber>48</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -864,7 +861,7 @@
     </File>
     <File>
       <GroupNumber>7</GroupNumber>
-      <FileNumber>47</FileNumber>
+      <FileNumber>49</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -876,7 +873,7 @@
     </File>
     <File>
       <GroupNumber>7</GroupNumber>
-      <FileNumber>48</FileNumber>
+      <FileNumber>50</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -888,7 +885,7 @@
     </File>
     <File>
       <GroupNumber>7</GroupNumber>
-      <FileNumber>49</FileNumber>
+      <FileNumber>51</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -908,7 +905,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>8</GroupNumber>
-      <FileNumber>50</FileNumber>
+      <FileNumber>52</FileNumber>
       <FileType>5</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>

+ 12 - 2
app/Proj/Ringzle.uvprojx

@@ -274,8 +274,8 @@
               </OCR_RVCT3>
               <OCR_RVCT4>
                 <Type>1</Type>
-                <StartAddress>0x8005000</StartAddress>
-                <Size>0x100000</Size>
+                <StartAddress>0x8019000</StartAddress>
+                <Size>0xe6000</Size>
               </OCR_RVCT4>
               <OCR_RVCT5>
                 <Type>1</Type>
@@ -462,6 +462,16 @@
               <FileType>1</FileType>
               <FilePath>..\App\device_alive.c</FilePath>
             </File>
+            <File>
+              <FileName>load_file.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\App\load_file.c</FilePath>
+            </File>
+            <File>
+              <FileName>gd_ota_flash.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\App\gd_ota_flash.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>

+ 6 - 7
app/bsp/key.c

@@ -2,6 +2,7 @@
 #include "key.h"
 #include "systick.h"
 #include "device_message.h"
+#include "ec800m.h"
 static uint32_t KEY_PORT[KEYn] = {SYS_RECOVERY_KEY_GPIO_PORT};
 static uint32_t KEY_PIN[KEYn] = {SYS_RECOVERY_KEY_PIN};
 static rcu_periph_enum KEY_CLK[KEYn] = {SYS_RECOVERY_KEY_GPIO_CLK};
@@ -34,15 +35,13 @@ void gd_eval_key_init(key_typedef_enum key_num, keymode_typedef_enum key_mode)
 
 void EXTI1_IRQHandler(void){
 	if (exti_interrupt_flag_get(EXTI_1) != RESET) {
-        /* 延时1秒钟 */
-        delay_1ms(1000);
-
         /* 判断按键是否仍然被按下 */
-        if (gpio_input_bit_get(KEY_PORT[0], KEY_PIN[0]) == RESET) {
-            /* 执行数据清除操作 */
-//            clear_gateway_config_block();
+        if (gpio_input_bit_get(KEY_PORT[0], KEY_PIN[0]) == RESET) 
+				{
+					
+					//删除配置文件
+					delete_config_file();
         }
-
         /* 清除EXTI1中断标志 */
         exti_interrupt_flag_clear(EXTI_1);
 				NVIC_SystemReset();               //设备重启

+ 0 - 1
app/bsp/usart.c

@@ -329,4 +329,3 @@ void nvic_config(void)
 	
 }
 
-

+ 43 - 0
bootloader/HW/Include/ec800.h

@@ -0,0 +1,43 @@
+#ifndef EC800_H
+#define EC800_H
+
+#include "gd32f10x.h"
+
+#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 UART0_RX_LEN		(512)
+ 
+extern uint8_t UART0_RX_BUF[UART0_RX_LEN];
+extern uint8_t UART0_RX_STAT;
+
+void gd_com_init();
+void dma_config(void);
+
+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 EC800MPwoerOn(void);
+void EC800MWaitReady();
+void EC800MSetPDP();
+void dma_config_change(char *dmaBuffer,uint32_t bufferSize);
+int read_bin_txt();
+#endif

+ 20 - 0
bootloader/HW/Include/gd_ota_flash.h

@@ -0,0 +1,20 @@
+#ifndef GD_OTA_FLASH_H
+#define GD_OTA_FLASH_H
+#include <stdint.h>
+//µÚ124Ò³
+#define FMC_READ(addrx) (*(volatile uint32_t *)(uint32_t)(addrx))
+#define FMC_WRITE_START_ADDR    ((uint32_t)0x08005000U+0xFA000) //ÆðʼµØÖ· 
+#define FMC_Page 1020
+
+typedef struct _BOOT_MESSAGE
+{
+	uint8_t VERSION_H;
+	uint8_t VERSION_M;
+	uint8_t VERSION_L;
+	uint8_t UP_FLAG;
+}BOOT_MESSAGE;
+void soft_init();
+void write_soft_version();
+void GD32_READ_OTA(BOOT_MESSAGE *READ);
+void write_soft_version(BOOT_MESSAGE *save_message);
+#endif

+ 3 - 0
bootloader/HW/Source/boot.c

@@ -69,6 +69,9 @@ void LOAD_A(uint32_t addr)
 /*-------------------------------------------------*/
 void BootLoader_Clear(void)
 {
+	usart_disable(USART0);
+	dma_channel_disable(DMA0, DMA_CH4);
+	dma_deinit(DMA0, DMA_CH4);
 	gpio_deinit(GPIOA);    
 	gpio_deinit(GPIOB);    
 }

+ 429 - 0
bootloader/HW/Source/ec800.c

@@ -0,0 +1,429 @@
+#include "ec800.h"
+#include "delay.h"
+#include "string.h"
+#include <stdlib.h>
+#include "fmc.h"
+#include "main.h"
+/*!
+    \brief      configure EC800M pin
+    \param[out] none 
+    \retval     none
+*/
+#define RSP_READY "RDY"
+#define CMD_SET_PDP "AT+QICSGP=1,1,\"CTNET\",\"\",\"\",1\r\n" 
+#define RSP_OK "OK"
+#define CMD_SET_ACTIVE "AT+QIACT=1\r\n"
+
+#define cmdOpenFile(cmd,filename) sprintf(cmd,"AT+QFOPEN=\"%s\",2\r\n",filename)
+#define cmdSetSeek(cmd,handle,offset) sprintf(cmd,"AT+QFSEEK=%d,%d,0\r\n",handle,offset)
+#define cmdReadFileData(cmd,handle) sprintf(cmd,"AT+QFREAD=%d,1024\r\n",handle)
+#define cmdLoadFile(cmd,filename) sprintf(cmd,"AT+QFDWL=%s\r\n",filename)
+
+uint8_t UART0_RX_BUF[UART0_RX_LEN];
+uint8_t UART0_RX_STAT;
+bool WaitResponse(char *expectStr, int timeout);
+void EC800MSendCmd(char *buf, uint16_t len);
+int get_file_handle(char *filename);
+static const char* my_memmem(const uint8_t* haystack, size_t hlen, const char* needle, size_t nlen);
+static void extract_data_from_buffer(const char *buffer, uint32_t *len_ptr, uint16_t *checkCode_ptr);
+static uint16_t checksum(const uint8_t *str, uint16_t len);
+
+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;
+}
+
+/*!
+    \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()
+{
+	  nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);  // 设置抢占优先级和子优先级的位数为 2
+		nvic_irq_enable(USART0_IRQn, 0, 0);
+	
+    /* enable GPIO clock */
+    rcu_periph_clock_enable(COM_EC800_GPIO_CLK);
+    /* enable USART clock */
+    rcu_periph_clock_enable(COM_EC800_CLK);
+    /* connect port to USARTx_Tx */
+    gpio_init(COM_EC800_GPIO_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, COM_EC800_TX_PIN);
+    /* connect port to USARTx_Rx */
+    gpio_init(COM_EC800_GPIO_PORT, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, COM_EC800_RX_PIN);
+		
+    /* USART configure */
+    usart_deinit(COM_EC800);
+    usart_baudrate_set(COM_EC800, COM_EC800_BAUDRATE);
+    usart_word_length_set(COM_EC800, USART_WL_8BIT);
+    usart_stop_bit_set(COM_EC800, USART_STB_1BIT);
+    usart_parity_config(COM_EC800, USART_PM_NONE);
+    usart_hardware_flow_rts_config(COM_EC800, USART_RTS_DISABLE);
+    usart_hardware_flow_cts_config(COM_EC800, USART_CTS_DISABLE);
+    usart_receive_config(COM_EC800, USART_RECEIVE_ENABLE);
+    usart_transmit_config(COM_EC800, USART_TRANSMIT_ENABLE);
+    usart_enable(COM_EC800);
+   	usart_interrupt_enable(COM_EC800, USART_INT_IDLE);
+    
+}
+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, 1);
+	
+    dma_interrupt_enable(DMA0, DMA_CH4, DMA_INT_FTF|DMA_INT_HTF|DMA_INT_ERR);
+    dma_channel_enable(DMA0, DMA_CH4);
+}
+
+// 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_STAT = 0x01;              /* 接受状态 0x01:已接收到数据 */
+			  dma_channel_enable(DMA0, DMA_CH4);
+			  
+    }
+}
+void DMA0_Channel4_IRQHandler(void)
+{
+	dma_interrupt_flag_clear(DMA0, DMA_CH4, DMA_INT_FLAG_G);
+}
+
+//清除dma buffer内数据
+void Clear_DMA_Buffer(void)
+{
+   memset(UART0_RX_BUF,0,UART0_RX_LEN);
+}
+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 EC800MWaitReady()
+{
+	if(WaitResponse(RSP_READY, 5000)==FALSE) NVIC_SystemReset();
+}
+
+/*
+ *  函数名: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;
+		}
+	};
+}
+/*
+ *  函数名:bool WaitResponse(char *expectStr, int timeout)
+ *  输入参数:expectStr 需要匹配的关键字 timeout超时时间
+ *  输出参数:true flase
+ *  返回值:无
+ *  函数作用:从UART0_RX_BUF缓冲区中匹配有无对应关键字有关键字则返回true无返回false
+ */
+bool WaitResponseNotclear(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)
+			{
+				return TRUE;
+			}
+		}
+		timeout -= 50;
+		if (timeoutFlag == TRUE && timeout <= 0)
+		{
+			return FALSE;
+		}
+	};
+}
+/*
+ *  函数名:void EC800MSetPDP()
+ *  输入参数:无
+ *  输出参数:无
+ *  返回值:无
+ *  函数作用:设置对应运营商和激活ip
+ */
+void EC800MSetPDP()
+{
+	Delay_Ms(200);
+	EC800MSendCmd(CMD_SET_PDP, strlen(CMD_SET_PDP));
+	WaitResponse(RSP_OK, 1000);
+	Delay_Ms(200);
+	EC800MSendCmd(CMD_SET_ACTIVE, strlen(CMD_SET_ACTIVE));
+	WaitResponse(RSP_OK, 1000);
+	Delay_Ms(2000);
+}
+
+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))
+			;
+	}
+}
+
+//读取bin文件内容
+int read_bin_txt()
+{
+	char *ptr;
+	uint32_t len;
+  uint16_t checkCode;
+	char sub_str[] = "\r\n+QFDWL:";
+	char cmd[50];
+	uint32_t BufferSize=40*1024;//最大获取的数据空间
+	uint8_t *dmabuffer=malloc(BufferSize);
+	dma_config_change(dmabuffer,BufferSize);
+	cmdLoadFile(cmd,"bin.txt");
+//	Delay_Ms(1000);
+//	EC800MSendCmd("AT+QFLST=\"*\"\r\n", strlen("AT+QFLST=\"*\"\r\n"));
+	
+	Delay_Ms(1000);
+	EC800MSendCmd(cmd, strlen(cmd));
+	Delay_Ms(5000);
+	
+	
+	
+	ptr = (char *)my_memmem(dmabuffer, BufferSize, sub_str, strlen(sub_str));
+	if(ptr==NULL){	free(dmabuffer);return 2;}
+	if(strstr(ptr,"ERROR"))
+	{
+		return 2;
+	}
+	extract_data_from_buffer(ptr,&len, &checkCode);
+		uint16_t code=checksum(dmabuffer,len);
+	if(checkCode==checksum(dmabuffer,len))
+	{
+		//校验成功数据正常,写入数据
+			GD32_EraseFlash(GD32_A_START_PAGE,GD32_A_PAGE_NUM);//擦除A区原有程序
+			GD32_WriteFlash(GD32_A_SADDR,(uint32_t *)dmabuffer,len);
+			free(dmabuffer);
+		return 1;
+	}
+	
+  dma_config();
+	free(dmabuffer);
+	return 0;
+}
+////获取文件句柄
+//int get_file_handle(char *filename)
+//{
+//	int num;
+//	char *ptr_start;
+//	ptr_start=strstr((char *)&UART0_RX_BUF, filename);
+//	if (ptr_start == NULL) {}
+//		ptr_start = strchr(ptr_start, ':');
+//	 ptr_start++; // 跳过逗号
+//	 sscanf(ptr_start, "%d", &num);
+//	 return num;
+//}
+
+
+//手动控制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);
+}
+
+static const char* my_memmem(const uint8_t* haystack, size_t hlen, const char* needle, size_t nlen)
+{
+	const char* cur;
+	const char* last;
+
+	last =  haystack + hlen - nlen;
+	for (cur = haystack; cur <= last; ++cur) {
+		if (cur[0] == needle[0] && memcmp(cur, needle, nlen) == 0) {
+			return cur;
+		}
+	}
+	return NULL;
+}
+/*
+ *  函数名: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;
+  }
+}
+// 模块下载download校验值
+static uint16_t checksum(const uint8_t *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;
+}
+

+ 49 - 0
bootloader/HW/Source/gd_ota_flash.c

@@ -0,0 +1,49 @@
+#include "gd_ota_flash.h"
+#include "gd32f10x_fmc.h"
+#include "delay.h"
+#include "string.h"
+#include <stdlib.h>
+
+void GD32_WriteFlash(uint32_t saddr, uint32_t *wdata, uint32_t wnum);
+void GD32_EraseFlash(uint16_t start, uint16_t num);
+
+//读取soft版本信息
+int read_soft_version()
+{
+	
+}
+
+
+void write_soft_version(BOOT_MESSAGE *save_message)
+{
+	
+	GD32_EraseFlash(FMC_Page,1);
+	uint32_t data=FMC_READ(FMC_WRITE_START_ADDR);
+	GD32_WriteFlash(FMC_WRITE_START_ADDR,(uint32_t *) save_message,sizeof(BOOT_MESSAGE));
+	
+}
+
+
+//读取GD32flash
+void GD32_READ_OTA(BOOT_MESSAGE *READ)
+{
+	uint32_t data=FMC_READ(FMC_WRITE_START_ADDR);
+	Delay_Ms(10);
+	memcpy(READ,&data,4);
+}
+//对系统存储版本信息进行初始化
+void soft_init()
+{
+	BOOT_MESSAGE *currentBoot=malloc(sizeof(BOOT_MESSAGE));
+	GD32_READ_OTA(currentBoot);
+	if(currentBoot->VERSION_H==0xFF && currentBoot->VERSION_M==0xFF &&currentBoot->VERSION_L==0xFF )
+	{
+		currentBoot->VERSION_H=1;currentBoot->VERSION_L=0;currentBoot->VERSION_M=0;currentBoot->UP_FLAG=0;
+		write_soft_version(currentBoot);
+	}
+	
+	free(currentBoot);
+	
+}
+
+

+ 2 - 0
bootloader/OBJ/ExtDll.iex

@@ -0,0 +1,2 @@
+[EXTDLL]
+Count=0

BIN=BIN
bootloader/OBJ/boot.crf


+ 3 - 1
bootloader/OBJ/boot.d

@@ -7,13 +7,15 @@
 ..\obj\boot.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\boot.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\boot.o: ..\USER\RTE_Components.h
-..\obj\boot.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\boot.o: ..\LIB\Include\gd32f10x_dma.h
 ..\obj\boot.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\boot.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_fwdgt.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\boot.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\boot.o: ..\LIB\Include\gd32f10x_wwdgt.h
 ..\obj\boot.o: ..\HW\Include\boot.h
 ..\obj\boot.o: ..\USER\main.h

BIN=BIN
bootloader/OBJ/bootloader.axf


+ 54 - 5
bootloader/OBJ/bootloader.build_log.htm

@@ -17,17 +17,66 @@ Library Manager: ArmAr.exe V5.06 update 6 (build 750)
 Hex Converter:   FromElf.exe V5.06 update 6 (build 750)
 CPU DLL:         SARMCM3.DLL V5.29.0.0
 Dialog DLL:      DCM.DLL V1.17.3.0
-Target DLL:      Segger\JL2CM3.dll V2.99.36.0
+Target DLL:      CMSIS_AGDI.dll V1.32.0.0
 Dialog DLL:      TCM.DLL V1.36.5.0
  
 <h2>Project:</h2>
-D:\Project\dtu_gateway\bootloader\USER\bootloader.uvprojx
-Project File Date:  08/11/2023
+C:\Users\16936\Desktop\dtu_gateway\bootloader\USER\bootloader.uvprojx
+Project File Date:  04/10/2024
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\workSoftware\stm32Software\mdk\mdkcore\ARM\ARMCC\Bin'
 Build target 'bootloader'
-"..\OBJ\bootloader.axf" - 0 Error(s), 0 Warning(s).
+compiling main.c...
+main.h(26): 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();
+..\HW\Include\gd_ota_flash.h(16): warning:  #1295-D: Deprecated declaration soft_init - give arg types
+  void soft_init();
+..\HW\Include\gd_ota_flash.h(17): warning:  #1295-D: Deprecated declaration write_soft_version - give arg types
+  void write_soft_version();
+..\HW\Include\gd_ota_flash.h(20): warning:  #1-D: last line of file ends without a newline
+  #endif
+..\HW\Include\ec800.h(30): warning:  #1295-D: Deprecated declaration gd_com_init - give arg types
+  void gd_com_init();
+..\HW\Include\ec800.h(39): warning:  #1295-D: Deprecated declaration EC800MWaitReady - give arg types
+  void EC800MWaitReady();
+..\HW\Include\ec800.h(40): warning:  #1295-D: Deprecated declaration EC800MSetPDP - give arg types
+  void EC800MSetPDP();
+..\HW\Include\ec800.h(42): warning:  #1295-D: Deprecated declaration read_bin_txt - give arg types
+  int read_bin_txt();
+main.c(20): warning:  #177-D: variable "ota_data"  was declared but never referenced
+  	OTA_MESSAGE *ota_data;
+main.c: 11 warnings, 0 errors
+compiling ec800.c...
+..\HW\Include\ec800.h(30): warning:  #1295-D: Deprecated declaration gd_com_init - give arg types
+  void gd_com_init();
+..\HW\Include\ec800.h(39): warning:  #1295-D: Deprecated declaration EC800MWaitReady - give arg types
+  void EC800MWaitReady();
+..\HW\Include\ec800.h(40): warning:  #1295-D: Deprecated declaration EC800MSetPDP - give arg types
+  void EC800MSetPDP();
+..\HW\Include\ec800.h(42): warning:  #1295-D: Deprecated declaration read_bin_txt - give arg types
+  int read_bin_txt();
+..\USER\main.h(26): warning:  #1295-D: Deprecated declaration task_fwdgt_reload - give arg types
+  void task_fwdgt_reload();
+..\HW\Source\ec800.c(291): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *"
+  	dma_config_change(dmabuffer,BufferSize);
+..\HW\Source\ec800.c(292): warning:  #223-D: function "sprintf" declared implicitly
+  	cmdLoadFile(cmd,"bin.txt");
+..\HW\Source\ec800.c(371): warning:  #513-D: a value of type "const uint8_t *" cannot be assigned to an entity of type "const char *"
+  	last =  haystack + hlen - nlen;
+..\HW\Source\ec800.c(372): warning:  #513-D: a value of type "const uint8_t *" cannot be assigned to an entity of type "const char *"
+  	for (cur = haystack; cur <= last; ++cur) {
+..\HW\Source\ec800.c(393): warning:  #223-D: function "sscanf" declared implicitly
+      sscanf(start, "%u,", &len);     // ¶ÁÈ¡³¤¶È
+..\HW\Source\ec800.c: 10 warnings, 0 errors
+linking...
+Program Size: Code=7708 RO-data=400 RW-data=16 ZI-data=70144  
+FromELF: creating hex file...
+"..\OBJ\bootloader.axf" - 0 Error(s), 21 Warning(s).
 
 <h2>Software Packages used:</h2>
 
@@ -41,7 +90,7 @@ Package Vendor: GigaDevice
   D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include
 
 <h2>Collection of Component Files used:</h2>
-Build Time Elapsed:  00:00:00
+Build Time Elapsed:  00:00:01
 </pre>
 </body>
 </html>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 635 - 256
bootloader/OBJ/bootloader.htm


+ 4 - 0
bootloader/OBJ/bootloader.lnp

@@ -8,6 +8,8 @@
 "..\obj\spi.o"
 "..\obj\w25q32.o"
 "..\obj\ota_message.o"
+"..\obj\gd_ota_flash.o"
+"..\obj\ec800.o"
 "..\obj\gd32f10x_wwdgt.o"
 "..\obj\gd32f10x_misc.o"
 "..\obj\gd32f10x_rcu.o"
@@ -15,6 +17,8 @@
 "..\obj\gd32f10x_fmc.o"
 "..\obj\gd32f10x_spi.o"
 "..\obj\gd32f10x_fwdgt.o"
+"..\obj\gd32f10x_dma.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

+ 2 - 2
bootloader/OBJ/bootloader.sct

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

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 362 - 245
bootloader/OBJ/bootloader_bootloader.dep


+ 2 - 2
bootloader/OBJ/bootloader_sct.Bak

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

BIN=BIN
bootloader/OBJ/delay.crf


+ 3 - 1
bootloader/OBJ/delay.d

@@ -7,12 +7,14 @@
 ..\obj\delay.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\delay.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\delay.o: ..\USER\RTE_Components.h
-..\obj\delay.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\delay.o: ..\LIB\Include\gd32f10x_dma.h
 ..\obj\delay.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\delay.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_fwdgt.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\delay.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\delay.o: ..\LIB\Include\gd32f10x_wwdgt.h
 ..\obj\delay.o: ..\HW\Include\delay.h

BIN=BIN
bootloader/OBJ/fmc.crf


+ 3 - 1
bootloader/OBJ/fmc.d

@@ -7,12 +7,14 @@
 ..\obj\fmc.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\fmc.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\fmc.o: ..\USER\RTE_Components.h
-..\obj\fmc.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\fmc.o: ..\LIB\Include\gd32f10x_dma.h
 ..\obj\fmc.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\fmc.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_fwdgt.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\fmc.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\fmc.o: ..\LIB\Include\gd32f10x_wwdgt.h
 ..\obj\fmc.o: ..\HW\Include\fmc.h

BIN=BIN
bootloader/OBJ/gd32f10x_fmc.crf


+ 3 - 1
bootloader/OBJ/gd32f10x_fmc.d

@@ -8,11 +8,13 @@
 ..\obj\gd32f10x_fmc.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\gd32f10x_fmc.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\gd32f10x_fmc.o: ..\USER\RTE_Components.h
+..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_dma.h
+..\obj\gd32f10x_fmc.o: ..\CMSIS\Include\gd32f10x.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_fwdgt.h
-..\obj\gd32f10x_fmc.o: ..\CMSIS\Include\gd32f10x.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\gd32f10x_fmc.o: ..\LIB\Include\gd32f10x_wwdgt.h

BIN=BIN
bootloader/OBJ/gd32f10x_fwdgt.crf


+ 3 - 1
bootloader/OBJ/gd32f10x_fwdgt.d

@@ -8,11 +8,13 @@
 ..\obj\gd32f10x_fwdgt.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\gd32f10x_fwdgt.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\gd32f10x_fwdgt.o: ..\USER\RTE_Components.h
-..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_dma.h
 ..\obj\gd32f10x_fwdgt.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_fwdgt.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\gd32f10x_fwdgt.o: ..\LIB\Include\gd32f10x_wwdgt.h

BIN=BIN
bootloader/OBJ/gd32f10x_gpio.crf


+ 3 - 1
bootloader/OBJ/gd32f10x_gpio.d

@@ -8,11 +8,13 @@
 ..\obj\gd32f10x_gpio.o: ..\CMSIS\Include\system_gd32f10x.h
 ..\obj\gd32f10x_gpio.o: D:\workSoftware\stm32Software\mdk\mdkpack\GigaDevice\GD32F10x_DFP\2.0.3\Device\Include\gd32f10x_libopt.h
 ..\obj\gd32f10x_gpio.o: ..\USER\RTE_Components.h
-..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_fmc.h
+..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_dma.h
 ..\obj\gd32f10x_gpio.o: ..\CMSIS\Include\gd32f10x.h
+..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_fmc.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_fwdgt.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_gpio.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_misc.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_rcu.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_spi.h
+..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_usart.h
 ..\obj\gd32f10x_gpio.o: ..\LIB\Include\gd32f10x_wwdgt.h

BIN=BIN
bootloader/OBJ/gd32f10x_it.crf


+ 0 - 0
bootloader/OBJ/gd32f10x_it.d


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio