|
@@ -3,117 +3,56 @@
|
|
|
|
|
|
|
|
#include "stdint.h"
|
|
#include "stdint.h"
|
|
|
|
|
|
|
|
-#define TRIPHASIC 0
|
|
|
|
|
-#define SINGLE 0
|
|
|
|
|
-
|
|
|
|
|
-#define MD_BASE_Addr (1500)
|
|
|
|
|
-
|
|
|
|
|
-#define MD_STATUS_Addr 1
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#define MD_WRITE_Addr 50
|
|
|
|
|
-
|
|
|
|
|
-#define MD_READ_STATUS (MD_BASE_Addr + MD_STATUS_Addr)
|
|
|
|
|
-#define MD_WRIE_DATA (MD_BASE_Addr+MD_WRITE_Addr)
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define BOOT_LOADER ((uint32_t)(0x08000000)) //boot loadr addr
|
|
#define BOOT_LOADER ((uint32_t)(0x08000000)) //boot loadr addr
|
|
|
-#define BOOT_LOADER_SIZE (20*1024) //boot loade size
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#define META_DATA ((uint32_t)(0x08005000)) //meta data addr
|
|
|
|
|
-#define META_DATA_SIZE (1*1024) //meta data size
|
|
|
|
|
|
|
+#define BOOT_LOADER_SIZE (20*1024) //boot loade size
|
|
|
|
|
|
|
|
-#define PROGRAME_APP1 ((uint32_t)(0x08005400)) //App1 Rom Start addr
|
|
|
|
|
-#define PROGRAME_APP1_SIZE (20*1024) //App1 programe Max size
|
|
|
|
|
|
|
|
|
|
-#define PROGRAME_APP2 ((uint32_t)(0x0800A400)) //App2 Rom Start addr
|
|
|
|
|
-#define PROGRAME_APP2_SIZE (20*1024) //App2 programe Max size
|
|
|
|
|
|
|
+#define META_DATA ((uint32_t)(0x08005000)) //meta data addr
|
|
|
|
|
+#define META_DATA_SIZE (1*1024) //meta data size
|
|
|
|
|
|
|
|
-#define PARTITION 1
|
|
|
|
|
-#define VERSION "V1.0.0.0"
|
|
|
|
|
|
|
|
|
|
-#define MODBUS_HEAD "GOWONE_UPGRADE"
|
|
|
|
|
|
|
+#define PROGRAME_APP1 ((uint32_t)(0x08005400)) //App1 Rom Start addr
|
|
|
|
|
+#define PROGRAME_APP1_SIZE (50*1024) //App1 programe Max size
|
|
|
|
|
|
|
|
-#define MB_Boot_Loader_Version_Addr 1
|
|
|
|
|
-#define MB_Boot_APP1_Version 2
|
|
|
|
|
-#define MB_Boot_APP2_Version 3
|
|
|
|
|
|
|
|
|
|
-#define MB_default_Start_Area 4 //defalut start and defalut app1
|
|
|
|
|
|
|
+#define PROGRAME_APP2 ((uint32_t)(0x08011C00)) //App2 Rom Start addr
|
|
|
|
|
+#define PROGRAME_APP2_SIZE (50*1024) //App2 programe Max size
|
|
|
|
|
|
|
|
-#define MB_Last_Running_Area 5
|
|
|
|
|
-#define MB_Last_Running_Error 6 //running error number
|
|
|
|
|
-#define MB_Upload_Status 7
|
|
|
|
|
-#define MB_APP1_CRC 8
|
|
|
|
|
-#define MB_APP2_CRC 9
|
|
|
|
|
|
|
+#define VERSION "V1.0.0.0"
|
|
|
|
|
|
|
|
|
|
+#define MODBUS_HEAD "GOWONE_UPGRADE"
|
|
|
|
|
|
|
|
|
|
+#define PARTITION (1) //upgrade patition
|
|
|
|
|
+#define PAGE_SIZE (1024)
|
|
|
|
|
|
|
|
-#define MB_Upload_Area 30
|
|
|
|
|
|
|
|
|
|
-#define MB_META_DATA_Addr 31
|
|
|
|
|
-#define MB_META_DATA_Addr_BytN 20
|
|
|
|
|
|
|
|
|
|
-#define MB_Recive_Data 32
|
|
|
|
|
-#define MB_Recive_Over 33
|
|
|
|
|
|
|
+#define UPGRADE_FLAG_ADDR (META_DATA )
|
|
|
|
|
+#define STARTUP_PARTATION (META_DATA + 4 ) //Start area
|
|
|
|
|
+#define STARTUP_ERROR (META_DATA + 8 ) //The most recent error code
|
|
|
|
|
+#define STARTUP_NUMBEAR (META_DATA + 12) //the count of fataly error
|
|
|
|
|
+#define STARTUP_ROM_ADDR (META_DATA + 16)
|
|
|
|
|
+#define STARTUP_LAST_RUNNING_TIME (META_DATA + 20) //
|
|
|
|
|
+#define STARTUP_APP_VERSION (META_DATA + 24) //
|
|
|
|
|
|
|
|
-#define MB_Start_Area 34
|
|
|
|
|
|
|
|
|
|
|
|
+#define APP1_VERSION (META_DATA + 28)
|
|
|
|
|
+#define APP1_ROM_ADDR (META_DATA + 32)
|
|
|
|
|
+#define APP1_PARTATION (META_DATA + 36)
|
|
|
|
|
|
|
|
-#define BOOT_Version (MD_BASE_Addr + MB_Boot_Loader_Version_Addr)
|
|
|
|
|
-#define BOOT_APP1_Version (MD_BASE_Addr + MB_Boot_APP1_Version)
|
|
|
|
|
-#define BOOT_APP2_Version (MD_BASE_Addr + MB_Boot_APP2_Version)
|
|
|
|
|
|
|
+#define APP2_VERSION (META_DATA + 40)
|
|
|
|
|
+#define APP2_ROM_ADDR (META_DATA + 44)
|
|
|
|
|
+#define APP2_PARTATION (META_DATA + 48)
|
|
|
|
|
|
|
|
-#define BOOT_Last_Running_Area (MD_BASE_Addr + MB_Last_Running_Area)
|
|
|
|
|
-#define BOOT_Last_Running_Error (MD_BASE_Addr + MB_Last_Running_Error)
|
|
|
|
|
|
|
|
|
|
-#define BOOT_Upload_Status (MD_BASE_Addr + MB_Upload_Status)
|
|
|
|
|
-#define BOOT_APP1_CRC (MD_BASE_Addr + MB_APP1_CRC)
|
|
|
|
|
-#define BOOT_APP2_CRC (MD_BASE_Addr + MB_APP2_CRC)
|
|
|
|
|
|
|
|
|
|
|
|
+#define UNIQU_1 0x1FFFF7AC
|
|
|
|
|
+#define UNIQU_2 0x1FFFF7B0
|
|
|
|
|
+#define UNIQU_3 0x1FFFF7B4
|
|
|
|
|
|
|
|
|
|
|
|
|
-#define BOOT_Upload_Area (MD_BASE_Addr + MB_Upload_Area)
|
|
|
|
|
-#define BOOT_META_DATA (MD_BASE_Addr + MB_META_DATA_Addr)
|
|
|
|
|
-#define BOOT_Recive_Data (MD_BASE_Addr + MB_Recive_Data)
|
|
|
|
|
-#define BOOT_Recive_Over (MD_BASE_Addr + MB_Recive_Over)
|
|
|
|
|
-#define BOOT_Start_Area (MD_BASE_Addr + MB_Start_Area)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#define MAX_LENTH (128)
|
|
|
|
|
-#define Mb_Wcmd_Width 16
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#define NOERROR 0
|
|
|
|
|
-#define MAX_ERROR_COUNT 2
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#define ERROR_VERSION 0xFFFFFFFF
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-typedef struct {
|
|
|
|
|
- int index;
|
|
|
|
|
- uint16_t lenth;
|
|
|
|
|
- uint8_t recive[MAX_LENTH];
|
|
|
|
|
-}Flash_Data;
|
|
|
|
|
-
|
|
|
|
|
-typedef struct
|
|
|
|
|
-{
|
|
|
|
|
- uint8_t flag;
|
|
|
|
|
- uint16_t base_addr;
|
|
|
|
|
- Flash_Data flash_Data;
|
|
|
|
|
-}MD_DATA;
|
|
|
|
|
-
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
|
uint32_t operation_flag; // 0
|
|
uint32_t operation_flag; // 0
|
|
|
uint32_t partition; // 1
|
|
uint32_t partition; // 1
|
|
@@ -131,13 +70,14 @@ typedef struct {
|
|
|
}META_DATA_S;
|
|
}META_DATA_S;
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-typedef struct g_MD_Data{
|
|
|
|
|
- uint8_t count;
|
|
|
|
|
- MD_DATA data[Mb_Wcmd_Width];
|
|
|
|
|
-}g_MD_Data;
|
|
|
|
|
-
|
|
|
|
|
-g_MD_Data* get_md_data();
|
|
|
|
|
|
|
+typedef struct {
|
|
|
|
|
+ uint32_t uniq_ID_64_95;
|
|
|
|
|
+ uint32_t uniq_ID_32_63;
|
|
|
|
|
+ uint32_t uniq_ID_00_31;
|
|
|
|
|
+ int channels;
|
|
|
|
|
+ char ver[8];
|
|
|
|
|
+ char date[20];
|
|
|
|
|
+}information_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|