修改进程内存位置
启用mpu内存保护
This commit is contained in:
1 parent
6b977b2c62
commit
a53eb282d2
10 files changed
+113
-31
No files matched your search
@@ -467,8 +467,12 @@ void proc_thread_entry(void *parameter)
|
||||
}
|
||||
}
|
||||
|
||||
extern struct rt_memheap sram_DTCMRAM;
|
||||
static struct rt_thread dat_comm_thread;
|
||||
static void *dat_comm_stack __attribute__((aligned(4)))= RT_NULL ;
|
||||
int data_comm_init(void)
|
||||
{
|
||||
rt_err_t dat_err;
|
||||
proc_mq = rt_mq_create("proc_mq", sizeof(struct proc_request*), 5, RT_IPC_FLAG_FIFO);
|
||||
if (proc_mq == RT_NULL)
|
||||
{
|
||||
@@ -476,18 +480,18 @@ int data_comm_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rt_thread_t tid = rt_thread_create("dat_comm", proc_thread_entry, RT_NULL,
|
||||
1024*6, 20, 10);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
LOG_D("Create cJSON thread");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_D("Failed to create cJSON thread!\n");
|
||||
}
|
||||
dat_comm_stack = rt_memheap_alloc(&sram_DTCMRAM, 1024*6);
|
||||
dat_err = rt_thread_init(&dat_comm_thread, "dat_comm", proc_thread_entry, RT_NULL,
|
||||
dat_comm_stack, 1024*6, 15, 10);
|
||||
|
||||
if(dat_err != RT_EOK)
|
||||
{
|
||||
LOG_E("Failed to create cJSON thread!");
|
||||
return -1;
|
||||
}else{
|
||||
LOG_I("Create cJSON thread");
|
||||
}
|
||||
rt_thread_startup(&dat_comm_thread);
|
||||
return 0;
|
||||
}
|
||||
//INIT_COMPONENT_EXPORT(data_comm_init);
|
||||
INIT_APP_EXPORT(data_comm_init);
|
||||
@@ -125,4 +125,4 @@ int qspi_fal(void)
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(qspi_fal);
|
||||
INIT_COMPONENT_EXPORT(qspi_fal);
|
||||
@@ -46,8 +46,8 @@ void sd_mount(void *parameter)
|
||||
LOG_D("SD device 'sd' not found, retrying...");
|
||||
}
|
||||
|
||||
// 避免空转,延时 100ms 再试
|
||||
rt_thread_mdelay(100);
|
||||
// 避免空转,延时 50ms 再试
|
||||
rt_thread_mdelay(50);
|
||||
retry++;
|
||||
}
|
||||
}
|
||||
@@ -92,4 +92,4 @@ int stm32_sdcard_mount(void)
|
||||
}
|
||||
// 使用 INIT_COMPONENTS_INIT 或 INIT_APP_EXPORT 自动启动
|
||||
//INIT_COMPONENTS_INIT(stm32_sdcard_mount); // 在组件初始化阶段运行
|
||||
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||
INIT_COMPONENT_EXPORT(stm32_sdcard_mount);
|
||||
+10
-1
@@ -23,9 +23,18 @@ extern rt_sem_t mount_sem; // 引用上面SD挂载线程定义的信号量
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/*volatile uint32_t *sdram_test = (uint32_t*)0xC0000000;
|
||||
*sdram_test = 0xAABBCCDD;
|
||||
rt_thread_mdelay(1); // 等待稳定
|
||||
if (*sdram_test != 0xAABBCCDD)
|
||||
{
|
||||
rt_kprintf("SDRAM init failed!\n");
|
||||
while (1); // 卡死,不要继续
|
||||
}
|
||||
rt_kprintf("SDRAM test OK\n");*/
|
||||
|
||||
rt_sem_take(mount_sem, rt_tick_from_millisecond(5000)); // 等待挂载完成,最多等待 5 秒
|
||||
thread_DB_SQLite();
|
||||
data_comm_init();
|
||||
//start_uart_thread();
|
||||
thread_RUN_LED();//运行指示灯线程
|
||||
return RT_EOK;
|
||||
|
||||
Reference in new issue
Block a user