!!!热存储区恰巧使用了系统堆栈避开的64字节,当数据区大于一定字节数时,就会导致热存储区末端超出内存RAM边界,从而导致崩溃。

暂时把它改为256字节,尚未找到一劳永逸的解决办法。
This commit is contained in:
大石头 2017-07-09 09:33:40 +08:00
parent fb91451698
commit 2a374f6004
4 changed files with 12 additions and 6 deletions

View File

@ -393,7 +393,13 @@ const Config& Config::CreateRAM()
{ {
// 最后一块作为配置区 // 最后一块作为配置区
static CharStorage cs; static CharStorage cs;
static Config cfg(cs, Sys.StackTop(), 64); static Config cfg(cs, Sys.StackTop(), 256);
/*// 从堆申请一块内存
if (cfg.Size == 0) {
cfg.Address = (uint)new byte[256];
cfg.Size = 256;
}*/
return cfg; return cfg;
} }

View File

@ -89,7 +89,7 @@ void TSys::ShowInfo() const
debug_printf("Time : "); debug_printf("Time : ");
DateTime::Now().Show(false); DateTime::Now().Show(false);
debug_printf(" Start: %d/%d \r\n", HotStart, StartTimes); debug_printf(" Start: %d/%d \r\n", HotStart, StartTimes);
debug_printf("Support: http://www.WsLink.cn\r\n"); //debug_printf("Support: http://www.WsLink.cn\r\n");
debug_printf("\r\n"); debug_printf("\r\n");
#endif #endif

View File

@ -124,7 +124,7 @@ INROOT bool Task::CheckTime(UInt64 end, bool isSleep)
// 全局任务调度器 // 全局任务调度器
TaskScheduler* Task::Scheduler() TaskScheduler* Task::Scheduler()
{ {
static TaskScheduler _sc("Sys"); static TaskScheduler _sc("Task");
return &_sc; return &_sc;
} }
@ -256,7 +256,7 @@ uint TaskScheduler::Add(Action func, void* param, int dueTime, int period, cstri
Count++; Count++;
#if DEBUG #if DEBUG
debug_printf("%s::添加%d %s First=%dms Period=%dms 0x%p\r\n", Name, task->ID, name, dueTime, period, func); debug_printf("%s::Add%d %s First=%dms Period=%dms 0x%p\r\n", Name, task->ID, name, dueTime, period, func);
#endif #endif
return task->ID; return task->ID;
@ -271,7 +271,7 @@ void TaskScheduler::Remove(uint taskid)
auto task = (Task*)_Tasks[i]; auto task = (Task*)_Tasks[i];
if(task->ID == taskid) if(task->ID == taskid)
{ {
debug_printf("%s::删除%d %s 0x%p\r\n", Name, task->ID, task->Name, task->Callback); debug_printf("%s::Remove%d %s 0x%p\r\n", Name, task->ID, task->Name, task->Callback);
// 清零ID实现重用 // 清零ID实现重用
task->ID = 0; task->ID = 0;

View File

@ -177,7 +177,7 @@ uint TSys::HeapBase() const
// 栈顶,后面是初始化不清零区域 // 栈顶,后面是初始化不清零区域
uint TSys::StackTop() const uint TSys::StackTop() const
{ {
return SRAM_BASE + (RAMSize << 10) - 0x40; return SRAM_BASE + (RAMSize << 10) - 0x100;
} }
void TSys::SetStackTop(uint addr) void TSys::SetStackTop(uint addr)