This commit is contained in:
parent
4b48ae5c02
commit
7ccb708e82
|
@ -18,6 +18,7 @@ void BootConfig::Init()
|
||||||
|
|
||||||
Stat.HasApp = 0; // 没有APP位置固件
|
Stat.HasApp = 0; // 没有APP位置固件
|
||||||
Stat.NeedUpDate = 0; // 不需要升级
|
Stat.NeedUpDate = 0; // 不需要升级
|
||||||
|
Stat.SearchPinCfg = 1; // 默认搜索引脚配置固件 PinCfg
|
||||||
|
|
||||||
App.WorkeAddr = 0x8010000; // 64KB位置
|
App.WorkeAddr = 0x8010000; // 64KB位置
|
||||||
App.Depositary = 0x8010000; // 64KB位置
|
App.Depositary = 0x8010000; // 64KB位置
|
||||||
|
@ -36,6 +37,13 @@ BootConfig * BootConfig::Create()
|
||||||
return &bc;
|
return &bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BootConfig::Show() const
|
||||||
|
{
|
||||||
|
debug_printf("BootConfig HasApp %d NeedUpData %d SearchPinCfg %d\r\n", Stat.HasApp, Stat.NeedUpDate, Stat.SearchPinCfg);
|
||||||
|
debug_printf("WorkeAddr 0x%08X Length 0x%08X Depositary 0x%08X Checksum 0x%08X\r\n", App.WorkeAddr, App.Length, App.Depositary, App.Checksum);
|
||||||
|
debug_printf("UpdateAddr 0x%08X Length 0x%08X Depositary 0x%08X Checksum 0x%08X\r\n", Update.WorkeAddr, Update.Length, Update.Depositary, Update.Checksum);
|
||||||
|
}
|
||||||
|
|
||||||
/****************** PinConfig ********************/
|
/****************** PinConfig ********************/
|
||||||
|
|
||||||
PinConfig* PinConfig::Current = nullptr;
|
PinConfig* PinConfig::Current = nullptr;
|
||||||
|
@ -66,3 +74,17 @@ PinConfig * PinConfig::Create()
|
||||||
|
|
||||||
return &pc;
|
return &pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PinConfig::Show() const
|
||||||
|
{
|
||||||
|
debug_printf("PinConfig\r\n");
|
||||||
|
if (IsEff)
|
||||||
|
{
|
||||||
|
debug_printf("MsgPort COM%d BaudRate %d\r\n", AllPin.MsgPort+1,AllPin.MsgPortBaudRate);
|
||||||
|
debug_printf("W5500 SPI%d \r\n",AllPin.W5500._spi+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug_printf("Pins is Not Eff !! \r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ typedef struct
|
||||||
{
|
{
|
||||||
uint HasApp : 1; // 有可运行APP
|
uint HasApp : 1; // 有可运行APP
|
||||||
uint NeedUpDate : 1; // 需要跟新
|
uint NeedUpDate : 1; // 需要跟新
|
||||||
uint Reserved : 30; // 保留
|
uint SearchPinCfg : 1; // 搜索 PinCfg 固件
|
||||||
|
uint Reserved : 29; // 保留
|
||||||
}BootStat;
|
}BootStat;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -37,6 +38,7 @@ public:
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
// virtual void Load();
|
// virtual void Load();
|
||||||
// virtual void Save()const;
|
// virtual void Save()const;
|
||||||
|
virtual void Show() const;
|
||||||
|
|
||||||
static BootConfig* Current;
|
static BootConfig* Current;
|
||||||
static BootConfig* Create();
|
static BootConfig* Create();
|
||||||
|
@ -71,6 +73,8 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
COM MsgPort;
|
||||||
|
int MsgPortBaudRate;
|
||||||
W5500Pin W5500;
|
W5500Pin W5500;
|
||||||
NRFPin Nrf;
|
NRFPin Nrf;
|
||||||
Pin UserKey1; // 默认重启
|
Pin UserKey1; // 默认重启
|
||||||
|
@ -85,13 +89,14 @@ class PinConfig : public ConfigBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PINS AllPin;
|
PINS AllPin;
|
||||||
uint IsEff;
|
uint IsEff; // 有效的
|
||||||
byte TagEnd; // 数据区结束标识符
|
byte TagEnd; // 数据区结束标识符
|
||||||
|
|
||||||
PinConfig();
|
PinConfig();
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
// virtual void Load();
|
// virtual void Load();
|
||||||
// virtual void Save()const;
|
// virtual void Save()const;
|
||||||
|
virtual void Show() const;
|
||||||
|
|
||||||
static PinConfig* Current;
|
static PinConfig* Current;
|
||||||
static PinConfig* Create();
|
static PinConfig* Create();
|
||||||
|
|
2
Sys.cpp
2
Sys.cpp
|
@ -11,7 +11,7 @@ const TTime Time;
|
||||||
#if defined(BOOT) || defined(APP)
|
#if defined(BOOT) || defined(APP)
|
||||||
|
|
||||||
//#pragma location = 0x20000000
|
//#pragma location = 0x20000000
|
||||||
struct BootCofig StrBoot __attribute__((at(0x2000fff0)));
|
struct HandlerRemap StrBoot __attribute__((at(0x2000fff0)));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
4
Sys.h
4
Sys.h
|
@ -50,14 +50,14 @@ void assert_failed2(const char* msg, const char* file, unsigned int line);
|
||||||
#include "Delegate.h"
|
#include "Delegate.h"
|
||||||
|
|
||||||
#if defined(BOOT) || defined(APP)
|
#if defined(BOOT) || defined(APP)
|
||||||
struct BootCofig
|
struct HandlerRemap
|
||||||
{
|
{
|
||||||
Func pUserHandler;
|
Func pUserHandler;
|
||||||
void* Reserved1;
|
void* Reserved1;
|
||||||
void* Reserved2;
|
void* Reserved2;
|
||||||
void* Reserved3;
|
void* Reserved3;
|
||||||
};
|
};
|
||||||
extern struct BootCofig StrBoot;
|
extern struct HandlerRemap StrBoot;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 判定指针是否在ROM区
|
// 判定指针是否在ROM区
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
|
|
||||||
#include "App\FlushPort.h"
|
#include "App\FlushPort.h"
|
||||||
|
|
||||||
#if defined(APP)
|
|
||||||
#include "BootConfig.h"
|
#include "BootConfig.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ShunCom_Master 0
|
#define ShunCom_Master 0
|
||||||
|
|
||||||
|
@ -190,7 +189,7 @@ void Token::Setup(ushort code, const char* name, COM message, int baudRate)
|
||||||
#if defined(APP)
|
#if defined(APP)
|
||||||
// 把引脚放进 Boot区 的 PinConfig 内
|
// 把引脚放进 Boot区 的 PinConfig 内
|
||||||
Flash flash;
|
Flash flash;
|
||||||
uint bootCfgAddr = 0x8010000 - 1 << 10; // 63K位置
|
const uint bootCfgAddr = 0x800fc00; // 63K位置
|
||||||
Config Cfg(flash,bootCfgAddr,sizeof(PinConfig));
|
Config Cfg(flash,bootCfgAddr,sizeof(PinConfig));
|
||||||
Config::Current = &Cfg;
|
Config::Current = &Cfg;
|
||||||
static PinConfig pinCfg;
|
static PinConfig pinCfg;
|
||||||
|
|
Loading…
Reference in New Issue