优化系统配置

This commit is contained in:
zhangzheng
2023-12-23 16:17:15 +08:00
parent 2257708583
commit 9ac8a7ddcd
21 changed files with 115 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
source "mkrtos_user/lib/libc_backend/Kconfig"
source "mkrtos_user/lib/sys_util/Kconfig"

View File

@@ -43,7 +43,7 @@ target_include_directories(LetterShell PUBLIC
${CMAKE_SOURCE_DIR}/mkrtos_user/lib/sys_svr/inc
${CMAKE_SOURCE_DIR}/mkrtos_user/lib/util/inc
${CMAKE_SOURCE_DIR}/mkrtos_user/server/app/drv
${CMAKE_SOURCE_DIR}/mkrtos_user/lib/mlibc/arch/arm/
${CMAKE_SOURCE_DIR}/mkrtos_user/lib/mlibc/arch/generic
${CMAKE_SOURCE_DIR}/mkrtos_user/lib/mlibc/obj/src/internal

View File

@@ -11,6 +11,8 @@
#include <sys/time.h>
#include <pthread.h>
#include <errno.h>
#ifdef CONFIG_USING_SIG
static int shell_sig_call_back(pid_t pid, umword_t sig_val)
{
/*TODO:这个消息是init发送的这里不能给init发送消息否导致卡死*/
@@ -29,3 +31,4 @@ int shell_test_sig(int argc, char *argv[])
return pm_sig_watch(pid, 0 /*TODO:现在只有kill */);
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), test_sig, shell_test_sig, shell_test_sig command);
#endif

View File

@@ -10,7 +10,7 @@
#include <assert.h>
static pthread_spinlock_t lock;
extern void *app_start_addr;
static umword_t mm_bitemp[256 /*TODO:自动分配,或者静态划分*/];
static umword_t mm_bitemp[ROUND(CONFIG_KNL_DATA_SIZE, MK_PAGE_SIZE) / (sizeof(umword_t) * 8) + 1];
static void *mm_page_alloc(int page_nr)
{
int cnt = 0;

View File

@@ -103,8 +103,9 @@ int __libc_start_main(int (*main)(int, char **, char **), int argc, char **argv,
* are used to prevent the stack frame used during init from
* persisting for the entire process lifetime. */
__init_libc(envp, argv[0]);
#ifdef CONFIG_USING_SIG
sig_init();
#endif
/* Barrier against hoisting application code or anything using ssp
* or thread pointer prior to its initialization above. */
lsm2_fn *stage2 = libc_start_main_stage2;

View File

@@ -0,0 +1,17 @@
menu "Sys util config"
menuconfig USING_SIG
bool "Using signal."
default y
if USING_SIG
config SIG_THREAD_STACK_SIZE
int "Set signal thread stack size."
default 512
config SIG_THREAD_PRIO
int "Set signal thread prio."
default 3
endif
endmenu

View File

@@ -9,8 +9,10 @@
#include <rpc_prot.h>
#include <assert.h>
#ifdef CONFIG_USING_SIG
static sig_call_back sig_cb_func;
static ATTR_ALIGN(8) uint8_t sig_stack[1024];
static ATTR_ALIGN(8) uint8_t sig_stack[CONFIG_SIG_THREAD_STACK_SIZE];
static uint8_t sig_msg_buf[MSG_BUG_LEN];
static obj_handler_t sig_th;
static obj_handler_t sig_ipc;
@@ -70,5 +72,6 @@ void sig_init(void)
return;
}
u_thread_create(&sig_th, sig_stack, sizeof(sig_stack), sig_msg_buf, sig_func);
u_thread_run(sig_th, 3);
u_thread_run(sig_th, CONFIG_SIG_THREAD_PRIO);
}
#endif

View File

@@ -21,7 +21,7 @@ int main(int argv, char *args[])
ret = rpc_meta_init(THREAD_MAIN, &hd);
assert(ret >= 0);
fs_svr_init();
ns_register("/cpio", hd, MOUNT_NODE);
ns_register("/bin", hd, MOUNT_NODE);
cons_write_str("cpiofs mount success\n");
// *((char *)0) = 0;

View File

@@ -18,7 +18,9 @@ void fs_svr_init(void)
{
fs_init(&fs);
meta_reg_svr_obj(&fs.svr, FS_PROT);
#ifdef CONFIG_USING_SIG
pm_sig_func_set(fs_sig_call_back);
#endif
}
typedef struct file_desc
{
@@ -184,11 +186,13 @@ int fs_svr_open(const char *path, int flags, int mode)
{
return fatfs_err_conv(ret);
}
#ifdef CONFIG_USING_SIG
int w_ret = pm_sig_watch(pid, 0 /*TODO:现在只有kill */);
if (w_ret < 0)
{
printf("pm wath pid %d err.\n", w_ret);
}
#endif
return fd;
}

View File

@@ -8,7 +8,7 @@
* @copyright Copyright (c) 2023
*
*/
#define HEAP_SIZE 512
#define HEAP_SIZE 1024
#define STACK_SIZE 1024 * 2
#if defined(__CC_ARM)

View File

@@ -1,4 +1,5 @@
#一次读取一行,每行代表启动的应用程序,暂时不支持参数
fatfs
cpiofs
sh