内存与测试
This commit is contained in:
1 parent
efee86fab9
commit
4647022f6f
9 files changed
+36
-11
No files matched your search
@@ -22,7 +22,7 @@ static struct rt_semaphore rx_sem;
|
||||
|
||||
#define RX_LINE_BUF_SIZE 1024
|
||||
#define RS485_SAMPLE_SLAVE_SERIAL "uart4"
|
||||
#define RS485_SAMPLE_SLAVE_BAUDRATE 57600
|
||||
#define RS485_SAMPLE_SLAVE_BAUDRATE 115200
|
||||
#define RS485_SAMPLE_MASTER_PARITY 0 //0 -- none parity
|
||||
#define RS485_SAMPLE_SLAVE_PIN -1 //-1 -- nonuse rs485 mode control
|
||||
#define RS485_SAMPLE_SLAVE_LVL 1
|
||||
|
||||
@@ -574,7 +574,7 @@ void proc_thread_entry(void *parameter)
|
||||
}
|
||||
}
|
||||
|
||||
extern struct rt_memheap sram_DTCMRAM;
|
||||
extern struct rt_memheap sdram_heap;
|
||||
static struct rt_thread dat_comm_thread;
|
||||
static void *dat_comm_stack __attribute__((aligned(4)))= RT_NULL ;
|
||||
int data_comm_init(void)
|
||||
@@ -587,7 +587,7 @@ int data_comm_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dat_comm_stack = rt_memheap_alloc(&sram_DTCMRAM, 1024*6);
|
||||
dat_comm_stack = rt_memheap_alloc(&sdram_heap, 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)
|
||||
|
||||
@@ -189,6 +189,10 @@ void db_sqlite_init_full(void)
|
||||
if (g_db)
|
||||
{
|
||||
sqlite3_close(g_db);
|
||||
//限制缓存大小 (100KB)
|
||||
sqlite3_exec(g_db, "PRAGMA cache_size = -50;", 0, 0, 0);
|
||||
//设置临时存储为文件模式 (节省内存)
|
||||
sqlite3_exec(g_db, "PRAGMA temp_store = FILE;", 0, 0, 0);
|
||||
g_db = RT_NULL;
|
||||
}
|
||||
return; //
|
||||
@@ -235,6 +239,10 @@ void db_sqlite_init_full(void)
|
||||
}else {
|
||||
if (sqlite3_open(DB_NAME, &g_db) == SQLITE_OK)
|
||||
{
|
||||
//限制缓存大小 (100KB)
|
||||
sqlite3_exec(g_db, "PRAGMA cache_size = -50;", 0, 0, 0);
|
||||
//设置临时存储为文件模式 (节省内存)
|
||||
sqlite3_exec(g_db, "PRAGMA temp_store = FILE;", 0, 0, 0);
|
||||
LOG_D("[DataBase] NAME (%s)",DB_NAME);
|
||||
}
|
||||
}
|
||||
@@ -312,6 +320,10 @@ static void db_sqlite(void *parameter) {
|
||||
return_disabled(&cmd);
|
||||
continue;
|
||||
} else {
|
||||
//限制缓存大小 (100KB)
|
||||
sqlite3_exec(g_db, "PRAGMA cache_size = -50;", 0, 0, 0);
|
||||
//设置临时存储为文件模式 (节省内存)
|
||||
sqlite3_exec(g_db, "PRAGMA temp_store = FILE;", 0, 0, 0);
|
||||
rt_kprintf("Opened database: %s\n", DB_NAME);
|
||||
}
|
||||
}
|
||||
@@ -399,16 +411,28 @@ rt_err_t db_send_command(enum db_cmd_type type, const char* sql, rt_int32_t time
|
||||
return result;
|
||||
}
|
||||
|
||||
extern struct rt_memheap sram_DTCMRAM;
|
||||
static struct rt_thread dat_sqlite_thread;
|
||||
static void *dat_sqlite_stack __attribute__((aligned(4)))= RT_NULL ;
|
||||
/* 线程 */
|
||||
void thread_DB_SQLite(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
tid = rt_thread_create("db_sql", db_sqlite, RT_NULL, 1024 *16, 18, 10);
|
||||
rt_err_t db_err;
|
||||
dat_sqlite_stack = rt_memheap_alloc(&sram_DTCMRAM, 1024*16);
|
||||
db_err = rt_thread_init(&dat_sqlite_thread, "db_sql", db_sqlite, RT_NULL,dat_sqlite_stack, 1024*16, 15, 10);
|
||||
if(db_err != RT_EOK)
|
||||
{
|
||||
LOG_D("Failed to create SQLite thread!\n");
|
||||
}
|
||||
rt_thread_startup(&dat_sqlite_thread);
|
||||
|
||||
/* rt_thread_t tid;
|
||||
tid = rt_thread_create("db_sql", db_sqlite, RT_NULL, 1024 *14, 18, 10);
|
||||
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
}else{
|
||||
LOG_D("Failed to create SQLite thread!\n");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
+1
-1
@@ -69,4 +69,4 @@ static int wdt_sample()
|
||||
return ret;
|
||||
}
|
||||
|
||||
//INIT_APP_EXPORT(wdt_sample);
|
||||
INIT_APP_EXPORT(wdt_sample);
|
||||
Reference in new issue
Block a user