Sfoglia il codice sorgente

Настройки. В процессе.

TelenkovDmitry 1 anno fa
parent
commit
b2528377b9
35 ha cambiato i file con 3958 aggiunte e 5521 eliminazioni
  1. BIN
      doc/~$_модули_входов_выходов_редакция_4.doc
  2. 2 0
      fw/modules/io/io.h
  3. 3 5
      fw/modules/misc/uptime.c
  4. 1 1
      fw/modules/modbus/modbus_params.h
  5. 270 221
      fw/modules/settings/settings_api.c
  6. 62 252
      fw/modules/settings/settings_api.h
  7. 24 5
      fw/user/main.c
  8. BIN
      project/ewarm/Debug/Exe/module_universal_io.out
  9. BIN
      project/ewarm/Debug/Exe/module_universal_io.sim
  10. 808 719
      project/ewarm/Debug/List/module_universal_io.map
  11. 151 306
      project/ewarm/Debug/Obj/.ninja_log
  12. BIN
      project/ewarm/Debug/Obj/input.o
  13. BIN
      project/ewarm/Debug/Obj/input.pbi
  14. BIN
      project/ewarm/Debug/Obj/io.o
  15. BIN
      project/ewarm/Debug/Obj/io.pbi
  16. BIN
      project/ewarm/Debug/Obj/main.o
  17. BIN
      project/ewarm/Debug/Obj/main.pbi
  18. BIN
      project/ewarm/Debug/Obj/modbus.o
  19. BIN
      project/ewarm/Debug/Obj/modbus.pbi
  20. BIN
      project/ewarm/Debug/Obj/modbus_params.o
  21. BIN
      project/ewarm/Debug/Obj/modbus_params.pbi
  22. BIN
      project/ewarm/Debug/Obj/module_universal_io.pbd
  23. BIN
      project/ewarm/Debug/Obj/module_universal_io.pbd.browse
  24. 1238 2540
      project/ewarm/Debug/Obj/module_universal_io.pbw
  25. BIN
      project/ewarm/Debug/Obj/module_universal_io_part0.pbi
  26. BIN
      project/ewarm/Debug/Obj/module_universal_io_part1.pbi
  27. BIN
      project/ewarm/Debug/Obj/module_universal_io_part10.pbi
  28. 433 433
      project/ewarm/iap/iap.dep
  29. 877 877
      project/ewarm/module_universal_io.dep
  30. 0 0
      project/ewarm/settings/module_universal_io.dbgdt
  31. 22 12
      project/ewarm/settings/module_universal_io.dnx
  32. 3 2
      project/ewarm/settings/module_universal_io.wsdt
  33. 42 105
      shared/sys/sys_api.c
  34. 19 35
      shared/sys/sys_api.h
  35. 3 8
      shared/sys/sys_hal.c

BIN
doc/~$_модули_входов_выходов_редакция_4.doc


+ 2 - 0
fw/modules/io/io.h

@@ -105,6 +105,7 @@ typedef struct
 
 
 // Структура системных настроек
+/*
 typedef struct 
 {
 	uint16_t        model;			// Модель
@@ -115,6 +116,7 @@ typedef struct
 	
 } sys_settings_t;
 
+*/
 
 
 

+ 3 - 5
fw/modules/misc/uptime.c

@@ -37,11 +37,9 @@ void uptime_init(void)
     tmr_interrupt_enable(TMR6, TMR_OVF_INT, TRUE);
 }
 
-/**
-  * @brief
-  * @retval 
-  */
+
 //
+#if 0
 void TMR6_GLOBAL_IRQHandler(void)
 {
     if(tmr_flag_get(TMR6, TMR_OVF_FLAG) != RESET)
@@ -56,7 +54,7 @@ void TMR6_GLOBAL_IRQHandler(void)
         wdt_task_process();
     }
 }
-
+#endif
 
 //
 uint8_t wdt_add_task(uint32_t max)

+ 1 - 1
fw/modules/modbus/modbus_params.h

@@ -9,7 +9,7 @@
 #include <stdbool.h>
 
 
-#define MB_PARAM_MAX			8
+#define MB_PARAM_MAX			16
 
 
 //

+ 270 - 221
fw/modules/settings/settings_api.c

@@ -1,5 +1,6 @@
 #include "at32f403a_407.h" 
 #include "settings_api.h"
+#include "sys_api.h"
 #include "FreeRTOS.h"
 #include "task.h"
 #include "queue.h"
@@ -8,17 +9,10 @@
 #include "common.h"
 #include "at32_uid.h"
 #include "hash.h"
-//#include "log.h"
-
 #include <math.h> 
 #include <string.h>
 #include <stdlib.h>
-#ifdef PRINTF_STDLIB
 #include <stdio.h>
-#endif
-#ifdef PRINTF_CUSTOM
-#include "tinystdio.h"
-#endif
 
 
 SemaphoreHandle_t flash_mutex;
@@ -28,12 +22,244 @@ SemaphoreHandle_t flash_mutex;
 bool fConfirmWebParams = false;
    
 // Системные настройки
-SYS_t sSys;
+sys_settings_t sys_settings;
 
 // Общая структура настроек
-SETTINGS_t sSettings;
+settings_t settings;
+
+
+//
+void init_settings(void)
+{
+    flash_mutex = xSemaphoreCreateMutex();
+}
+
+// Загрузка структуры настроек из flesh
+void settings_load(settings_t *settings)
+{
+    uint32_t loadCRC;  // CRC из flash
+    uint32_t newCRC;   // CRC загруженной структуры настроек
+    bool need_default = false;
+    
+    settings_read_from_flash((uint8_t*)settings, sizeof(settings_t));
+    
+    // Считываем CRC из флеш памяти
+    loadCRC = (*(uint32_t*)CRC_ADDRESS);
+    
+    // Рассчитываем CRC для структуры настроек
+    newCRC = settings_get_crc(settings);
+
+    // Если CRC не совпадают нужно прошивать дефолтные настройки
+    if (loadCRC != newCRC) {
+        need_default = true;
+    }
+    // CRC совпала, проверяем контрольное слово если слово не совпадает
+    // то это значит, что поплыла структура нстроек, прошиваем дефолт
+    else if (settings->control_word != SETTINGS_CONTROL_WORD)  
+    {
+        need_default = true;
+    }
+    // CRC и контрольное слово совпали, проверяем номер версии настроек.
+    // Если версия в настройках и прошивке не совпадают
+    // (при обновлении изменили структуру настроек), прошиваем дефолт 
+    else if (settings->settings_version != SETTINGS_VERSION)
+    {
+        need_default = true;
+    }
+    
+    // Прошиваем дефолтные настройки если нужно
+    if (need_default) 
+    {
+        settings_set_all_default();
+        settings_save(settings);
+    }
+#if 1    
+    //SETTINGS_Print();
+#endif    
+}
+
+//
+void settings_read_from_flash(uint8_t *data, uint32_t size)
+{
+    uint32_t baseAddress = SETTINGS_SECTOR;
+        
+    for (uint32_t i = 0; i < size; i++)
+        *data++ = (*(uint32_t*)baseAddress++);;
+}
+
+//
+uint32_t settings_get_crc(settings_t *settings)
+{
+    crc_data_reset();
+    return crc_block_calculate((uint32_t*)settings, sizeof(settings_t)/4 - 1);
+}
+
+//
+uint32_t settings_get_crit_sec_crc(settings_t *settings)
+{
+    crc_data_reset();
+    uint32_t critsec_len = (uint32_t)((uint8_t *)(&settings->critical_section_crc) - (uint8_t *)settings) / 4;
+    return crc_block_calculate((uint32_t *)settings, critsec_len);
+}
+
+// Сброс всех настроек в значения по умолчанию
+void settings_set_all_default(void)
+{
+    settings_set_modbus_def(&settings.com_settings.mb_port);
+      
+      
+#if 0  
+    SETTINGS_SetWebParamsDef();
+    SETTINGS_SetTempWebParamsDef();
+    SETTINGS_SetInfoDef();
+    SETTINGS_SetGSMDef();
+    SETTINGS_SetFlagsDef();
+    
+    SETTINGS_SetEthternetSwitchDef();
+    SETTINGS_SetSntpDef();
+    SETTINGS_SetServerParamsDef();
+    SETTINGS_SetProxyParamsDef();
+    SETTINGS_SetPortGwDef();
+    SETTINGS_SetPSDDef();
+    SETTINGS_SetServiceDef();
+    
+    sSettings.settVer = SETTINGS_VERSION;
+    
+    sSettings.CritSecCRC = settings_get_crit_sec_crc();
+    
+    sSettings.controlWorld = SETTINGS_CONTROL_WORD;
+#endif    
+}
+
+// -------------------------------------------------------------------------- //
+// Настройки по умолчанию
+
+//
+void settings_set_modbus_def(uint16_t *mb_port)
+{
+    modbus_t mb_settings;
+    
+    mb_settings.baud = BRD_115200;
+	mb_settings.parity = NO_PAR;
+	mb_settings.databits = DATABITS_8;
+	mb_settings.stopbits = STOP_1;
+    
+    settings_conv_modbus_def(&mb_settings, mb_port);
+}
+
+//
+void settings_conv_modbus_def(modbus_t *mb_settings, uint16_t *mb_port)
+{
+	uint16_t param = 0;
+
+	// Количестро стоп бит (0-1 биты)
+	if (mb_settings->stopbits == STOP_1)
+		param = 0x00;
+	else if (mb_settings->stopbits == STOP_2)
+		param = 0x02; 		
+
+	// Длина слова (2ой бит)
+	param |= 0x00 << 2;
+
+	// Контроль четности (3-4 биты)
+	if (mb_settings->parity == NO_PAR)
+		param |= 0x00 << 3;
+	else if (mb_settings->parity == EVEN_PAR)
+		param |= 0x02 << 3;
+	else if (mb_settings->parity == ODD_PAR)
+		param |= 0x03 << 3;
+
+	// Скорость (5 - 7 биты)
+	switch (mb_settings->baud)
+	{
+		case BRD_2400 :
+			param |= 0x00 << 5;
+		break;
+
+		case BRD_4800 :
+			param |= 0x01 << 5;
+		break;
+
+		case BRD_9600 :
+			param |= 0x02 << 5;
+		break;
+
+		case BRD_19200 :
+			param |= 0x03 << 5;
+		break;
+
+		case BRD_38400 :
+			param |= 0x04 << 5;
+		break;
+
+		case BRD_57600 :
+			param |= 0x05 << 5;
+		break;
+
+		case BRD_115200 :
+			param |= 0x06 << 5;
+		break;
+
+		default : break;
+	}
+
+	*mb_port = param;
+}
+
+// -------------------------------------------------------------------------- //
+
+// Запись структуры настроек во flash
+void settings_save(settings_t *settings)
+{
+    xSemaphoreTake(flash_mutex, portMAX_DELAY);
+    
+    settings->critical_section_crc = settings_get_crit_sec_crc(settings);
+    
+    settings_write_to_flash((uint8_t*)settings, sizeof(settings_t));
+    xSemaphoreGive(flash_mutex);
+}
+
+//
+void settings_write_to_flash(uint8_t *data, uint32_t size)
+{
+    uint32_t baseAddress = SETTINGS_SECTOR;
+    uint32_t checkCrc = 0;
+    uint32_t crc = settings_get_crc(&settings);
+    flash_status_type status;
+    
+    for (uint8_t i = 0; i < 3; i++)
+    {	
+#if 0      
+        flash_unlock();
+    
+        SETTINGS_EraseFlashSector();
+    
+        for (uint32_t i = 0; i < size; i++)
+            if ((status = flash_byte_program(baseAddress++, *data++)) != FLASH_OPERATE_DONE) {
+                SDBG printf("FLASH_ProgramByte error: status = %d\r\n", status);
+                break;
+            }
+    
+        if ((status = flash_word_program((uint32_t)CRC_ADDRESS, crc)) != FLASH_OPERATE_DONE) {
+            SDBG printf("FLASH_ProgramWord error: status = %d\r\n", status);
+        }
+    
+        flash_lock();
+    
+        /* Считываем что записали */
+        SETTINGS_ReadFromFlash((uint8_t*)&sSettings, sizeof(sSettings));
+    
+        checkCrc = SETTINGS_GetCRC();
+    
+        /* Проверяем  CRC того что было записано */
+        if (checkCrc == crc)
+            break;
+#endif        
+    }
+}
 
 
+#if 0
 
 // Установить параметры сетевого подключения по умолчанию
 void SETTINGS_SetWebParamsDef(void)
@@ -62,8 +288,9 @@ void SETTINGS_SetTempWebParamsDef(void)
 // Установить Информацию об устройстве по умолчанию
 void SETTINGS_SetInfoDef(void)
 {
-    SYS_t *sSys = NULL;
-    
+#if 0  
+    sys_settings_t *sSys = NULL;
+        
     sSys = pvPortMalloc(sizeof(*sSys));
     
     if (sSys) 
@@ -88,6 +315,7 @@ void SETTINGS_SetInfoDef(void)
     strcpy(sSettings.sInfo.owner, "");
     strcpy(sSettings.sInfo.comments, "");
     strcpy(sSettings.sInfo.incharge, "");
+#endif    
 }  
 
 /**
@@ -248,157 +476,22 @@ void SETTINGS_SetPartDefault(void)
     
     sSettings.settVer = SETTINGS_VERSION;
     
-    sSettings.CritSecCRC = SETTINGS_GetCritSecCRC();
-    
-    sSettings.controlWorld = SETTINGS_CONTROL_WORD;
-}
-
-/**
-  * @brief  Сброс всех настроек в значения по умолчанию
-  */
-void SETTINGS_SetAllDefault(void)
-{
-    SETTINGS_SetWebParamsDef();
-    SETTINGS_SetTempWebParamsDef();
-    SETTINGS_SetInfoDef();
-    SETTINGS_SetGSMDef();
-    SETTINGS_SetFlagsDef();
-    
-    SETTINGS_SetEthternetSwitchDef();
-    SETTINGS_SetSntpDef();
-    SETTINGS_SetServerParamsDef();
-    SETTINGS_SetProxyParamsDef();
-    SETTINGS_SetPortGwDef();
-    SETTINGS_SetPSDDef();
-    SETTINGS_SetServiceDef();
-    
-    sSettings.settVer = SETTINGS_VERSION;
-    
-    sSettings.CritSecCRC = SETTINGS_GetCritSecCRC();
+    sSettings.CritSecCRC = settings_get_crit_sec_crc();
     
     sSettings.controlWorld = SETTINGS_CONTROL_WORD;
 }
   
-/**
-  * @brief  Запись структуры настроек во flesh
-  */
-void SETTINGS_Save(void)
-{
-    xSemaphoreTake(flash_mutex, portMAX_DELAY);
-    // Calc critical section CRC and store to the settings structure
-    sSettings.CritSecCRC = SETTINGS_GetCritSecCRC();
-    
-    SETTINGS_WriteToFlash((uint8_t*)&sSettings, sizeof(sSettings));
-    xSemaphoreGive(flash_mutex);
-}
 
-/**
-  * @brief  Загрузка структуры настроек из flesh
-  */
-void SETTINGS_Load(void)
-{
-    uint32_t loadCRC;  // CRC из flash
-    uint32_t newCRC;   // CRC загруженной структуры настроек
-    bool need_default = false;
-    
-    WEB_PARAMS_t sWebParamsBackup;
-    
-    SETTINGS_ReadFromFlash((uint8_t*)&sSettings, sizeof(sSettings));
-    
-    // Считываем CRC из флеш памяти
-    loadCRC = (*(uint32_t*)CRC_ADDRESS);
-    
-    // Рассчитываем CRC для структуры настроек
-    newCRC = SETTINGS_GetCRC();
-    
-    // Если CRC не совпадают нужно прошивать дефолтные настройки
-    if (loadCRC != newCRC) {
-        need_default = true;
-    }
-    // CRC совпала, проверяем контрольное слово если слово не совпадает
-    // то это значит, что поплыла структура нстроек, прошиваем дефолт
-    else if (sSettings.controlWorld != SETTINGS_CONTROL_WORD)
-    {
-        need_default = true;
-    }
-    // CRC и контрольное слово совпали, проверяем номер версии настроек.
-    // Если версия в настройках и прошивке не совпадают
-    // (при обновлении изменили структуру настроек), прошиваем дефолт 
-    else if (sSettings.settVer != SETTINGS_VERSION)
-    {
-        need_default = true;
-    }
-    
-    // Прошиваем дефолтные настройки если нужно
-    if (need_default) 
-    {
-        // Бэкапим сетевые параметры загрузчика
-        memcpy(&sWebParamsBackup, &sSettings.sWebParams, sizeof(sWebParamsBackup));
-    
-        loadCRC = sSettings.CritSecCRC;
-        newCRC = SETTINGS_GetCritSecCRC();
-        SETTINGS_SetAllDefault();
-        if (loadCRC == newCRC) {
-            // Применяем сетевые параметры загрузчика
-            memcpy(&sSettings.sWebParams, &sWebParamsBackup, sizeof(sSettings.sWebParams));
-        }
-    
-        SETTINGS_Save();
-    }
-    
-    SDBG SETTINGS_Print();
-}
+#endif
 
-/**
-  * @brief  
-  */
-void SETTINGS_WriteToFlash(uint8_t *data, uint32_t size)
-{
-    uint32_t baseAddress = SETTINGS_SECTOR;
-    uint32_t checkCrc = 0;
-    uint32_t crc = SETTINGS_GetCRC();
-    flash_status_type status;
-    
-    for (uint8_t i = 0; i < 3; i++)
-    {	
-        flash_unlock();
-    
-        SETTINGS_EraseFlashSector();
-    
-        for (uint32_t i = 0; i < size; i++)
-            if ((status = flash_byte_program(baseAddress++, *data++)) != FLASH_OPERATE_DONE) {
-                SDBG printf("FLASH_ProgramByte error: status = %d\r\n", status);
-                break;
-            }
-    
-        if ((status = flash_word_program((uint32_t)CRC_ADDRESS, crc)) != FLASH_OPERATE_DONE) {
-            SDBG printf("FLASH_ProgramWord error: status = %d\r\n", status);
-        }
-    
-        flash_lock();
-    
-        /* Считываем что записали */
-        SETTINGS_ReadFromFlash((uint8_t*)&sSettings, sizeof(sSettings));
-    
-        checkCrc = SETTINGS_GetCRC();
-    
-        /* Проверяем  CRC того что было записано */
-        if (checkCrc == crc)
-            break;
-    }
 
-}
 
+#if 0
 /**
   * @brief  
   */
-void SETTINGS_ReadFromFlash(uint8_t *data, uint32_t size)
-{
-    uint32_t baseAddress = SETTINGS_SECTOR;
-        
-    for (uint32_t i = 0; i < size; i++)
-        *data++ = (*(uint32_t*)baseAddress++);;
-}
+
+
 
 /**
   * @brief  Очистка сектора настроек
@@ -413,26 +506,6 @@ void SETTINGS_EraseFlashSector(void)
     }
 }
 
-/**
-  * @brief  
-  * @retval 
-  */
-uint32_t SETTINGS_GetCRC(void)
-{
-    crc_data_reset();
-    return crc_block_calculate((uint32_t*)&sSettings, sizeof(sSettings)/4 - 1);
-}
-
-/**
-  * @brief
-  * @retval
-  */
-uint32_t SETTINGS_GetCritSecCRC(void)
-{
-    crc_data_reset();
-    uint32_t critsec_len = (uint32_t)((uint8_t *)(&sSettings.CritSecCRC) - (uint8_t *)&sSettings) / 4;
-    return crc_block_calculate((uint32_t *)&sSettings, critsec_len);
-}
 
 /**
   * @brief   Сброс флага boottry в регистре RTC
@@ -440,7 +513,7 @@ uint32_t SETTINGS_GetCritSecCRC(void)
 void SETTINGS_ResetBootTry(void)
 {
     uint8_t bootTry = (uint8_t)bpr_data_read(BPR_DATA2);
-    
+#if 0    
     if (bootTry > 0 )
     {
         bootTry = 0;
@@ -453,6 +526,7 @@ void SETTINGS_ResetBootTry(void)
             bpr_data_write(BPR_DATA3, 0);
         }
     }
+#endif    
 }
 
 /**
@@ -476,19 +550,21 @@ void SETTINGS_GetMac(uint8_t *mac)
   */
 void SETTINGS_SetProDate(char *proDate, uint8_t len)
 {
-    SYS_t *sSys = NULL;
+#if 0  
+    sys_settings_t *sSys = NULL;
     
-    sSys = pvPortMalloc(sizeof(*sSys));
+    sSys = pvPortMalloc(sizeof(*sys_settings_t));
     if (sSys) 
     {
         SYS_Load(sSys);
         strcpy(sSys->proddate, proDate);
-        SYS_Save(sSys);
+        sys_save(sSys);
         memset(sSettings.sInfo.productionData, 0, 40);
         memcpy(sSettings.sInfo.productionData, proDate, len);
         vPortFree(sSys);
         //SETTINGS_Save();
     }
+#endif
 }
 
 /**
@@ -496,19 +572,21 @@ void SETTINGS_SetProDate(char *proDate, uint8_t len)
   */
 void SETTINGS_SetSerialNumber(char *sn, uint8_t len)
 {
-    SYS_t *sSys = NULL;
+#if 0  
+    sys_settings_t *sSys = NULL;
     
     sSys = pvPortMalloc(sizeof(*sSys));
     if (sSys) 
     {
         SYS_Load(sSys);
         strcpy(sSys->serial, sn);
-        SYS_Save(sSys);
+        sys_save(sSys);
         memset(sSettings.sInfo.serialNumber, 0, 16);
         memcpy(sSettings.sInfo.serialNumber, sn, len);
         vPortFree(sSys);
         //SETTINGS_Save();
     }
+#endif
 }
 
 /**
@@ -516,19 +594,21 @@ void SETTINGS_SetSerialNumber(char *sn, uint8_t len)
   */
 void SysSETTINGS_SetMAC(char *mac, uint8_t len)
 {
-    SYS_t *sSys = NULL;
+#if 0  
+    sys_settings_t *sSys = NULL;
     
     sSys = pvPortMalloc(sizeof(*sSys));
     if (sSys) 
     {
         SYS_Load(sSys);
         strcpy(sSys->mac, mac);
-        SYS_Save(sSys);
+        sys_save(sSys);
         memset(sSettings.sInfo.mac, 0, 18);
         memcpy(sSettings.sInfo.mac, mac, len);
         vPortFree(sSys);
         //SETTINGS_Save();
     }
+#endif    
 }
 
 /**
@@ -536,6 +616,7 @@ void SysSETTINGS_SetMAC(char *mac, uint8_t len)
   */
 void SETTINGS_StatusTest(char *status, uint8_t len)
 {
+#if 0  
     SYS_t *sSys = NULL;
     
     sSys = pvPortMalloc(sizeof(*sSys));
@@ -543,12 +624,13 @@ void SETTINGS_StatusTest(char *status, uint8_t len)
     {
         SYS_Load(sSys);
         strcpy(sSys->testState, status);
-        SYS_Save(sSys);
+        sys_save(sSys);
         memset(sSettings.sFlags.testState, 0, 16);
         memcpy(sSettings.sFlags.testState, status, len);
         vPortFree(sSys);
         SETTINGS_Save();
     }
+#endif
 }
 
 /**
@@ -556,6 +638,7 @@ void SETTINGS_StatusTest(char *status, uint8_t len)
   */
 void SETTINGS_SetT2OK(void)
 {
+#if 0  
     SYS_t *sSys = NULL;
     
     sSys = pvPortMalloc(sizeof(*sSys));
@@ -568,10 +651,11 @@ void SETTINGS_SetT2OK(void)
         memset(sSettings.sFlags.testState, 0, 16);
         memcpy(sSettings.sFlags.testState, "T2OK", 4);
         strcpy(sSys->testState, sSettings.sFlags.testState);
-        SYS_Save(sSys);
+        sys_save(sSys);
         vPortFree(sSys);
         SETTINGS_Save();
     }
+#endif    
 }
 
 
@@ -580,6 +664,7 @@ void SETTINGS_SetT2OK(void)
   */
 void SETTINGS_ResetT2OK(void)
 {
+#if 0  
     SYS_t *sSys = NULL;
     
     sSys = pvPortMalloc(sizeof(*sSys));
@@ -591,10 +676,11 @@ void SETTINGS_ResetT2OK(void)
         
         memset(sSettings.sFlags.testState, 0, 16);
         strcpy(sSys->testState, sSettings.sFlags.testState);
-        SYS_Save(sSys);
+        sys_save(sSys);
         vPortFree(sSys);
         SETTINGS_Save();
     }
+#endif    
 }
 
 
@@ -622,7 +708,7 @@ void COM_SetTestMAC(void)
     octet4 = hash[3];
     octet5 = hash[4];
     /* Устанавливаем MAC, но не сохраняем */
-    snprintf(sSettings.sInfo.mac, MAC_LEN, "%02X-%02X-%02X-%02X-%02X-00", octet1 & 0xFE, octet2, octet3, octet4, octet5);
+    //snprintf(sSettings.sInfo.mac, MAC_LEN, "%02X-%02X-%02X-%02X-%02X-00", octet1 & 0xFE, octet2, octet3, octet4, octet5);
 }
 
 /**
@@ -633,39 +719,6 @@ void SETTINGS_SetDHCPOn(void)
     sSettings.sWebTempParams.dhcpEnable = 1;
 }
 
-//
-void init_settings(void)
-{
-    flash_mutex = xSemaphoreCreateMutex();
-}
-
-//
-bool SETTINGS_Check_9b(void)
-{
-    for (uint8_t i = 0; i < NUM_PORTGW; i++) {
-        if (sSettings.sPortGw[i].uart_set.databits == DATABITS_9) {
-            return true;
-        }
-    }
-    return false;
-}
-
-//
-void SETTINGS_Replace_9b(void)
-{
-    bool ret = false;
-    for (uint8_t i = 0; i < NUM_PORTGW; i++) {
-        if (sSettings.sPortGw[i].uart_set.databits == DATABITS_9) {
-            sSettings.sPortGw[i].uart_set.databits = DATABITS_8;
-            ret = true;
-        }
-    }
-    if (ret) {
-        SETTINGS_Save();
-    }
-}
-
-
 //
 void SETTINGS_Print(void)
 {
@@ -979,9 +1032,6 @@ void SETTINGS_Print(void)
             case DATABITS_8 :
                 printf("\tData bits: 8\r\n");
             break;
-            case DATABITS_9 :
-                printf("\tData bits: 9\r\n");
-            break;
         }
         
         switch (sSettings.sPortGw[i].uart_set.stopbits)
@@ -1079,5 +1129,4 @@ void SETTINGS_Print(void)
     printf("\tКонтрольное слово: %u\r\n", sSettings.controlWorld);
     printf("\tCRC: %X\r\n", *(uint32_t*)CRC_ADDRESS);
 }
-
-/********************************* (C) ROTEK **********************************/
+#endif

+ 62 - 252
fw/modules/settings/settings_api.h

@@ -3,282 +3,101 @@
 
 #include "at32f403a_407.h"
 #include <stdbool.h>
-//#include "units.h"
 #include "usart.h"
 #include "sys_api.h"
 
-/* Reference SETTINGS_t structure size value */
-/* Modify this value every time you change its size and increse SETTINGS_VERSION value */
-#define REF_SETTINGS_SIZE   0x56C
 
-/* Changing SETTINGS_VERSION causes loading default settings on start. */
-#define SETTINGS_VERSION    0
 
+// Изменить версию если поменялась структура настроек
+#define SETTINGS_VERSION   0x01
 
-#define NUM_GSM                 2 // количество GSM каналов (количество SIM)
-#define NUM_PORTGW              3 // количество прозрачных портов
 
-/* Максимальная длинна логина и пароля для входа в Web */
-#define MAX_WEB_LOGIN_LEN       11
-#define MAX_WEB_COOKIE_LEN      16
 
-/* Максимальная длинна строки параметра, передаваемого в Web */
-#define MAX_WEB_PARAM_LEN              102//64
+// ------------------------------------------------------------------- //
+//					 		Modbus
+// ------------------------------------------------------------------- //
 
-/* Max WEB users in the system/
- * 
- **/
-#define MAX_WEB_USERS                  1
-
-/**
-  * @brief  Параметры сетевого подключения
-  */
+// Modbus 
 typedef struct
 {
-  char    ip[16];
-  char    gate[16];
-  char    mask[16];
-  char    dns1[16];
-  char    dns2[16];
-  uint8_t dhcpEnable;  // 0 - DHCP отключен, 1 - включен
-} WEB_PARAMS_t;
+	rate_t     baud;		// Скорость порта 
+	parity_t   parity;		// Четность 
+	databits_t databits;	// Число бит данных
+	stopbits_t stopbits;	// Число стоп-бит  
 
-/**
-  * @brief Настройки Ethernet подключения
-  */
-typedef struct
-{
-  bool     Enabled;                        // Вкл/Выкл Ethernet 
-  uint8_t  prior;                          // Приоритет (1/2/3)
-  char     ip_test[32];                    // IP-адрес проверки связи
-}ETHERNET_t;
+} modbus_t;
 
-/**
-  * @brief  Типы профиля GSM
-  */
-typedef enum
-{
-    BEELINE = 0,
-    MTS,
-    MEGAFON,
-    TELE2,
-    USER,
-    MAX_GSM_TYPES_PROFILE
-} type_profile_gsm_t;
 
-/**
-  * @brief  Типы GSM модема
-  */
-typedef enum
+// Общая структура настроек для IAP и FW
+typedef struct
 {
-    SIM800 = 0,
-    SIM7500,
-} MODEM_TYPE_t;
+    uint16_t    mb_port;    // Настройки порта для modbus
+    
+} com_settings_t;
 
-/**
-  * @brief  Режим работы GSM модема
-  */
-typedef enum
-{
-    AUTOMATIC = 2,
-    GSM_3G = 48,
-    LTE = 38,
-    WCDMA = 14,
-    GSM = 13,
-} MODEM_MODE_t;
 
-/**
-  * @brief Настройки GSM модуля
-  */
-typedef struct
-{
-  bool     Enabled;                        // Вкл/Выкл GSM модуля 
-  uint8_t  prior;                          // Приоритет (1/2/3)
-  type_profile_gsm_t type_profile;         // Тип профиля
-  char     APNaddr[64];                    // Адрес точки доступа APN 
-  char     APNlogin[32];                   // Логин APN 
-  char     APNpass[32];                    // Пароль APN 
-  char     ip_test[32];                    // IP-адрес проверки связи
-  char     msisdn[14];                     // Номер SIM-карты (MSISDN)
-  uint32_t timeout;                        // Таймаут ожидания ответа, сек
-  uint32_t period_test;                    // Время между проверками доступности канала связи
-  uint8_t  num_bad_connect;                // Количество неудачных попыток до переключения канала
-  MODEM_MODE_t  modem_mode;                // Режим работы GSM модема
-} GSM_t;
 
-/**
-  * @brief  Параметры SNTP
-  */
+// Полная структура настроек
 typedef struct
 {
-    bool  sntpEnable;                       // Вкл/выкл
-    char  ip1[16];                          // Адрес SNTP сервера 1
-    char  ip2[16];                          // Адрес SNTP сервера 2
-    char  data[30];                         // Дата последней синхронизации
-    float timeZone;                         // Часовой пояс  
-} SNTP_t; 
+    com_settings_t  com_settings;
+    uint32_t        critical_section_crc;
+/* WARNING! До поля CritSecCRC включительно структура настроек должна быть
+* идентичной между бутлоадером и основным ПО и не должна изменяться при обновлении ПО.
+* Контроль целостности настроек внутри IAP выполняется только для критической секции,
+* т.к. контроль целостности всей структуры не имеет смысла
+* (структура настроек всегда будет отличаться внутри основного ПО).
+* В случае повреждения критического сектора, загружаются параметры по умолчанию. */    
+    uint16_t        settings_version;   // Версия структуры настроек 
+    uint32_t        control_word;       // Слово для контроля целостности структуры настроек
+} settings_t;
 
-/**
-  * @brief  Параметры сервера
-  */
-typedef struct
-{
-    bool      serverEnable;                 // Вкл/выкл
-    char      ip[16];                       // Адрес сервера
-    uint16_t  port;                         // Номер порта
-    bool      controlConnect;               // Контроль соединения (1 - да; 0 - нет)
-} SERVER_t;
 
-/**
-  * @brief  Параметры PROXY                                                                                                                                                         PROXY
-  */
-typedef struct
-{
-    char      ip[16];                       // IP-адрес подключения
-    uint16_t  port;                         // Порт подключения
-    uint8_t   local_port;                   // Локальный порт 
-} PROXY_t;
 
+// Загрузка структуры настроек из flesh
+void settings_load(settings_t *settings);
 
-/**
-  * @brief  Информация об устройстве
-  */
-typedef struct
-{
-  uint32_t  id;                     // Цифровой идентификатор
-  char      productionData[40];     // Дата производства
-  char      mac[18];                // MAC адрес
-  char      serialNumber[16];       // Серийный номер
-  char      owner[102];             // Владелец
-  char      location[102];          // Адрес
-  char      comments[102];          // Комментарии
-  char      incharge[62];           // Ответсвенное лицо
-} DEVICE_INFO_t; 
+//
+void init_settings(void);
 
-/**
-  * @brief  Уровни пользователей Web.
-  */
-typedef enum
-{
-  FACTORY = 0,
-  ADMIN,
-  MAX_USER_LEVELS
-} user_level_t;
+//
+void settings_read_from_flash(uint8_t *data, uint32_t size);
 
-/**
-  * @brief  Настройки аутентификации.
-  */
-typedef struct
-{
-  user_level_t level;
-  char login[MAX_WEB_LOGIN_LEN];
-  uint8_t hash[16];
-} AUTH_t;
+//
+uint32_t settings_get_crc(settings_t *settings);
 
-/**
-  * @brief  Флаги, ключи и т.д.
-  */
-typedef struct
-{
-  bool netsettingsChanged;		     // Признак изменения сетевых настроек пользователем
-  char testState[16];			     // Статус производственного тестирования
-} FLAGS_t;
+//
+uint32_t settings_get_crit_sec_crc(settings_t *settings);
 
-/**
-  * @brief  Типы транспорта прозрачного порта
-  */
-typedef enum
-{
-  GW_UDP = 0,
-  GW_TCP,
-  MAX_TRANS_TYPES
-} gwtrans_t;
+// Сброс всех настроек в значения по умолчанию
+void settings_set_all_default(void);
 
-/**
-  * @brief  Режим прозрачного порта
-  */
-typedef enum
-{
-  GW_SERVER = 0,
-  GW_CLIENT,
-  MAX_MODE_TYPES
-} gwmode_t;
 
-/**
-  * @brief  Режим (RS-232/RS-485)
-  */
-typedef enum
-{
-  RS_232_1 = 0,
-  RS_232_2,
-  RS_232_3,
-  RS_485_1,
-  RS_485_2,
-  MAX_RS_PORTS
-} rsmode_t;
+// -------------------------------------------------------------------------- //
+// Настройки по умолчанию
 
-/**
-  * @brief  Тип порта (Модем / Прибор учета)
-  */
-typedef enum
-{
-  MODEM = 0,
-  ACCOUNT_METER,
-  MAX_DISPATCH_MODES
-} dispatchport_t;
+//
+void settings_set_modbus_def(uint16_t *mb_port);
 
-/**
-  * @brief Настройки прозрачного порта
-  */
-typedef struct
-{
-  bool enableDispatch;                // Параллельная диспетчеризация (Вкл./Выкл.)
-  bool enabled;                       // Вкл/Откл 
-  dispatchport_t type_port;           // Тип порта (Модем / Прибор учета)
-  uint8_t connect_port;               // Связанный порт (#1-#3)
-  char description[30];               // Описание
-  gwtrans_t transtype;                // Тип транспорта 
-  gwmode_t mode;                      // Режим: Клиент/Сервер 
-  char ip[16];                        // IP-адрес сервера (для клиента) 
-  uint16_t port;                      // Порт 
-  rsmode_t rs_mode;                   // Режим (RS-232/RS-485)
-  uart_settings_t uart_set;           // Настройки UART прозрачного порта
-} PORTGW_t;
-
-/**                 
-  * @brief  Режимы параллельной диспетчеризации
-  */
-typedef enum
-{
-  PSD_MODE_1 = 0,                     // RS232#1 <-> RS232#2, USART6 <-> RS232#3
-  PSD_MODE_2,                         // RS485#1 <-> RS232#2, USART6 <-> RS232#3
-  PSD_MODE_3,                         // RS232#1 <-> RS485#2, USART6 <-> RS232#3
-  PSD_MODE_4,                         // RS485#1 <-> RS485#2, USART6 <-> RS232#3
-  PSD_MODE_5,                         // RS232#1 <-> RS232#3
-  PSD_MODE_6,                         // RS485#1 <-> RS232#3
-  PSD_MODE_7,                         // USART1 <-> RS485#1, USART3 <-> RS485#2, USART4 <-> RS232#1, USART5 <-> RS232#2, USART6 <-> RS232#3,
-  MAX_PSD_MODES
-} PSD_MODE_t;
+//
+void settings_conv_modbus_def(modbus_t *mb_settings, uint16_t *mb_port);
 
-/**
-  * @brief Настройки системы параллельной диспетчеризации
-  */
-typedef struct
-{
-  bool enabled;                       // Вкл/Откл 
-  PSD_MODE_t mux_mode;                // Режим (управление мультиплексором)
-  rsmode_t rs_mode;                   // Режим (RS-232/RS-485)
-  uint8_t web_port;                   // На каком из прозрачных портов работает PSD
-  uint16_t assd_timeout;              // Timeout
-} PSD_t;
+// -------------------------------------------------------------------------- //
 
+// Запись структуры настроек во flash
+void settings_save(settings_t *settings);
 
+//
+void settings_write_to_flash(uint8_t *data, uint32_t size);
 
-/**
-  * @brief  Общая структура настроек
-  */
+
+
+#if 0
+
+// Общая структура настроек
 typedef struct
 {
+    //uint32_t    
   WEB_PARAMS_t  sWebParams;
   WEB_PARAMS_t  sWebTempParams;
   DEVICE_INFO_t sInfo;
@@ -305,7 +124,7 @@ typedef struct
 /**
   * @brief  Общая структура настроек
   */
-extern SETTINGS_t sSettings;
+
 
 /**
   * @brief
@@ -388,10 +207,6 @@ void SETTINGS_SetAllDefault(void);
   */
 void SETTINGS_Save(void);
 
-/**
-  * @brief  Загрузка структуры настроек из flesh
-  */
-void SETTINGS_Load(void);
 
 /**
   * @brief  
@@ -459,22 +274,17 @@ void COM_SetTestMAC(void);
   */
 void SETTINGS_SetDHCPOn(void);
 
-//
-void init_settings(void);
 
 //
 void SETTINGS_Print(void);
+#endif
 
-//
-bool SETTINGS_Check_9b(void);
+// Системные настройки
+extern sys_settings_t sys_settings;
 
 //
-void SETTINGS_Replace_9b(void);
-
-// Системные настройки
-extern SYS_t sSys;
+extern settings_t settings;
 
 
 #endif /* #ifndef SETTINGS_API_H */
 
-/********************************* (C) РОТЕК **********************************/

+ 24 - 5
fw/user/main.c

@@ -21,15 +21,16 @@ int main(void)
     system_clock_config();
 
     delay_init();
-    
-    SYS_Load(&sSys);
+
+    // -------------------------------------------------------------------------
+    // Debug
+    uart_print_init(115200);
+
     
     //usb_clock48m_select(USB_CLK_HEXT);
     
     crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
     
-    uart_print_init(115200);
-    
     io_port_init();
     in_exint_init();
     cm_gpio_init();
@@ -65,7 +66,25 @@ int main(void)
 
 void init_task(void *argument)
 {
-    //
+    // -------------------------------------------------------------------------
+    // Загрузка и проверка настроек
+    crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, TRUE);
+    
+    // Мьютекс для работы с настройками
+    init_settings(); 
+
+    // Для теста
+    //sys_clear();
+    
+    // Системные настройки
+    sys_settings_load(&sys_settings);
+    
+    // Основные настройки
+    settings_load(&settings);
+    
+    // -------------------------------------------------------------------------
+    // RNDIS
+    
     //usb_eth_init();
     
     mux_gpio_init();

BIN
project/ewarm/Debug/Exe/module_universal_io.out


BIN
project/ewarm/Debug/Exe/module_universal_io.sim


File diff suppressed because it is too large
+ 808 - 719
project/ewarm/Debug/List/module_universal_io.map


+ 151 - 306
project/ewarm/Debug/Obj/.ninja_log

@@ -1,309 +1,154 @@
 # ninja log v5
-9625	10016	7297949003351180	module_universal_io_part10.pbi	44b757639e74aaa4
-2734	2797	7297948931151924	autoip.pbi	3410c31b7a185ef
-895	1222	7297948915454755	at32f403a_407_adc.pbi	26d55732a88d7716
-1867	2098	7297948924152548	netdb.pbi	f6dbc401c1b75eff
-4832	5050	7297948953677099	at32f403a_407_debug.pbi	60e15a3c5c271d1
-3458	3794	7297948941153640	at32f403a_407_can.pbi	bb000e04e19c41fc
-944	1213	7297948915364696	user_fatfs.pbi	83a0520befde6969
-5050	5269	7297948955897000	at32f403a_407_bpr.pbi	edf8d27acb087cdd
-670	916	7297948912363967	input.pbi	cc127fba907a3f91
-2638	2712	7297948930281980	heap_4.pbi	b9206b44de15305a
-307	669	7297948909840619	modbus_params.pbi	521cb8c6475893eb
-916	1162	7297948914844454	output.pbi	4a93015e7f57e397
-5386	5760	7297948960869753	module_universal_io_part2.pbi	886e54fa538c4450
-439	680	7297948909970304	mux.pbi	b62f54fd69e70817
-6635	7011	7297948973369659	module_universal_io_part0.pbi	df9bdfa8747565b8
-8404	8684	7297948990060231	mbutils.pbi	9a42e5292c78f9e6
-54	307	7297948906227649	modbus.pbi	9d93dee408465c3f
-1223	1460	7297948917760607	common_gpio.pbi	6febe002160ad458
-1461	1706	7297948920280934	io.pbi	53120150c070c645
-415	672	7297948909970304	spi_flash.pbi	b6925f452a09068c
-2446	2623	7297948929412050	def.pbi	e07c35954cba8126
-56	381	7297948906968493	at32f403a_407_int.pbi	906c519932e820e1
-2360	2446	7297948927672179	ip4_frag.pbi	fa52477c77120ef4
-5604	5842	7297948961659683	usb.pbi	1b33831d424288a3
-7169	7427	7297948977498085	mbfuncother.pbi	65dfbf0500f73e74
-2191	2359	7297948926762330	sockets.pbi	78e00629bb9c7bf3
-1435	1768	7297948920891213	usb_eth.pbi	1c1276f61ed00315
-51	414	7297948907358124	misc.pbi	cc1427fe86531ca
-5055	5277	7297948956026975	at32f403a_407_crm.pbi	6fa79eb950f4b706
-7945	8041	7297948983600642	ethernet.pbi	1c6c427f99926c56
-2559	2638	7297948929542020	event_groups.pbi	b0117a93bb36a613
-672	944	7297948912584693	main.pbi	98f5ddcfa15fcbf9
-1213	1434	7297948917580453	system_at32f403a_407.pbi	19e6ed7ce1b70744
-6916	7336	7297948976588426	module_universal_io_part1.pbi	70198e839ae393d9
-680	895	7297948912104019	at32f403a_407_acc.pbi	126e6f3827817e9b
-2784	2911	7297948932269134	etharp.pbi	e786b02ceeb55ca1
-2175	2327	7297948926412325	api_msg.pbi	dc19040cffd00b32
-2623	2733	7297948930541925	mem.pbi	5433c52f969448d6
-2270	2389	7297948927022318	tcpip.pbi	1036b9144f88c425
-3217	3457	7297948937764242	usbd_core.pbi	6af6afbab86fcb32
-8041	8158	7297948984790196	pbuf.pbi	8f8fc39b0bf13e03
-1793	2055	7297948923762597	memp.pbi	ba607d316d0db951
-4187	4410	7297948947284869	at32f403a_407_dma.pbi	7e15745d8abafda6
-2031	2112	7297948924282521	ip4_addr.pbi	fa8625d39d6cb082
-2112	2174	7297948924892512	FreeRTOS-openocd.pbi	6afd4f5d141d7d6c
-1768	1875	7297948922021087	ip4.pbi	1c9d7f8a0eafaddb
-4410	4625	7297948949414750	at32f403a_407_misc.pbi	1f69b6e4e023f2a4
-7539	7678	7297948979992935	netif.pbi	5010d8e60e2b8aef
-2327	2494	7297948928152188	igmp.pbi	8d6da84d694b748a
-2978	3147	7297948934674133	list.pbi	85bae7d49ea82543
-3838	4186	7297948945025069	at32f403a_407_tmr.pbi	8d3b78349c7a59be
-2911	2995	7297948933154349	fr_timers.pbi	79368dfd2989e742
-2797	2908	7297948932269134	err.pbi	28d27f8f02f32e8
-1706	1787	7297948921021183	netbuf.pbi	9ab4d3c693ca250a
-2712	2784	7297948931021948	croutine.pbi	65e3213de074fe6a
-2988	3216	7297948935414105	at32f403a_407_usb.pbi	6f9753b218030889
-1938	2030	7297948923541174	icmp.pbi	311d772edbd9397b
-2098	2190	7297948925152463	queue.pbi	14ac0bd34d1dee7a
-3599	3838	7297948941543583	usbd_int.pbi	7914595c1b5f0703
-1162	1432	7297948917559429	settings_api.pbi	ecda1325133e721b
-5729	6059	7297948963840047	spi_common.pbi	7edea8c36d7b233
-1653	1793	7297948921151156	api_lib.pbi	68c467c129312531
-2055	2270	7297948925892439	tasks.pbi	b6d2e7233a0c4a29
-2494	2595	7297948929152102	dns.pbi	a24a6defc7d2b6cb
-2908	2988	7297948933024370	inet_chksum.pbi	604c31d8cc8d82ee
-1876	1938	7297948922541296	netifapi.pbi	41eeb461c8e8e06
-2736	2977	7297948933024370	dhcp.pbi	b7a2e42362c12d74
-2595	2736	7297948930541925	init.pbi	d7d0ed53ee5b1b04
-1787	1867	7297948921891112	ip.pbi	590d4534c4de48ce
-2389	2558	7297948928762140	port.pbi	6601f1f6b557096c
-5269	5604	7297948959287005	at32f403a_407_spi.pbi	f5ca126e2f323a13
-7476	7847	7297948981672291	usbd_rndis_core.pbi	7bdfd763e52c799d
-3431	3654	7297948939804206	at32f403a_407_gpio.pbi	cb5a6e80c4e2495b
-4839	5055	7297948953767184	at32f403a_407_emac.pbi	13623b35ce3b9d28
-4091	4315	7297948946284907	at32f403a_407_exint.pbi	cbed7cabbf9ec5a7
-4844	5065	7297948953897191	at32f403a_407_xmc.pbi	8c76c728dbe71c11
-4471	4796	7297948951155725	at32f403a_407_wdt.pbi	4569f9aad239f2e1
-3147	3368	7297948936894035	at32f403a_407_usart.pbi	7125d76429ddf2f3
-3369	3598	7297948939154684	at32f403a_407_flash.pbi	4fc7bdbc164675f7
-4281	4508	7297948948284775	at32f403a_407_i2c.pbi	6daa0ceb22ce5132
-8158	8403	7297948987239543	porttimer.pbi	ade7d59e369abaf
-2995	3212	7297948935284141	at32f403a_407_pwc.pbi	63a4cbfd4289eaec
-3654	3874	7297948941893963	at32f403a_407_sdio.pbi	63ffb1ea9a33b2e0
-3212	3431	7297948937544186	at32f403a_407_rtc.pbi	bb60c2765c979541
-3874	4091	7297948944154819	at32f403a_407_wwdt.pbi	a015f9aae0617747
-4042	4281	7297948946024960	usbd_sdr.pbi	cf2767748e10e546
-5065	5386	7297948957026880	at32f403a_407_dac.pbi	8d8574a207e748b5
-4315	4387	7297948947024923	fatfs_spi_flash.pbi	136dc5ca3a603cb2
-4508	4839	7297948951545658	at32f403a_407_clock.pbi	b74edcdffa8e942f
-7967	8283	7297948986049709	ethernetif.pbi	44aea922f181f569
-3795	4041	7297948943674509	diskio.pbi	fafcfbb4f7d9bde3
-8283	8481	7297948988060924	sys.pbi	4823310c615ee090
-4388	4470	7297948947894852	ff.pbi	746ba546376bca75
-4796	4832	7297948951545658	syscall.pbi	9fde46365660190a
-4625	4844	7297948951675329	at32f403a_407_crc.pbi	5b132c0cf4795ec
-7011	7251	7297948975748759	mbcrc.pbi	548ab4bca39195af
-8901	9034	7297948993558892	timeouts.pbi	1d773859698f8a01
-6060	6324	7297948966442312	mb.pbi	d15c48b15039d3b6
-5277	5508	7297948958287377	rng.pbi	9a7548d1d0eb5a09
-8687	8900	7297948992229399	udp.pbi	d042359ae981f472
-7362	7476	7297948977987893	tcp_out.pbi	c29c5c85e8c8e2d9
-7712	7967	7297948982861845	mbfunccoils.pbi	44373c6841a8b18f
-8684	9055	7297948993768812	mbascii.pbi	4047099935ec1868
-8315	8687	7297948990060231	mbfuncdisc.pbi	285c957261a71f43
-5761	6016	7297948963400134	utility.pbi	4d101e38d3b56fcf
-8219	8315	7297948986399586	dhserver.pbi	96c90dfc96711b7e
-7092	7168	7297948974909069	stats.pbi	1cd2e113e610096b
-9034	9403	7297948997267479	mbfuncinput.pbi	5a46bb5ed3e0bd41
-8834	9186	7297948995098308	usbd_desc.pbi	2c944b8cdee0cd3a
-7678	7712	7297948980342803	mbfuncdiag.pbi	18a7b177e0bc1978
-7698	7945	7297948982652204	portevent.pbi	83b38927de050926
-6016	6276	7297948966022471	mbrtu.pbi	7177b5e6762babe5
-7595	7698	7297948980202863	sys_arch.pbi	f2f98e1ca4fb092b
-7427	7539	7297948978617657	tcp.pbi	7976241f5bcac0cc
-7336	7595	7297948979177769	mbfuncholding.pbi	2bf2b5bf9e0090fd
-9056	9413	7297948997337757	portother.pbi	c89f8859092ab559
-9186	9280	7297948996007960	dnserver.pbi	8a5674ecbe3f754b
-7847	8218	7297948985419948	portserial.pbi	dd5007ac716e4d70
-9403	9625	7297948999506909	tim_delay.pbi	b60ecd4d830a00f4
-7252	7362	7297948976868320	tcp_in.pbi	62f7342b24edfe12
-8481	8708	7297948990340427	raw.pbi	b4f1ea402c6aa49
-6663	6760	7297948970850977	module_universal_io_part6.pbi	911a3b316d4c01a5
-6404	6634	7297948969591101	at32f403a_407_board.pbi	4b58d009aa6f2679
-6462	6789	7297948971130823	extended_sram.pbi	9821fdaf070f27e9
-1432	1653	7297948919760714	uptime.pbi	932b7d998dea5d4e
-6277	6662	7297948969870987	module_universal_io_part3.pbi	604b09340a58567
-5842	6033	7297948963609653	module_universal_io_part4.pbi	eb6be3f6d52b3e6b
-9280	9513	7297948998387054	module_universal_io_part8.pbi	1c74812669248db5
-8708	8834	7297948991599949	module_universal_io_part7.pbi	a3ba8562ffb12cd
-5509	5729	7297948960547160	wdt.pbi	c15a4f0592fefe9d
-9413	9792	7297949001160060	module_universal_io_part9.pbi	c7f360520c28a936
-6324	6461	7297948967841767	module_universal_io_part5.pbi	d96b33c3f39fe461
-10017	10557	7297949008784701	module_universal_io.pbd	21a8effa42505154
-10558	12723	7297949030056234	module_universal_io.pbw	9bf63675a62b919d
+2156	2218	7307458153650944	autoip.pbi	3410c31b7a185ef
+313	716	7307486607845258	module_universal_io_part10.pbi	23f87e1291f5687b
+53	280	7307458134286930	at32f403a_407_adc.pbi	26d55732a88d7716
+50	336	7307458134820669	user_fatfs.pbi	83a0520befde6969
+5215	5440	7307458185889199	at32f403a_407_bpr.pbi	edf8d27acb087cdd
+1837	1965	7307458151061618	netdb.pbi	f6dbc401c1b75eff
+3736	3971	7307458171211237	at32f403a_407_can.pbi	bb000e04e19c41fc
+4939	5164	7307458183111675	at32f403a_407_debug.pbi	60e15a3c5c271d1
+744	1012	7307458141593790	input.pbi	cc127fba907a3f91
+280	530	7307458136669195	output.pbi	4a93015e7f57e397
+6644	7039	7307458201913587	module_universal_io_part2.pbi	862931efe843cc6d
+336	685	7307458138361570	mux.pbi	b62f54fd69e70817
+55	312	7307458134508242	modbus_params.pbi	521cb8c6475893eb
+2962	3036	7307458161850141	heap_4.pbi	b9206b44de15305a
+631	895	7307458140389511	common_gpio.pbi	6febe002160ad458
+5996	6344	7307458194915750	module_universal_io_part0.pbi	f87d4c2b3352baf6
+8723	8982	7307458221266306	mbutils.pbi	9a42e5292c78f9e6
+1012	1275	7307458144238192	modbus.pbi	9d93dee408465c3f
+938	1187	7307458143301065	io.pbi	53120150c070c645
+1496	1759	7307458149102377	spi_flash.pbi	b6925f452a09068c
+1187	1508	7307458146570169	at32f403a_407_int.pbi	906c519932e820e1
+2121	2293	7307458154420656	def.pbi	e07c35954cba8126
+1508	1855	7307458150012016	usb_eth.pbi	1c1276f61ed00315
+6408	6644	7307458197924941	usb.pbi	1b33831d424288a3
+8681	8944	7307458220916733	mbfuncother.pbi	65dfbf0500f73e74
+2571	2839	7307458159878256	sockets.pbi	78e00629bb9c7bf3
+2875	2962	7307458161067797	ip4_frag.pbi	fa52477c77120ef4
+380	630	7307458137671539	misc.pbi	cc1427fe86531ca
+51	333	7307486603947280	main.pbi	98f5ddcfa15fcbf9
+7621	7712	7307458208612413	ethernet.pbi	1c6c427f99926c56
+1763	1852	7307458150012016	event_groups.pbi	b0117a93bb36a613
+4200	4530	7307458176753705	at32f403a_407_crm.pbi	6fa79eb950f4b706
+1275	1496	7307458146430221	system_at32f403a_407.pbi	19e6ed7ce1b70744
+339	768	7307486608347940	module_universal_io_part1.pbi	aed75ce9e1cba842
+1397	1618	7307458147689744	at32f403a_407_acc.pbi	126e6f3827817e9b
+1852	1962	7307458151131591	mem.pbi	5433c52f969448d6
+2645	2874	7307458160228129	tcpip.pbi	1036b9144f88c425
+2519	2676	7307458158198900	api_msg.pbi	dc19040cffd00b32
+2676	2891	7307458160368065	etharp.pbi	e786b02ceeb55ca1
+7489	7709	7307458208542731	pbuf.pbi	8f8fc39b0bf13e03
+3561	3808	7307458169531888	usbd_core.pbi	6af6afbab86fcb32
+2218	2474	7307458156239643	memp.pbi	ba607d316d0db951
+2839	3032	7307458161780166	ip4_addr.pbi	fa8625d39d6cb082
+3143	3375	7307458165208853	at32f403a_407_dma.pbi	7e15745d8abafda6
+2507	2571	7307458157149293	FreeRTOS-openocd.pbi	6afd4f5d141d7d6c
+7985	8125	7307458212752464	netif.pbi	5010d8e60e2b8aef
+2059	2166	7307458153160815	ip4.pbi	1c9d7f8a0eafaddb
+5327	5546	7307458186939088	at32f403a_407_misc.pbi	1f69b6e4e023f2a4
+2050	2121	7307458152671004	list.pbi	85bae7d49ea82543
+2357	2422	7307458155680193	igmp.pbi	8d6da84d694b748a
+1959	2046	7307458151901300	fr_timers.pbi	79368dfd2989e742
+3808	4048	7307458171910966	at32f403a_407_tmr.pbi	8d3b78349c7a59be
+3032	3125	7307458162759787	err.pbi	28d27f8f02f32e8
+2474	2645	7307458157918997	croutine.pbi	65e3213de074fe6a
+2422	2506	7307458156519537	netbuf.pbi	9ab4d3c693ca250a
+2167	2356	7307458155050095	queue.pbi	14ac0bd34d1dee7a
+1962	2058	7307458152041244	icmp.pbi	311d772edbd9397b
+4984	5215	7307458183601488	at32f403a_407_usb.pbi	6f9753b218030889
+55	339	7307486604098425	settings_api.pbi	ecda1325133e721b
+6720	7058	7307458202083431	spi_common.pbi	7edea8c36d7b233
+1618	1763	7307458149102377	api_lib.pbi	68c467c129312531
+5164	5412	7307458185609298	usbd_int.pbi	7914595c1b5f0703
+2047	2155	7307458153020871	tasks.pbi	b6d2e7233a0c4a29
+1856	1959	7307458151061618	dns.pbi	a24a6defc7d2b6cb
+2891	2968	7307458161150378	inet_chksum.pbi	604c31d8cc8d82ee
+313	379	7307458135289305	hash.pbi	470f3df97f64da35
+2968	3142	7307458162899739	netifapi.pbi	41eeb461c8e8e06
+2294	2519	7307458156659482	dhcp.pbi	b7a2e42362c12d74
+3036	3279	7307458164299202	init.pbi	d7d0ed53ee5b1b04
+1965	2050	7307458151971270	ip.pbi	590d4534c4de48ce
+1759	1837	7307458149872072	port.pbi	6601f1f6b557096c
+4754	4983	7307458181292368	at32f403a_407_spi.pbi	f5ca126e2f323a13
+3819	4045	7307458171910966	at32f403a_407_gpio.pbi	cb5a6e80c4e2495b
+8419	8680	7307458218257452	usbd_rndis_core.pbi	7bdfd763e52c799d
+4605	4939	7307458180872526	at32f403a_407_emac.pbi	13623b35ce3b9d28
+3376	3599	7307458167424444	at32f403a_407_exint.pbi	cbed7cabbf9ec5a7
+4603	4825	7307458179752925	at32f403a_407_xmc.pbi	8c76c728dbe71c11
+4048	4268	7307458174150107	at32f403a_407_wdt.pbi	4569f9aad239f2e1
+5441	5770	7307458189177935	at32f403a_407_usart.pbi	7125d76429ddf2f3
+3280	3512	7307458166584737	at32f403a_407_flash.pbi	4fc7bdbc164675f7
+3972	4199	7307458173450384	at32f403a_407_i2c.pbi	6daa0ceb22ce5132
+3512	3736	7307458168823909	at32f403a_407_pwc.pbi	63a4cbfd4289eaec
+8982	9228	7307458223715370	porttimer.pbi	ade7d59e369abaf
+3224	3561	7307458167074573	at32f403a_407_sdio.pbi	63ffb1ea9a33b2e0
+4045	4271	7307458174150107	at32f403a_407_rtc.pbi	bb60c2765c979541
+4268	4602	7307458177464615	at32f403a_407_wwdt.pbi	a015f9aae0617747
+4826	5070	7307458182202019	usbd_sdr.pbi	cf2767748e10e546
+4271	4605	7307458177534590	at32f403a_407_dac.pbi	8d8574a207e748b5
+3599	3781	7307458169313718	fatfs_spi_flash.pbi	136dc5ca3a603cb2
+5412	5632	7307458187778468	at32f403a_407_clock.pbi	b74edcdffa8e942f
+5071	5327	7307458184769619	diskio.pbi	fafcfbb4f7d9bde3
+9011	9433	7307458225823434	ethernetif.pbi	44aea922f181f569
+3126	3224	7307458163739420	ff.pbi	746ba546376bca75
+7480	7581	7307458207314426	sys.pbi	4823310c615ee090
+3782	3818	7307458169671822	syscall.pbi	9fde46365660190a
+4530	4753	7307458179004035	at32f403a_407_crc.pbi	5b132c0cf4795ec
+7582	7946	7307458210921536	mbcrc.pbi	548ab4bca39195af
+8288	8418	7307458215691343	timeouts.pbi	1d773859698f8a01
+7224	7508	7307458206586377	mb.pbi	d15c48b15039d3b6
+5546	5776	7307458189247910	rng.pbi	9a7548d1d0eb5a09
+9447	9552	7307458227012975	udp.pbi	d042359ae981f472
+7255	7380	7307458205299812	tcp_out.pbi	c29c5c85e8c8e2d9
+7712	7984	7307458211341381	mbfunccoils.pbi	44373c6841a8b18f
+8125	8389	7307458215341478	mbascii.pbi	4047099935ec1868
+8389	8652	7307458217977562	mbfuncdisc.pbi	285c957261a71f43
+7710	7813	7307458209592046	dhserver.pbi	96c90dfc96711b7e
+6345	6720	7307458198675867	utility.pbi	4d101e38d3b56fcf
+8080	8158	7307458213032358	stats.pbi	1cd2e113e610096b
+8449	8723	7307458218677291	mbfuncinput.pbi	5a46bb5ed3e0bd41
+9434	9687	7307458228342468	usbd_desc.pbi	2c944b8cdee0cd3a
+8163	8194	7307458213452193	mbfuncdiag.pbi	18a7b177e0bc1978
+8195	8449	7307458215971231	portevent.pbi	83b38927de050926
+7946	8163	7307458213102336	sys_arch.pbi	f2f98e1ca4fb092b
+6148	6407	7307458195545826	mbrtu.pbi	7177b5e6762babe5
+9228	9446	7307458225963712	tcp.pbi	7976241f5bcac0cc
+7814	8080	7307458212262646	mbfuncholding.pbi	2bf2b5bf9e0090fd
+8944	9201	7307458223505458	portother.pbi	c89f8859092ab559
+8652	8749	7307458218957185	dnserver.pbi	8a5674ecbe3f754b
+8750	9010	7307458221616182	portserial.pbi	dd5007ac716e4d70
+9552	9772	7307458229182156	tim_delay.pbi	b60ecd4d830a00f4
+7508	7620	7307458207703390	tcp_in.pbi	62f7342b24edfe12
+7381	7480	7307458206307123	raw.pbi	b4f1ea402c6aa49
+5885	5996	7307458191487061	module_universal_io_part6.pbi	2bb77ce825fc92e7
+5776	6111	7307458192606937	at32f403a_407_board.pbi	4b58d009aa6f2679
+6565	6795	7307458199445256	extended_sram.pbi	9821fdaf070f27e9
+5770	6147	7307458192956794	module_universal_io_part3.pbi	2a68f3b760661c8e
+895	1120	7307458142697280	uptime.pbi	932b7d998dea5d4e
+7032	7254	7307458204078105	module_universal_io_part4.pbi	b32735e0d8bbebae
+9687	9890	7307458230372037	module_universal_io_part8.pbi	a2f88113ee680f91
+8158	8288	7307458214361850	module_universal_io_part7.pbi	6727895f771cda6d
+6234	6565	7307458197155200	wdt.pbi	c15a4f0592fefe9d
+9201	9592	7307458227432824	module_universal_io_part9.pbi	e3cc8b0a9040f459
+6111	6234	7307458193866447	module_universal_io_part5.pbi	6d816445fbfc6fb3
+768	1330	7307486614046239	module_universal_io.pbd	21a8effa42505154
+1331	3625	7307486636621040	module_universal_io.pbw	9bf63675a62b919d
 5572	5705	7297918194208641	sys_settings.pbi	577e933455673256
 49	94	7297889080083549	common_settings.pbi	fc8ffaaa249b3baa
-6033	6404	7297948967281980	sys_api.pbi	54cc67cfed8c5994
-6760	7092	7297948974139368	sys_hal.pbi	489f6613618d1494
-6789	6915	7297948972390343	module_universal_io_part11.pbi	3df179853edb0bc7
-382	439	7297948907549972	at32_uid.pbi	4236b4da0e4ba3d4
-50	315	7297953405542001	main.pbi	98f5ddcfa15fcbf9
-315	716	7297953409542854	module_universal_io_part1.pbi	70198e839ae393d9
-717	1267	7297953415043165	module_universal_io.pbd	21a8effa42505154
-1268	3421	7297953436245426	module_universal_io.pbw	9bf63675a62b919d
-53	184	7297956211569946	hash.pbi	470f3df97f64da35
-60	205	7297956211829250	module_universal_io_part7.pbi	6727895f771cda6d
-57	465	7297956214412345	module_universal_io_part3.pbi	2a68f3b760661c8e
-206	594	7297956215718850	module_universal_io_part9.pbi	e3cc8b0a9040f459
-184	610	7297956215868451	module_universal_io_part1.pbi	aed75ce9e1cba842
-466	628	7297956216048275	module_universal_io_part11.pbi	94db0828f3123726
-628	747	7297956217244773	module_universal_io_part5.pbi	6d816445fbfc6fb3
-611	824	7297956218012767	module_universal_io_part4.pbi	b32735e0d8bbebae
-748	858	7297956218342175	module_universal_io_part6.pbi	2bb77ce825fc92e7
-595	970	7297956219468879	module_universal_io_part2.pbi	862931efe843cc6d
-825	1175	7297956221513705	module_universal_io_part0.pbi	f87d4c2b3352baf6
-971	1180	7297956221573244	module_universal_io_part8.pbi	a2f88113ee680f91
-858	1259	7297956222371450	module_universal_io_part10.pbi	23f87e1291f5687b
-55	298	7297956378724235	mux.pbi	b62f54fd69e70817
-51	301	7297956378754157	input.pbi	cc127fba907a3f91
-57	330	7297956379043381	user_fatfs.pbi	83a0520befde6969
-301	550	7297956381257368	io.pbi	53120150c070c645
-298	555	7297956381307241	modbus_params.pbi	521cb8c6475893eb
-331	696	7297956382703504	misc.pbi	cc1427fe86531ca
-555	779	7297956383541271	uptime.pbi	932b7d998dea5d4e
-550	812	7297956383870392	spi_flash.pbi	b6925f452a09068c
-696	1026	7297956386014649	usb_eth.pbi	1c1276f61ed00315
-812	1082	7297956386573153	main.pbi	98f5ddcfa15fcbf9
-779	1107	7297956386822495	at32f403a_407_int.pbi	906c519932e820e1
-1082	1134	7297956387091767	at32_uid.pbi	4236b4da0e4ba3d4
-1134	1200	7297956387759980	hash.pbi	470f3df97f64da35
-1026	1334	7297956389096410	settings_api.pbi	ecda1325133e721b
-1107	1360	7297956389355717	common_gpio.pbi	6febe002160ad458
-1360	1459	7297956390273266	fr_timers.pbi	79368dfd2989e742
-1200	1510	7297956390861688	modbus.pbi	9d93dee408465c3f
-1459	1550	7297956391260630	FreeRTOS-openocd.pbi	6afd4f5d141d7d6c
-1510	1611	7297956391849044	queue.pbi	14ac0bd34d1dee7a
-1334	1615	7297956391908890	output.pbi	4a93015e7f57e397
-1615	1651	7297956392267926	syscall.pbi	9fde46365660190a
-1550	1677	7297956392517262	netdb.pbi	f6dbc401c1b75eff
-1611	1736	7297956393115657	tcpip.pbi	1036b9144f88c425
-1737	1842	7297956394169295	tasks.pbi	b6d2e7233a0c4a29
-1677	1855	7297956394298609	def.pbi	e07c35954cba8126
-1652	1859	7297956394348475	etharp.pbi	e786b02ceeb55ca1
-1842	1908	7297956394827488	netifapi.pbi	41eeb461c8e8e06
-1855	1925	7297956395006713	list.pbi	85bae7d49ea82543
-1859	1969	7297956395435565	ip4.pbi	1c9d7f8a0eafaddb
-1925	2025	7297956395994089	inet_chksum.pbi	604c31d8cc8d82ee
-1908	2032	7297956396073866	dns.pbi	a24a6defc7d2b6cb
-1969	2049	7297956396243405	event_groups.pbi	b0117a93bb36a613
-2025	2097	7297956396722127	fatfs_spi_flash.pbi	136dc5ca3a603cb2
-2098	2185	7297956397599790	ip4_frag.pbi	fa52477c77120ef4
-2032	2267	7297956398417925	dhcp.pbi	b7a2e42362c12d74
-2049	2292	7297956398666953	init.pbi	d7d0ed53ee5b1b04
-2267	2351	7297956399255352	ff.pbi	746ba546376bca75
-2185	2432	7297956400063484	api_lib.pbi	68c467c129312531
-2292	2444	7297956400202820	api_msg.pbi	dc19040cffd00b32
-2432	2495	7297956400711455	autoip.pbi	3410c31b7a185ef
-2444	2513	7297956400890983	croutine.pbi	65e3213de074fe6a
-2351	2540	7297956401150581	netbuf.pbi	9ab4d3c693ca250a
-2513	2587	7297956401619029	heap_4.pbi	b9206b44de15305a
-2495	2590	7297956401648955	icmp.pbi	311d772edbd9397b
-2540	2623	7297956401978361	ip4_addr.pbi	fa8625d39d6cb082
-2623	2688	7297956402626630	igmp.pbi	8d6da84d694b748a
-2587	2690	7297956402636313	err.pbi	28d27f8f02f32e8
-2688	2756	7297956403304525	port.pbi	6601f1f6b557096c
-2590	2760	7297956403354397	sockets.pbi	78e00629bb9c7bf3
-2691	2915	7297956404900264	at32f403a_407_crm.pbi	6fa79eb950f4b706
-2760	2997	7297956405728339	usbd_sdr.pbi	cf2767748e10e546
-2756	3000	7297956405757976	usbd_core.pbi	6af6afbab86fcb32
-2915	3137	7297956407124309	at32f403a_407_dma.pbi	7e15745d8abafda6
-2997	3216	7297956407912200	at32f403a_407_exint.pbi	cbed7cabbf9ec5a7
-3001	3231	7297956408052170	at32f403a_407_flash.pbi	4fc7bdbc164675f7
-3231	3453	7297956410281140	at32f403a_407_spi.pbi	f5ca126e2f323a13
-3138	3470	7297956410450976	system_at32f403a_407.pbi	19e6ed7ce1b70744
-3216	3545	7297956411198687	at32f403a_407_misc.pbi	1f69b6e4e023f2a4
-3454	3676	7297956412525429	at32f403a_407_usart.pbi	7125d76429ddf2f3
-3545	3764	7297956413393187	at32f403a_407_pwc.pbi	63a4cbfd4289eaec
-3470	3799	7297956413752148	at32f403a_407_acc.pbi	126e6f3827817e9b
-3765	3981	7297956415557330	at32f403a_407_wwdt.pbi	a015f9aae0617747
-3677	4006	7297956415806668	at32f403a_407_bpr.pbi	edf8d27acb087cdd
-3799	4131	7297956417053037	at32f403a_407_gpio.pbi	cb5a6e80c4e2495b
-3982	4206	7297956417801044	at32f403a_407_adc.pbi	26d55732a88d7716
-4007	4224	7297956417990821	at32f403a_407_rtc.pbi	bb60c2765c979541
-4131	4362	7297956419366851	at32f403a_407_usb.pbi	6f9753b218030889
-4206	4444	7297956420184655	usbd_int.pbi	7914595c1b5f0703
-4224	4469	7297956420443967	diskio.pbi	fafcfbb4f7d9bde3
-4363	4683	7297956422588233	at32f403a_407_clock.pbi	b74edcdffa8e942f
-4470	4687	7297956422628124	at32f403a_407_dac.pbi	8d8574a207e748b5
-4444	4775	7297956423495809	at32f403a_407_crc.pbi	5b132c0cf4795ec
-4683	4899	7297956424742813	at32f403a_407_debug.pbi	60e15a3c5c271d1
-4687	4902	7297956424772391	at32f403a_407_emac.pbi	13623b35ce3b9d28
-4776	5102	7297956426777030	at32f403a_407_i2c.pbi	6daa0ceb22ce5132
-4900	5229	7297956428033963	at32f403a_407_can.pbi	bb000e04e19c41fc
-4902	5236	7297956428113599	at32f403a_407_sdio.pbi	63ffb1ea9a33b2e0
-5103	5337	7297956429120761	at32f403a_407_tmr.pbi	8d3b78349c7a59be
-5229	5445	7297956430208159	at32f403a_407_wdt.pbi	4569f9aad239f2e1
-5236	5455	7297956430297615	at32f403a_407_xmc.pbi	8c76c728dbe71c11
-5338	5541	7297956431165046	raw.pbi	b4f1ea402c6aa49
-5456	5560	7297956431354246	sys_arch.pbi	f2f98e1ca4fb092b
-5445	5563	7297956431374195	tcp_out.pbi	c29c5c85e8c8e2d9
-5542	5624	7297956431982566	ip.pbi	590d4534c4de48ce
-5563	5657	7297956432321666	dnserver.pbi	8a5674ecbe3f754b
-5624	5732	7297956433069660	udp.pbi	d042359ae981f472
-5560	5752	7297956433269126	stats.pbi	1cd2e113e610096b
-5658	5907	7297956434815306	usbd_desc.pbi	2c944b8cdee0cd3a
-5732	5988	7297956435623128	mbascii.pbi	4047099935ec1868
-5752	6006	7297956435812325	mbutils.pbi	9a42e5292c78f9e6
-5907	6016	7297956435922323	tcp_in.pbi	62f7342b24edfe12
-5988	6085	7297956436600227	dhserver.pbi	96c90dfc96711b7e
-6086	6205	7297956437795589	pbuf.pbi	8f8fc39b0bf13e03
-6016	6272	7297956438473776	portother.pbi	c89f8859092ab559
-6006	6366	7297956439411563	mbfuncdisc.pbi	285c957261a71f43
-6205	6461	7297956440378681	mbfuncother.pbi	65dfbf0500f73e74
-6272	6529	7297956441037214	portserial.pbi	dd5007ac716e4d70
-6462	6555	7297956441296519	sys.pbi	4823310c615ee090
-6366	6615	7297956441904897	porttimer.pbi	ade7d59e369abaf
-6615	6646	7297956442213781	mbfuncdiag.pbi	18a7b177e0bc1978
-6529	6681	7297956442553159	memp.pbi	ba607d316d0db951
-6647	6777	7297956443520281	timeouts.pbi	1d773859698f8a01
-6555	6805	7297956443812212	portevent.pbi	83b38927de050926
-6777	6870	7297956444450803	ethernet.pbi	1c6c427f99926c56
-6681	6938	7297956445128692	usbd_rndis_core.pbi	7bdfd763e52c799d
-6938	7194	7297956447702108	mbfunccoils.pbi	44373c6841a8b18f
-6806	7230	7297956448041223	ethernetif.pbi	44aea922f181f569
-6870	7233	7297956448080799	mbfuncinput.pbi	5a46bb5ed3e0bd41
-7234	7345	7297956449197808	mem.pbi	5433c52f969448d6
-7230	7349	7297956449237712	tcp.pbi	7976241f5bcac0cc
-7194	7462	7297956450354714	mbfuncholding.pbi	2bf2b5bf9e0090fd
-7349	7469	7297956450474403	module_universal_io_part5.pbi	6d816445fbfc6fb3
-7345	7485	7297956450598360	netif.pbi	5010d8e60e2b8aef
-7462	7597	7297956451755569	module_universal_io_part6.pbi	2bb77ce825fc92e7
-7469	7694	7297956452693041	spi_common.pbi	7edea8c36d7b233
-7485	7707	7297956452812723	tim_delay.pbi	b60ecd4d830a00f4
-7598	7849	7297956454238911	utility.pbi	4d101e38d3b56fcf
-7695	7899	7297956454777475	module_universal_io_part8.pbi	a2f88113ee680f91
-7707	8089	7297956456672399	module_universal_io_part9.pbi	e3cc8b0a9040f459
-7849	8222	7297956458008532	module_universal_io_part2.pbi	862931efe843cc6d
-7900	8240	7297956458148168	rng.pbi	9a7548d1d0eb5a09
-8090	8322	7297956458975946	sys_hal.pbi	489f6613618d1494
-8240	8477	7297956460512145	usb.pbi	1b33831d424288a3
-8223	8484	7297956460581656	mbrtu.pbi	7177b5e6762babe5
-8322	8580	7297956461549366	sys_api.pbi	54cc67cfed8c5994
-8484	8703	7297956462776077	extended_sram.pbi	9821fdaf070f27e9
-8477	8824	7297956464012479	module_universal_io_part0.pbi	f87d4c2b3352baf6
-8824	8948	7297956465259142	module_universal_io_part7.pbi	6727895f771cda6d
-8581	9011	7297956465897436	module_universal_io_part1.pbi	aed75ce9e1cba842
-8704	9080	7297956466585884	module_universal_io_part3.pbi	2a68f3b760661c8e
-8948	9210	7297956467852521	mb.pbi	d15c48b15039d3b6
-9012	9227	7297956468051693	module_universal_io_part4.pbi	b32735e0d8bbebae
-9081	9303	7297956468780029	wdt.pbi	c15a4f0592fefe9d
-9210	9438	7297956470126417	at32f403a_407_board.pbi	4b58d009aa6f2679
-9227	9464	7297956470385734	mbcrc.pbi	548ab4bca39195af
-9438	9597	7297956471752120	module_universal_io_part11.pbi	94db0828f3123726
-9464	9860	7297956474374770	module_universal_io_part10.pbi	23f87e1291f5687b
-9860	10414	7297956479920653	module_universal_io.pbd	21a8effa42505154
-10415	12664	7297956502055781	module_universal_io.pbw	9bf63675a62b919d
-51	248	7297956589995507	hash.pbi	470f3df97f64da35
-248	587	7297956593406361	module_universal_io_part0.pbi	f87d4c2b3352baf6
-587	1153	7297956599070923	module_universal_io.pbd	21a8effa42505154
-1154	3405	7297956621238482	module_universal_io.pbw	9bf63675a62b919d
-50	320	7297956690613695	main.pbi	98f5ddcfa15fcbf9
-320	737	7297956694822389	module_universal_io_part1.pbi	aed75ce9e1cba842
-738	1307	7297956700526820	module_universal_io.pbd	21a8effa42505154
-1308	3557	7297956722662568	module_universal_io.pbw	9bf63675a62b919d
-50	323	7297962592236760	main.pbi	98f5ddcfa15fcbf9
-324	736	7297962596348668	module_universal_io_part1.pbi	aed75ce9e1cba842
-737	1288	7297962601904115	module_universal_io.pbd	21a8effa42505154
-1289	3538	7297962624060914	module_universal_io.pbw	9bf63675a62b919d
+57	312	7307486603796980	sys_api.pbi	54cc67cfed8c5994
+6795	7032	7307458201834091	sys_hal.pbi	489f6613618d1494
+7059	7223	7307458203758655	module_universal_io_part11.pbi	94db0828f3123726
+685	744	7307458138883566	at32_uid.pbi	4236b4da0e4ba3d4
+49	327	7307488161077416	settings_api.pbi	ecda1325133e721b
+327	750	7307488165344900	module_universal_io_part1.pbi	aed75ce9e1cba842
+751	1312	7307488170956608	module_universal_io.pbd	21a8effa42505154
+1312	3592	7307488193375368	module_universal_io.pbw	9bf63675a62b919d
+51	329	7307488698349262	settings_api.pbi	ecda1325133e721b
+329	750	7307488702548865	module_universal_io_part1.pbi	aed75ce9e1cba842
+751	1313	7307488708147357	module_universal_io.pbd	21a8effa42505154
+1314	3595	7307488730648901	module_universal_io.pbw	9bf63675a62b919d
+51	331	7307488986347358	settings_api.pbi	ecda1325133e721b
+331	757	7307488990648509	module_universal_io_part1.pbi	aed75ce9e1cba842
+758	1319	7307488996307971	module_universal_io.pbd	21a8effa42505154
+1320	3607	7307489018747911	module_universal_io.pbw	9bf63675a62b919d

BIN
project/ewarm/Debug/Obj/input.o


BIN
project/ewarm/Debug/Obj/input.pbi


BIN
project/ewarm/Debug/Obj/io.o


BIN
project/ewarm/Debug/Obj/io.pbi


BIN
project/ewarm/Debug/Obj/main.o


BIN
project/ewarm/Debug/Obj/main.pbi


BIN
project/ewarm/Debug/Obj/modbus.o


BIN
project/ewarm/Debug/Obj/modbus.pbi


BIN
project/ewarm/Debug/Obj/modbus_params.o


BIN
project/ewarm/Debug/Obj/modbus_params.pbi


BIN
project/ewarm/Debug/Obj/module_universal_io.pbd


BIN
project/ewarm/Debug/Obj/module_universal_io.pbd.browse


File diff suppressed because it is too large
+ 1238 - 2540
project/ewarm/Debug/Obj/module_universal_io.pbw


BIN
project/ewarm/Debug/Obj/module_universal_io_part0.pbi


BIN
project/ewarm/Debug/Obj/module_universal_io_part1.pbi


BIN
project/ewarm/Debug/Obj/module_universal_io_part10.pbi


File diff suppressed because it is too large
+ 433 - 433
project/ewarm/iap/iap.dep


File diff suppressed because it is too large
+ 877 - 877
project/ewarm/module_universal_io.dep


File diff suppressed because it is too large
+ 0 - 0
project/ewarm/settings/module_universal_io.dbgdt


+ 22 - 12
project/ewarm/settings/module_universal_io.dnx

@@ -4,10 +4,10 @@
         <JetConnSerialNo>AT-Link-EZ(WinUSB) CMSIS-DAP:0</JetConnSerialNo>
         <JetConnFoundProbes>AT-Link-EZ CMSIS-DAP:C09A50320000B32905179402:AT-Link-EZ(WinUSB) CMSIS-DAP:0:</JetConnFoundProbes>
         <PrevWtdReset>Connect during reset</PrevWtdReset>
-        <OnlineReset>Software</OnlineReset>
         <DisableInterrupts>0</DisableInterrupts>
         <LeaveRunning>0</LeaveRunning>
         <MultiCoreRunAll>0</MultiCoreRunAll>
+        <OnlineReset>Software</OnlineReset>
     </Jet>
     <PlDriver>
         <FirstRun>0</FirstRun>
@@ -31,8 +31,8 @@
     <SWOManager>
         <SamplingDivider>8192</SamplingDivider>
         <OverrideClock>0</OverrideClock>
-        <CpuClock>1195593261</CpuClock>
-        <SwoClock>1547322144</SwoClock>
+        <CpuClock>1600416118</CpuClock>
+        <SwoClock>1681273904</SwoClock>
         <DataLogMode>0</DataLogMode>
         <ItmPortsEnabled>63</ItmPortsEnabled>
         <ItmTermIOPorts>1</ItmTermIOPorts>
@@ -45,7 +45,7 @@
         <EnableCache>1</EnableCache>
     </ArmDriver>
     <DebugChecksum>
-        <Checksum>981981315</Checksum>
+        <Checksum>2417507697</Checksum>
     </DebugChecksum>
     <CallStack>
         <ShowArgs>0</ShowArgs>
@@ -53,6 +53,15 @@
     <Disassembly>
         <MixedMode>1</MixedMode>
     </Disassembly>
+    <struct_types>
+        <Fmt0>settings_t-control_word	3	0</Fmt0>
+        <Fmt1>settings_t-critical_section_crc	4	0</Fmt1>
+        <Fmt2>settings_t-settings_version	4	0</Fmt2>
+    </struct_types>
+    <watch_formats>
+        <Fmt0>{W}1:loadCRC	4	0</Fmt0>
+        <Fmt1>{W}1:newCRC	4	0</Fmt1>
+    </watch_formats>
     <Trace1>
         <Enabled>0</Enabled>
         <ShowSource>1</ShowSource>
@@ -83,6 +92,15 @@
         <EventLSU>0</EventLSU>
         <EventSLEEP>0</EventSLEEP>
     </SWOTraceWindow>
+    <DisassembleMode>
+        <mode>0</mode>
+    </DisassembleMode>
+    <Breakpoints2>
+        <Bp0>_ 0 "EMUL_CODE" "{$PROJ_DIR$\..\..\libs\thirdparty\lwip_2.1.2\src\core\init.c}.350.3" 0 0 1 "" 0 "" 0</Bp0>
+        <Bp1>_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\..\fw\modules\modbus\modbus.c}.88.13" 0 0 1 "" 0 "" 0</Bp1>
+        <Bp2>_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\..\fw\modules\settings\settings_api.c}.44.5" 0 0 1 "" 0 "" 0</Bp2>
+        <Count>3</Count>
+    </Breakpoints2>
     <TermIOLog>
         <LoggingEnabled>_ 0</LoggingEnabled>
         <LogFile>_ ""</LogFile>
@@ -92,14 +110,6 @@
         <LogFile>_ ""</LogFile>
         <Category>_ 0</Category>
     </LogFile>
-    <DisassembleMode>
-        <mode>0</mode>
-    </DisassembleMode>
-    <Breakpoints2>
-        <Bp0>_ 0 "EMUL_CODE" "{$PROJ_DIR$\..\..\libs\thirdparty\lwip_2.1.2\src\core\init.c}.350.3" 0 0 1 "" 0 "" 0</Bp0>
-        <Bp1>_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\..\fw\modules\modbus\modbus.c}.88.13" 0 0 1 "" 0 "" 0</Bp1>
-        <Count>2</Count>
-    </Breakpoints2>
     <Aliases>
         <Count>0</Count>
         <SuppressDialog>0</SuppressDialog>

File diff suppressed because it is too large
+ 3 - 2
project/ewarm/settings/module_universal_io.wsdt


+ 42 - 105
shared/sys/sys_api.c

@@ -5,101 +5,36 @@
 #include "common_config.h"
 #include "common.h"
 #include <string.h>
-#ifdef PRINTF_STDLIB
 #include <stdio.h>
-#endif
-#ifdef PRINTF_CUSTOM
-#include "tinystdio.h"
-#endif
 
 
-// Backup old style device mac and serial
-// TODO Remove when all old devices will be updated
-#define BACKUP_OLD_SYS
 
+//static bool backup_done = false;
 
-static char mac_backup[MAC_LEN];
-static char serial_backup[MAC_LEN];
-static bool backup_done = false;
 
-
-#ifdef BACKUP_OLD_SYS
-bool SYS_BackupInfo(char *mac, char *serial) {
-	snprintf(mac_backup, MAC_LEN, mac);
-	snprintf(serial_backup, SER_LEN, serial);
-	backup_done = true;
-
-	return backup_done;
-}
-
-
-bool SYS_RestoreInfo(SYS_t *settings) {
-	if (backup_done) {
-		snprintf(settings->mac, MAC_LEN, mac_backup);
-		snprintf(settings->serial, SER_LEN, serial_backup);
-		return true;
-	}
-
-	return false;
-}
-#endif
-
-bool SYS_SetDefault(SYS_t *settings) 
+//
+bool sys_set_default(sys_settings_t *settings) 
 {
-	if (!settings)
-		return false;
-
-#ifdef BACKUP_OLD_SYS
-	// Try to backup device MAC and serial.
-    if (sSettings.CritSecCRC == SETTINGS_GetCritSecCRC()) 
-    {
-        if (SYS_BackupInfo(sSettings.sInfo.mac, sSettings.sInfo.serialNumber)) 
-        {
-            SDBG printf("Sys info backupped\r\n");
-            SDBG printf("MAC: %s\r\n", sSettings.sInfo.mac);
-            SDBG printf("Serial: %s\r\n", sSettings.sInfo.serialNumber);
-        }
-        else {
-            SDBG printf("Sys info back up error!\r\n");
-        }
-    }
-
-	// Try to restore device MAC and serial.
-	// If not, store defaults
-	if (!SYS_RestoreInfo(settings)) 
-    {
-		snprintf(settings->mac, MAC_LEN, SYS_MAC);
-		snprintf(settings->serial, SER_LEN, SYS_SERIAL);
-		SDBG printf("Sys info restore error! Defaults used.\r\n");
-	}
-	else {
-		SDBG printf("Sys info restored!\r\n");
-	}
-#endif
-
-	snprintf(settings->customer, CUST_LEN, SYS_CUSTOMER);
-	snprintf(settings->proddate, PROD_LEN, "00.00.00");
-	memset(settings->testState, 0, 16);
-	settings->controlword = SETTINGS_CONTROL_WORD;
+    settings->model = 0;
+    memcpy(settings->sn, SN_DEFAULT, SN_LEN);
+	snprintf(settings->prod_date, PROD_LEN, "00.00.00");
+	memset(settings->test_state, 0, TS_LEN);
+	settings->control_word = SETTINGS_CONTROL_WORD;
 
+    settings->crc = SYS_GetCRC(settings);
+    
 	return true;
 }
 
-/**
-  * @brief
-  * @retval
-  */
-uint32_t SYS_GetCRC(SYS_t *settings)
+//
+uint32_t SYS_GetCRC(sys_settings_t *settings)
 {
     crc_data_reset();
     return crc_block_calculate((uint32_t *)settings, sizeof(*settings)/4 - 1);
 }
 
-
-/**
-  * @brief  Загрузка структуры системных настроек из flash
-  */
-bool SYS_Load(SYS_t *settings)
+//
+bool sys_settings_load(sys_settings_t *settings)
 {
     uint32_t loadCRC;  // CRC из flash
     uint32_t newCRC;   // CRC загруженной структуры настроек
@@ -119,34 +54,31 @@ bool SYS_Load(SYS_t *settings)
     // Если CRC не совпадают нужно прошивать дефолтные настройки
     if (loadCRC != newCRC)
     {
-        SDBG printf("Bad system sector CRC. Factory defaults restored.\r\n");
+        printf("Bad system sector CRC. Factory defaults restored.\r\n");
         need_default = true;
     }
     // CRC совпала, проверяем контрольное слово если слово не совпадает
 	// то это значит, что поплыла структура нстроек, прошиваем дефолт */
-    else if (settings->controlword != SETTINGS_CONTROL_WORD)
+    else if (settings->control_word != SETTINGS_CONTROL_WORD)
     {
-        SDBG printf("Bad system sector control word. Factory defaults restored.\r\n");
+        printf("Bad system sector control word. Factory defaults restored.\r\n");
         need_default = true;
     }
 
     // Прошиваем дефолтные настройки если нужно
     if (need_default) 
     {
-        SYS_SetDefault(settings);
-        SYS_Save(settings);
+        sys_set_default(settings);
+        sys_save(settings);
     }
 
-    SDBG SYS_Print(settings);
+    sys_print(settings);
 
     return true;
 }
 
-
-/**
-  * @brief  Запись структуры настроек во flash
-  */
-bool SYS_Save(SYS_t *settings)
+// Запись структуры настроек во flash
+bool sys_save(sys_settings_t *settings)
 {
 	uint32_t crc_user = 0;
 
@@ -160,34 +92,39 @@ bool SYS_Save(SYS_t *settings)
 	return true;
 }
 
-
 //
-void SYS_Print(SYS_t *settings)
+void sys_print(sys_settings_t *settings)
 {
-    printf("\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
-    printf("   Системные настройки");
-    printf("\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\n");
+    char str[20];
     
-    printf("\tMAC: ");
-    printf("%s\r\n", settings->mac);
+    printf("\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
+    printf("   Системные настройки:");
     
-    printf("\tСерийный номер: ");
-    printf("%s\r\n", settings->serial);
+    printf("\tМодель: ");
+    printf("%u\r\n", settings->model);
     
-    printf("\tПроизводитель: ");
-    printf("%s\r\n", settings->customer);
+    memset(str, 0, 20);
+    memcpy(str, settings->sn, SN_LEN);
+    printf("\tСерийный номер: %s\r\n", str);
     
     printf("\tДата производства: ");
-    printf("%s\r\n", settings->proddate);
+    printf("%s\r\n", settings->prod_date);
     
     printf("\tСтатус тестирования: ");
-    printf("%s\r\n", settings->testState);
+    printf("%s\r\n", settings->test_state);
     
     printf("\tКонтрольное слово: ");
-    printf("%u\r\n", settings->testState);
+    printf("%u\r\n", settings->control_word);
     
     printf("\tCRC: ");
-    printf("%X\r\n", settings->testState);
+    printf("%X\r\n", settings->crc);
 }
 
+// Очистить сектор системных настроек
+void sys_clear(void)
+{
+    flash_unlock();
+    SYS_EraseFlashSector();
+    flash_lock();
+}
 

+ 19 - 35
shared/sys/sys_api.h

@@ -1,64 +1,48 @@
-/*
- * sys_api.h
- *
- *  Created on: 12.03.2017
- *      Author: jesstr
- */
-
 #ifndef SYS_API_H_
 #define SYS_API_H_
 
 #include <stdbool.h>
 #include <stdint.h>
 
-#ifndef DEVICE_MAC
-#define DEVICE_MAC "EC-4C-4D-00-90-01"
-#endif
-
-#ifndef DEVICE_SERIAL
-#define DEVICE_SERIAL   "7030000"
-#endif
-
 
-#define SYS_MAC 		DEVICE_MAC
-#define SYS_SERIAL 		DEVICE_SERIAL
-#define SYS_CUSTOMER 	"Rotek"
+#define SN_LEN		        7
+#define PROD_LEN	        20
+#define TS_LEN              16  // Статус тестирования
 
-
-#define MAC_LEN		18
-#define SER_LEN		16
-#define CUST_LEN	16
-#define PROD_LEN	20
+#define SN_DEFAULT          "0000001"
 
 
 // Cтруктура системных настроек
 typedef struct
 {
-    char mac[MAC_LEN];          // MAC адрес
-    char serial[SER_LEN];       // Серийный номер
-    char customer[CUST_LEN];    // Производитель
-    char proddate[PROD_LEN];	// Дата производства
-    char testState[16];         // Статус тестирования
-    uint32_t controlword;       // Контрольное слово
+    uint16_t model;			    // Модель
+    char sn[SN_LEN];            // Серийный номер
+    char prod_date[PROD_LEN];	// Дата производства
+    char test_state[TS_LEN];    // Статус тестирования
+    uint32_t control_word;      // Контрольное слово
     uint32_t crc;               // CRC
-} SYS_t;
+    
+} sys_settings_t;
+
 
 
 bool SYS_BackupInfo(char *mac, char *serial);
 
-bool SYS_RestoreInfo(SYS_t *settings);
+bool SYS_RestoreInfo(sys_settings_t *settings);
 
 //
-uint32_t SYS_GetCRC(SYS_t *settings);
+uint32_t SYS_GetCRC(sys_settings_t *settings);
 
 // Загрузка структуры системных настроек из flash
-bool SYS_Load(SYS_t *settings);
+bool sys_settings_load(sys_settings_t *settings);
 
 // Запись структуры настроек во flash
-bool SYS_Save(SYS_t *settings);
+bool sys_save(sys_settings_t *settings);
 
 //
-void SYS_Print(SYS_t *settings);
+void sys_print(sys_settings_t *settings);
 
+// Очистить сектор системных настроек
+void sys_clear(void);
 
 #endif /* SYS_API_H_ */

+ 3 - 8
shared/sys/sys_hal.c

@@ -3,13 +3,8 @@
 #include "sys_api.h"
 #include "common_config.h"
 #include "common.h"
-//#include "hal.h"
-#ifdef PRINTF_STDLIB
 #include <stdio.h>
-#endif
-#ifdef PRINTF_CUSTOM
-#include "tinystdio.h"
-#endif
+
 
 /**
   * @brief
@@ -52,7 +47,7 @@ void SYS_WriteToFlash(uint8_t *data, uint32_t size, uint32_t crc)
         flash_lock();
 
 
-        checkCrc = SYS_GetCRC((SYS_t *)SYS_SECTOR);
+        checkCrc = SYS_GetCRC((sys_settings_t *)SYS_SECTOR);
 
         // Проверяем  CRC того, что было записано
         if (checkCrc == crc) {
@@ -79,6 +74,6 @@ void SYS_EraseFlashSector(void)
     flash_status_type status;
    
     if ((status = flash_sector_erase(SYS_SECTOR)) != FLASH_OPERATE_DONE) {
-        SDBG printf("SYS_EraseFlashSector error: %d\r\n", status);
+        printf("SYS_EraseFlashSector error: %d\r\n", status);
     }
 }

Some files were not shown because too many files changed in this diff