Преглед на файлове

fix mqtt ringbuffer % bug

haitao преди 1 година
родител
ревизия
19e9b26217

+ 4 - 3
app/App/main.c

@@ -146,7 +146,7 @@ int main(void)
 			break;
 	}
 	//开启看门狗
-		fwdgt_init();
+	fwdgt_init();
 	while (1)
 	{
 		check_ota_event();                              //检测是否有ota事件产生
@@ -239,7 +239,7 @@ void readID(char *strId)
  */
 void http_load_config(uint8_t *httpURL)
 {
-	uint32_t BufferSize=50*1024;//最大获取的数据空间
+	uint32_t BufferSize=46*1024;//最大获取的数据空间
 	char *dmabuffer=malloc(BufferSize);
 	if (EC800MGetUrl(httpURL,dmabuffer,BufferSize) == true) // 从http获取信息,获取成功则保存到本地
 	{
@@ -249,7 +249,8 @@ void http_load_config(uint8_t *httpURL)
 	{
 			dma_config_change(dmabuffer,BufferSize);
 			EC800MSendCmd(CMD_READ_FILE, strlen(CMD_READ_FILE)); //"AT+QFDWL=http.txt\r\n"
-			delay_1ms(6000);
+			delay_1ms(3000);
+			WaitForUpData(dmabuffer);
 	}
 	dma_config();
 	free(dmabuffer);

+ 0 - 1
app/App/parseDeviceMessage.c

@@ -220,7 +220,6 @@ void processHttp(const uint8_t *data)
 		gateway->data_valid_flag = 0xF1; 
     char* ptr = (char*)data;
    
-		
 		gateway->dataSource=parseIntField(ptr,"\"dataSource\":");
 		gateway->baudrate=parseIntField(ptr,"\"baudrate\":");
 		gateway->checkBit=parseIntField(ptr,"\"checkBit\":");

Файловите разлики са ограничени, защото са твърде много
+ 3080 - 764
app/Proj/JLinkLog.txt


Файловите разлики са ограничени, защото са твърде много
+ 445 - 453
app/Proj/Listings/Ringzle.map


+ 25 - 25
app/Proj/Listings/startup_gd32f10x_xd.lst

@@ -70,39 +70,39 @@ ARM Macro Assembler    Page 2
 
 
    42 00000000         
-   43 00000000 00000800 
+   43 00000000 00002000 
                        Stack_Size
-                               EQU              0x0000800
+                               EQU              0x0002000
    44 00000000         
    45 00000000                 AREA             STACK, NOINIT, READWRITE, ALIGN
  = 3
    46 00000000         Stack_Mem
                                SPACE            Stack_Size
-   47 00000800         __initial_sp
-   48 00000800         
-   49 00000800         
-   50 00000800         ; <h> Heap Configuration
-   51 00000800         ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-   52 00000800         ; </h>
-   53 00000800         
-   54 00000800 00010000 
+   47 00002000         __initial_sp
+   48 00002000         
+   49 00002000         
+   50 00002000         ; <h> Heap Configuration
+   51 00002000         ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+   52 00002000         ; </h>
+   53 00002000         
+   54 00002000 0000C000 
                        Heap_Size
-                               EQU              0x00010000
-   55 00000800         
-   56 00000800                 AREA             HEAP, NOINIT, READWRITE, ALIGN 
+                               EQU              0x0000C000
+   55 00002000         
+   56 00002000                 AREA             HEAP, NOINIT, READWRITE, ALIGN 
 = 3
    57 00000000         __heap_base
    58 00000000         Heap_Mem
                                SPACE            Heap_Size
-   59 00010000         __heap_limit
-   60 00010000         
-   61 00010000         
-   62 00010000                 PRESERVE8
-   63 00010000                 THUMB
-   64 00010000         
-   65 00010000         ;                   /* reset Vector Mapped to at Address
+   59 0000C000         __heap_limit
+   60 0000C000         
+   61 0000C000         
+   62 0000C000                 PRESERVE8
+   63 0000C000                 THUMB
+   64 0000C000         
+   65 0000C000         ;                   /* reset Vector Mapped to at Address
                         0 */
-   66 00010000                 AREA             RESET, DATA, READONLY
+   66 0000C000                 AREA             RESET, DATA, READONLY
    67 00000000                 EXPORT           __Vectors
    68 00000000                 EXPORT           __Vectors_End
    69 00000000                 EXPORT           __Vectors_Size
@@ -636,7 +636,7 @@ Symbol: Stack_Mem
    Uses
       None
 Comment: Stack_Mem unused
-__initial_sp 00000800
+__initial_sp 00002000
 
 Symbol: __initial_sp
    Definitions
@@ -676,7 +676,7 @@ Symbol: __heap_base
    Uses
       At line 351 in file ..\Startup\startup_gd32f10x_xd.s
 Comment: __heap_base used once
-__heap_limit 00010000
+__heap_limit 0000C000
 
 Symbol: __heap_limit
    Definitions
@@ -1437,7 +1437,7 @@ Symbol: WWDGT_IRQHandler
 ARM Macro Assembler    Page 1 Alphabetic symbol ordering
 Absolute symbols
 
-Heap_Size 00010000
+Heap_Size 0000C000
 
 Symbol: Heap_Size
    Definitions
@@ -1445,7 +1445,7 @@ Symbol: Heap_Size
    Uses
       At line 58 in file ..\Startup\startup_gd32f10x_xd.s
 Comment: Heap_Size used once
-Stack_Size 00000800
+Stack_Size 00002000
 
 Symbol: Stack_Size
    Definitions

BIN
app/Proj/Objects/Ringzle.axf


BIN
app/Proj/Objects/Ringzle.bin


+ 287 - 4
app/Proj/Objects/Ringzle.build_log.htm

@@ -26,7 +26,20 @@ Project File Date:  08/15/2023
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\workSoftware\stm32Software\mdk\mdkcore\ARM\ARMCC\Bin'
-Build target 'GD32F103C8T6'
+Rebuild target 'GD32F103C8T6'
+assembling startup_gd32f10x_xd.s...
+compiling gd32f10x_it.c...
+compiling log.c...
+compiling device_message.c...
+..\App\device_message.c(23): warning:  #223-D: function "memset" declared implicitly
+  		memset(&config_params_union, 0, sizeof(CONFIG_PARAMS_UNION));	
+..\App\device_message.c(24): warning:  #223-D: function "memcpy" declared implicitly
+  		memcpy(&config_params_union.config_params, params, sizeof(CONFIG_PARAMS)); 
+..\App\device_message.c(39): warning:  #223-D: function "memset" declared implicitly
+  		memset(&config_params_union, 0, sizeof(CONFIG_PARAMS_UNION));//清空原先数据
+..\App\device_message.c(42): warning:  #223-D: function "memcpy" declared implicitly
+  		memcpy(&g_config_params, &config_params_union.config_params, sizeof(CONFIG_PARAMS));
+..\App\device_message.c: 4 warnings, 0 errors
 compiling main.c...
 ..\App\otaEvent.h(26): warning:  #1295-D: Deprecated declaration check_ota_event - give arg types
   int8_t check_ota_event();
@@ -55,11 +68,281 @@ compiling main.c...
 ..\App\main.c(244): 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: 13 warnings, 0 errors
+compiling mmodbus.c...
+compiling system_gd32f10x.c...
+compiling systick.c...
+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 mqttRecv.c...
+..\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: 2 warnings, 0 errors
+compiling gd32f10x_adc.c...
+compiling gd32f10x_bkp.c...
+compiling ec800m.c...
+..\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(263): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(command, CMD_SET_URL, strlen(url)); // CMD_SET_URL "%d\r\n"
+..\App\ec800m.c(270): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(276): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(283): warning:  #188-D: enumerated type mixed with another type
+  		return false;
+..\App\ec800m.c(292): warning:  #188-D: enumerated type mixed with another type
+  	return true;
+..\App\ec800m.c(304): warning:  #188-D: enumerated type mixed with another type
+  	bool success = false;
+..\App\ec800m.c(314): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(cmd, "AT+QMTCFG=\"qmtping\",0,%d\r\n", keepalive);
+..\App\ec800m.c(502): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf((char *)payload_out,"{\"deviceId\":\"%s\",\"data\":[",gateway->deviceId);//缁勬垚json澶撮儴
+..\App\ec800m.c(609): warning:  #223-D: function "sprintf" declared implicitly
+  	sprintf(AT_SUB, "AT+QMTSUB=0,1,\"%s\",0\r\n", commandTopic);
+..\App\ec800m.c(610): warning:  #188-D: enumerated type mixed with another type
+  	bool success = false;
+..\App\ec800m.c: 14 warnings, 0 errors
+compiling PC.c...
+..\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(170): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	uint8_t deviceIdLen=strlen(gateway->deviceId);
+..\App\PC.c(171): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	uint8_t versionLen=strlen(gateway->version);
+..\App\PC.c(176): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	uint16_t CRC16=mmodbus_crc16(gatewayMessageData+1,strlen(gatewayMessageData)-1);
+..\App\PC.c(183): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gd_com_232_send(gatewayMessageData,strlen(gatewayMessageData));
+..\App\PC.c(211): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *restrict"
+  		sscanf(UART0_RX_BUF, "AT+COPS?\r\r\n+COPS: 0,0,\"%[^\"]\",%s", Operators, &Networktyp);
+..\App\PC.c(215): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  		strcpy(Operators,"");																											//鏈��鍙栧埌sim鍗′俊鎭?
+..\App\PC.c(223): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	char* status_str=strstr(UART0_RX_BUF, "+CREG:");
+..\App\PC.c(226): warning:  #181-D: argument is incompatible with corresponding format string conversion
+  		sscanf(status_str, "+CREG: %*d,%d", &Networkstatu);																							//鍘熷厛0鏈�敞鍐? 1娉ㄥ唽锛屽彇鍙嶅悗1鏈�敞鍐?0娉ㄥ唽
+..\App\PC.c(231): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	char* ICCID_str=strstr(UART0_RX_BUF,"+QCCID:");
+..\App\PC.c(239): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *restrict"
+  		sscanf(UART0_RX_BUF,"AT+CSQ\r\r\n+CSQ: %d",&rssi);
+..\App\PC.c(239): warning:  #181-D: argument is incompatible with corresponding format string conversion
+  		sscanf(UART0_RX_BUF,"AT+CSQ\r\r\n+CSQ: %d",&rssi);
+..\App\PC.c(253): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *restrict"
+  	sscanf(UART0_RX_BUF,"AT+GSN\r\r\n%s",IMMIE);
+..\App\PC.c(259): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  	sprintf(gatewayConfigData+2,
+..\App\PC.c(264): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	uint16_t CRC16=mmodbus_crc16(gatewayConfigData+1,strlen(gatewayConfigData)-1);
+..\App\PC.c(266): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gatewayConfigData[strlen(gatewayConfigData)+1] = (uint8_t) (CRC16 & 0x00FF);
+..\App\PC.c(267): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gatewayConfigData[strlen(gatewayConfigData)] = (uint8_t) ((CRC16 & 0xFF00)>>8);
+..\App\PC.c(268): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gatewayConfigData[strlen(gatewayConfigData)]=END;
+..\App\PC.c(269): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gd_com_232_send(gatewayConfigData,strlen(gatewayConfigData));
+..\App\PC.c(289): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  	sprintf(json_config+2,"{\"host\":\"%s\",\"port\":%d,\"messageTopic\":\"%s\",\"commandTopic\":\"%s\",\"baudrate\":%d,\"dataBit\":%d,\"stopBit\":%d,\"checkBit\":%d,\"flowControl\":%d,\"deviceId\":\"%s\",\"dataSource\":%d,\"version645\":%d,\"inboundTime\":%d,\"pollTime\":%d,",
+..\App\PC.c(306): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	sprintf(json_config+strlen(json_config),"\"sensorData\":[");
+..\App\PC.c(306): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  	sprintf(json_config+strlen(json_config),"\"sensorData\":[");
+..\App\PC.c(312): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  			sprintf(json_config+strlen(json_config),"{\"rFunctionCode\":%d,\"registerAddress\":%d,\"slaveAddress\":%d,\"registerByteNum\":%d,\"identifier\":\"%s\",\"deviceId\":\"%s\",\"precise\":%d,\"bigLittleFormat\":%d},",
+..\App\PC.c(312): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  			sprintf(json_config+strlen(json_config),"{\"rFunctionCode\":%d,\"registerAddress\":%d,\"slaveAddress\":%d,\"registerByteNum\":%d,\"identifier\":\"%s\",\"deviceId\":\"%s\",\"precise\":%d,\"bigLittleFormat\":%d},",
+..\App\PC.c(324): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  			sprintf(json_config+strlen(json_config),
+..\App\PC.c(324): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  			sprintf(json_config+strlen(json_config),
+..\App\PC.c(338): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	memset(json_config+strlen(json_config)-1,0,1);
+..\App\PC.c(340): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	sprintf(json_config+strlen(json_config),"],\"commandData\":[");
+..\App\PC.c(340): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  	sprintf(json_config+strlen(json_config),"],\"commandData\":[");
+..\App\PC.c(344): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  		sprintf(json_config+strlen(json_config),"{\"deviceId\":\"%s\",\"identifier\":\"%s\",\"registerAddress\":%d,\"slaveAddress\":%d,\"wFunctionCode\":%d,\"registerByteNum\":%d,\"bigLittleFormat\":%d},",
+..\App\PC.c(344): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  		sprintf(json_config+strlen(json_config),"{\"deviceId\":\"%s\",\"identifier\":\"%s\",\"registerAddress\":%d,\"slaveAddress\":%d,\"wFunctionCode\":%d,\"registerByteNum\":%d,\"bigLittleFormat\":%d},",
+..\App\PC.c(354): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	memset(json_config+strlen(json_config)-1,0,1);
+..\App\PC.c(356): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	sprintf(json_config+strlen(json_config),"]}");
+..\App\PC.c(356): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+  	sprintf(json_config+strlen(json_config),"]}");
+..\App\PC.c(358): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	uint16_t CRC16=mmodbus_crc16(json_config+1,strlen(json_config)-1);
+..\App\PC.c(359): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	json_config[strlen(json_config)+1] = (uint8_t) (CRC16 & 0x00FF);
+..\App\PC.c(360): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	json_config[strlen(json_config)] = (uint8_t) ((CRC16 & 0xFF00)>>8);
+..\App\PC.c(362): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	json_config[strlen(json_config)]=END;
+..\App\PC.c(363): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+  	gd_com_232_send(json_config,strlen(json_config));
+..\App\PC.c(382): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const char *"
+  	uint16_t CRC16=mmodbus_crc16(resp+1,strlen(resp)-1);
+..\App\PC.c(382): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const uint8_t *"
+  	uint16_t CRC16=mmodbus_crc16(resp+1,strlen(resp)-1);
+..\App\PC.c(383): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const char *"
+  	resp[strlen(resp)+1] = (uint8_t) (CRC16 & 0x00FF);
+..\App\PC.c(384): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const char *"
+  	resp[strlen(resp)] = (uint8_t) ((CRC16 & 0xFF00)>>8);
+..\App\PC.c(385): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const char *"
+  	resp[strlen(resp)]=END;
+..\App\PC.c(386): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "const char *"
+  	gd_com_232_send(resp,strlen(resp));
+..\App\PC.c(386): warning:  #167-D: argument of type "int8_t *" is incompatible with parameter of type "uint8_t *"
+  	gd_com_232_send(resp,strlen(resp));
+..\App\PC.c(425): warning:  #223-D: function "delay_1ms" declared implicitly
+  		delay_1ms(50);
+..\App\PC.c: 48 warnings, 0 errors
+compiling parseDeviceMessage.c...
+..\App\parseDeviceMessage.c(74): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "const uint8_t *"
+  				processHttp(dmaBuffer);
+..\App\parseDeviceMessage.c(77): warning:  #940-D: missing return statement at end of non-void function "WaitForUpData" 
+  }
+..\App\parseDeviceMessage.c(122): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+    strcpy(gateway.host, processStringData(json, "host"));
+..\App\parseDeviceMessage.c(125): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+    strcpy(gateway.messageTopic, processStringData(json, "messageTopic"));
+..\App\parseDeviceMessage.c(126): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+    strcpy(gateway.commandTopic, processStringData(json, "commandTopic"));
+..\App\parseDeviceMessage.c(147): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+            strcpy(gateway.device_read_data[i].deviceId, processStringData(read_data_obj, "deviceId"));
+..\App\parseDeviceMessage.c(148): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+            strcpy(gateway.device_read_data[i].keyword, processStringData(read_data_obj, "identifier"));
+..\App\parseDeviceMessage.c(159): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+            strcpy(gateway.device_read_data[i].deviceId, processStringData(read_data_obj, "deviceId"));
+..\App\parseDeviceMessage.c(160): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+            strcpy(gateway.device_read_data[i].keyword, processStringData(read_data_obj, "identifier"));
+..\App\parseDeviceMessage.c(183): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+          strcpy(gateway.device_write_data[i].deviceId, processStringData(write_data_obj, "deviceId"));
+..\App\parseDeviceMessage.c(184): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+            strcpy(gateway.device_write_data[i].keyword, processStringData(write_data_obj, "identifier"));
+..\App\parseDeviceMessage.c(212): warning:  #1295-D: Deprecated declaration parseCommandData - give arg types
+  void parseCommandData();
+..\App\parseDeviceMessage.c(363): warning:  #188-D: enumerated type mixed with another type
+  		mmodbus_set16bitOrder(gateway->device_read_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c(417): warning:  #188-D: enumerated type mixed with another type
+  			mmodbus_set16bitOrder(gateway->device_read_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c(424): warning:  #177-D: variable "value"  was declared but never referenced
+          uint32_t value = (uint32_t)data[0] << 8 | data[1];
+..\App\parseDeviceMessage.c(454): warning:  #167-D: argument of type "char *" is incompatible with parameter of type "uint8_t *"
+      while (MQTT_BUFFER_READ(json))
+..\App\parseDeviceMessage.c(462): 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(473): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+          strcpy(identifier, processStringData(mqtt_sub_json, "identifier"));
+..\App\parseDeviceMessage.c(475): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+          strcpy(deviceId, processStringData(mqtt_sub_json, "deviceId"));
+..\App\parseDeviceMessage.c(478): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "char *restrict"
+          strcpy(messageId, processStringData(mqtt_sub_json, "messageId"));
+..\App\parseDeviceMessage.c(486): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+              if (strcmp(gateway->device_write_data[i].deviceId, deviceId) == 0)
+..\App\parseDeviceMessage.c(486): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+              if (strcmp(gateway->device_write_data[i].deviceId, deviceId) == 0)
+..\App\parseDeviceMessage.c(488): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+                if (strcmp(gateway->device_write_data[i].keyword, identifier) == 0) // 瀵绘壘鍒板�搴斿瓨鍌ㄧ殑鍦板潃
+..\App\parseDeviceMessage.c(488): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+                if (strcmp(gateway->device_write_data[i].keyword, identifier) == 0) // 瀵绘壘鍒板�搴斿瓨鍌ㄧ殑鍦板潃
+..\App\parseDeviceMessage.c(494): warning:  #188-D: enumerated type mixed with another type
+                      mmodbus_set16bitOrder(gateway->device_write_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c(516): warning:  #188-D: enumerated type mixed with another type
+                      mmodbus_set16bitOrder(gateway->device_write_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c(556): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+              if (strcmp(gateway->device_read_data[i].deviceId, deviceId) == 0)
+..\App\parseDeviceMessage.c(556): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+              if (strcmp(gateway->device_read_data[i].deviceId, deviceId) == 0)
+..\App\parseDeviceMessage.c(558): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+                if (strcmp(gateway->device_read_data[i].keyword, identifier) == 0) // 瀵绘壘鍒板�搴斿瓨鍌ㄧ殑鍦板潃
+..\App\parseDeviceMessage.c(558): warning:  #167-D: argument of type "uint8_t *" is incompatible with parameter of type "const char *"
+                if (strcmp(gateway->device_read_data[i].keyword, identifier) == 0) // 瀵绘壘鍒板�搴斿瓨鍌ㄧ殑鍦板潃
+..\App\parseDeviceMessage.c(565): warning:  #188-D: enumerated type mixed with another type
+                      mmodbus_set16bitOrder(gateway->device_read_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c(570): warning:  #177-D: variable "value1"  was declared but never referenced
+                      uint8_t value1;
+..\App\parseDeviceMessage.c(600): warning:  #188-D: enumerated type mixed with another type
+                      mmodbus_set16bitOrder(gateway->device_read_data[i].bigLittleFormat);
+..\App\parseDeviceMessage.c: 33 warnings, 0 errors
+compiling gd32f10x_can.c...
+compiling gd32f10x_crc.c...
+compiling gd32f10x_dac.c...
+compiling gd32f10x_enet.c...
+compiling gd32f10x_dbg.c...
+compiling gd32f10x_dma.c...
+compiling gd32f10x_fwdgt.c...
+compiling gd32f10x_exmc.c...
+compiling gd32f10x_exti.c...
+compiling gd32f10x_gpio.c...
+compiling gd32f10x_fmc.c...
+compiling gd32f10x_i2c.c...
+compiling gd32f10x_misc.c...
+compiling gd32f10x_rtc.c...
+compiling gd32f10x_pmu.c...
+compiling gd32f10x_sdio.c...
+compiling gd32f10x_rcu.c...
+compiling spi.c...
+compiling gd32f10x_wwdgt.c...
+compiling usart.c...
+..\bsp\usart.c(27): warning:  #223-D: function "memset" declared implicitly
+     memset(UART0_RX_BUF,0,UART0_RX_LEN);
+..\bsp\usart.c(158): warning:  #550-D: variable "value"  was set but never used
+  	uint8_t value;
+..\bsp\usart.c(13): warning:  #177-D: variable "COM_IT_HANDLER"  was declared but never referenced
+  static uint32_t COM_IT_HANDLER[COMn] = {COM_EC800_IT_HANDLER, COM_485_IT_HANDLER, COM_232_IT_HANDLER};
+..\bsp\usart.c: 3 warnings, 0 errors
+compiling dlt645.c...
+compiling key.c...
+compiling led.c...
+compiling gd32f10x_spi.c...
+compiling gd32f10x_usart.c...
+compiling ring_buffer.c...
+compiling w25q32.c...
+compiling gd32f10x_timer.c...
+compiling dlt645_2007.c...
+compiling dlt645_data.c...
+compiling dlt645_1997.c...
+compiling cJSON.c...
+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=36596 RO-data=2648 RW-data=224 ZI-data=97232  
+Program Size: Code=36448 RO-data=2652 RW-data=224 ZI-data=86992  
 FromELF: creating hex file...
 After Build - User command #1: fromelf --bin --output ./Objects/Ringzle.bin ./Objects/Ringzle.axf
-".\Objects\Ringzle.axf" - 0 Error(s), 13 Warning(s).
+".\Objects\Ringzle.axf" - 0 Error(s), 127 Warning(s).
 
 <h2>Software Packages used:</h2>
 
@@ -73,7 +356,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:02
 </pre>
 </body>
 </html>

Файловите разлики са ограничени, защото са твърде много
+ 291 - 313
app/Proj/Objects/Ringzle.htm


Файловите разлики са ограничени, защото са твърде много
+ 16 - 16
app/Proj/Objects/Ringzle_GD32F103C8T6.dep


BIN
app/Proj/Objects/device_message.crf


BIN
app/Proj/Objects/ec800m.crf


BIN
app/Proj/Objects/key.crf


BIN
app/Proj/Objects/main.crf


BIN
app/Proj/Objects/mqttrecv.crf


BIN
app/Proj/Objects/parsedevicemessage.crf


BIN
app/Proj/Objects/pc.crf


BIN
app/Proj/Objects/ring_buffer.crf


Файловите разлики са ограничени, защото са твърде много
+ 204 - 231
app/Proj/Ringzle.uvguix.16936


+ 9 - 9
app/Proj/Ringzle.uvoptx

@@ -159,7 +159,7 @@
           <Type>0</Type>
           <LineNumber>182</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>134270926</Address>
+          <Address>134270766</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
@@ -175,7 +175,7 @@
           <Type>0</Type>
           <LineNumber>183</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>134270936</Address>
+          <Address>134270776</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
@@ -189,25 +189,25 @@
         <Bp>
           <Number>2</Number>
           <Type>0</Type>
-          <LineNumber>500</LineNumber>
+          <LineNumber>27</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>134245252</Address>
+          <Address>134246942</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
           <SizeOfObject>0</SizeOfObject>
           <BreakByAccess>0</BreakByAccess>
           <BreakIfRCount>1</BreakIfRCount>
-          <Filename>..\App\ec800m.c</Filename>
+          <Filename>..\App\mqttRecv.c</Filename>
           <ExecCommand></ExecCommand>
-          <Expression>\\Ringzle\../App/ec800m.c\500</Expression>
+          <Expression>\\Ringzle\../App/mqttRecv.c\27</Expression>
         </Bp>
       </Breakpoint>
       <MemoryWindow1>
         <Mm>
           <WinNumber>1</WinNumber>
           <SubType>8</SubType>
-          <ItemText>payload_out</ItemText>
+          <ItemText>&amp;mqttRecv</ItemText>
           <AccSizeX>0</AccSizeX>
         </Mm>
       </MemoryWindow1>
@@ -722,7 +722,7 @@
 
   <Group>
     <GroupName>bsp</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -766,7 +766,7 @@
       <GroupNumber>5</GroupNumber>
       <FileNumber>40</FileNumber>
       <FileType>1</FileType>
-      <tvExp>0</tvExp>
+      <tvExp>1</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
       <PathWithFileName>..\bsp\ring_buffer.c</PathWithFileName>

+ 2 - 2
app/Startup/startup_gd32f10x_xd.s

@@ -40,7 +40,7 @@
 ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
 ; </h>
 
-Stack_Size          EQU     0x0000800
+Stack_Size          EQU     0x0002000
 
                     AREA    STACK, NOINIT, READWRITE, ALIGN = 3
 Stack_Mem           SPACE   Stack_Size
@@ -51,7 +51,7 @@ __initial_sp
 ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
 ; </h>
 
-Heap_Size           EQU     0x00010000
+Heap_Size           EQU     0x0000C000
 
                     AREA    HEAP, NOINIT, READWRITE, ALIGN = 3
 __heap_base

+ 21 - 21
app/bsp/ring_buffer.h

@@ -4,40 +4,40 @@
 
 #include "gd32f10x.h"
 
-#define BUFFER_SIZE 4*1024        /* 鐜�舰缂撳啿鍖虹殑澶у皬 */
+#define BUFFER_SIZE (4*1024)       /* 环形缓冲区的大小 */
 typedef struct
 {
-    volatile unsigned int pW;           /* 鍐欏湴鍧€ */
-    volatile unsigned int pR;           /* 璇诲湴鍧€ */
-    unsigned char buffer[BUFFER_SIZE];  /* 缓冲区空间 */
+    volatile unsigned int pW;           /* 写地址 */
+    volatile unsigned int pR;           /* 读地址 */
+    unsigned char buffer[BUFFER_SIZE];  /* 缓冲区空间 */
 } ring_buffer;
 
 /*
- *  鍑芥暟鍚嶏細void ring_buffer_init(ring_buffer *dst_buf)
- *  输入参数:dst_buf --> 指向目标缓冲区
- *  杈撳嚭鍙傛暟锛氭棤
- *  返回值:无
- *  函数作用:初始化缓冲区
+ *  函数名:void ring_buffer_init(ring_buffer *dst_buf)
+ *  输入参数:dst_buf --> 指向目标缓冲区
+ *  输出参数:无
+ *  返回值:无
+ *  函数作用:初始化缓冲区
 */
 extern void ring_buffer_init(ring_buffer *dst_buf);
 
 /*
- *  鍑芥暟鍚嶏細void ring_buffer_write(unsigned char c, ring_buffer *dst_buf)
- *  杈撳叆鍙傛暟锛歝 --> 瑕佸啓鍏ョ殑鏁版嵁
- *            dst_buf --> 指向目标缓冲区
- *  杈撳嚭鍙傛暟锛氭棤
- *  返回值:无
- *  鍑芥暟浣滅敤锛氬悜鐩�爣缂撳啿鍖哄啓鍏ヤ竴涓�瓧鑺傜殑鏁版嵁锛屽�鏋滅紦鍐插尯婊′簡灏变涪鎺夋�鏁版嵁
+ *  函数名:void ring_buffer_write(unsigned char c, ring_buffer *dst_buf)
+ *  输入参数:c --> 要写入的数据
+ *            dst_buf --> 指向目标缓冲区
+ *  输出参数:无
+ *  返回值:无
+ *  函数作用:向目标缓冲区写入一个字节的数据,如果缓冲区满了就丢掉此数据
 */
 extern void ring_buffer_write(unsigned char c, ring_buffer *dst_buf);
 
 /*
- *  鍑芥暟鍚嶏細int ring_buffer_read(unsigned char *c, ring_buffer *dst_buf)
- *  杈撳叆鍙傛暟锛歝 --> 鎸囧悜灏嗚�鍒扮殑鏁版嵁淇濆瓨鍒板唴瀛樹腑鐨勫湴鍧€
- *            dst_buf --> 指向目标缓冲区
- *  杈撳嚭鍙傛暟锛氭棤
- *  返回值:读到数据返回0,否则返回-1
- *  鍑芥暟浣滅敤锛氫粠鐩�爣缂撳啿鍖鸿�鍙栦竴涓�瓧鑺傜殑鏁版嵁锛屽�鏋滅紦鍐插尯绌轰簡杩斿洖-1琛ㄦ槑璇诲彇澶辫触
+ *  函数名:int ring_buffer_read(unsigned char *c, ring_buffer *dst_buf)
+ *  输入参数:c --> 指向将读到的数据保存到内存中的地址
+ *            dst_buf --> 指向目标缓冲区
+ *  输出参数:无
+ *  返回值:读到数据返回0,否则返回-1
+ *  函数作用:从目标缓冲区读取一个字节的数据,如果缓冲区空了返回-1表明读取失败
 */
 extern int ring_buffer_read(unsigned char *c, ring_buffer *dst_buf);