fix ipc map.
This commit is contained in:
@@ -54,7 +54,12 @@ int app_load(const char *name, uenv_t *cur_env)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
app_info_t *app = (app_info_t *)addr;
|
||||
app_info_t *app = app_info_get((void *)addr);
|
||||
|
||||
if (app == NULL) {
|
||||
printf("app format is error.\n");
|
||||
return -1;
|
||||
}
|
||||
printf("app addr is 0x%x\n", app);
|
||||
umword_t ram_base;
|
||||
obj_handler_t hd_task = handler_alloc();
|
||||
|
||||
@@ -11,5 +11,5 @@ set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
|
||||
|
||||
add_subdirectory(init)
|
||||
add_subdirectory(shell)
|
||||
# add_subdirectory(fs)
|
||||
add_subdirectory(fs)
|
||||
# add_subdirectory(path_manager)
|
||||
|
||||
@@ -9,8 +9,10 @@ add_executable(
|
||||
target_link_libraries(
|
||||
fatfs.elf
|
||||
PUBLIC
|
||||
start
|
||||
muslc
|
||||
sys
|
||||
sys_util
|
||||
${GCC_LIB_PATH}/libgcc.a
|
||||
)
|
||||
target_include_directories(
|
||||
@@ -31,7 +33,10 @@ target_include_directories(
|
||||
)
|
||||
add_dependencies(
|
||||
fatfs.elf
|
||||
start
|
||||
muslc
|
||||
sys
|
||||
sys_util
|
||||
)
|
||||
set_target_properties(
|
||||
fatfs.elf PROPERTIES LINK_FLAGS
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "ff.h" /* Obtains integer types */
|
||||
#include "diskio.h" /* Declarations of disk functions */
|
||||
#include "ram_disk.h"
|
||||
|
||||
#include <stdio.h>
|
||||
/* Definitions of physical drive number for each drive */
|
||||
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
|
||||
#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
|
||||
@@ -107,7 +107,7 @@ DRESULT disk_write(
|
||||
case DEV_RAM:
|
||||
// translate the arguments here
|
||||
|
||||
if (ram_disk_write(buff, sector, count) < 0) {
|
||||
if (ram_disk_write((uint8_t *)buff, sector, count) < 0) {
|
||||
return RES_ERROR;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
ENTRY(_start_)
|
||||
_system_stack_size = 0x100;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <ff.h>
|
||||
#include "u_log.h"
|
||||
#include <stdio.h>
|
||||
static FATFS fs;
|
||||
static BYTE buff[512];
|
||||
static MKFS_PARM defopt = {FM_ANY, 0, 0, 0};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "u_types.h"
|
||||
#include "ram_disk.h"
|
||||
|
||||
#include <string.h>
|
||||
#define RAM_DISK_SECTOR_NR 512
|
||||
|
||||
static uint8_t ram_disk[RAM_DISK_SECTOR_NR * 512];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#define HEAP_SIZE 4
|
||||
#define HEAP_SIZE 0
|
||||
#define STACK_SIZE 1024 * 2
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
@@ -13,5 +13,5 @@
|
||||
#define STACK_ATTR
|
||||
#endif
|
||||
|
||||
__attribute__((used)) HEAP_ATTR char heap[HEAP_SIZE];
|
||||
__attribute__((used)) HEAP_ATTR static char heap[HEAP_SIZE];
|
||||
__attribute__((used)) STACK_ATTR static char stack[STACK_SIZE];
|
||||
|
||||
@@ -36,10 +36,8 @@ int main(int argc, char *args[])
|
||||
#endif
|
||||
uenv_t env = *u_get_global_env();
|
||||
obj_handler_t ipc_hd;
|
||||
|
||||
int ret = rpc_creaite_bind_ipc(THREAD_MAIN, NULL, &ipc_hd);
|
||||
assert(ret >= 0);
|
||||
|
||||
env.ns_hd = ipc_hd;
|
||||
ret = app_load("shell", &env);
|
||||
if (ret < 0)
|
||||
@@ -48,6 +46,13 @@ int main(int argc, char *args[])
|
||||
}
|
||||
ns_init();
|
||||
ns_pre_alloc_map_fd(thread_get_cur_ipc_msg());
|
||||
|
||||
ret = app_load("fatfs", &env);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("app load fail, 0x%x\n", ret);
|
||||
}
|
||||
|
||||
rpc_loop(ipc_hd, ns_dispatch);
|
||||
task_unmap(TASK_THIS, vpage_create_raw3(KOBJ_DELETE_RIGHT, 0, TASK_THIS)); // 删除当前task,以及申请得所有对象
|
||||
printf("exit init.\n");
|
||||
|
||||
@@ -136,7 +136,7 @@ msg_tag_t ns_dispatch(ipc_msg_t *msg)
|
||||
{
|
||||
size_t len = msg->msg_buf[1];
|
||||
|
||||
msg->map_buf[0] = hd;
|
||||
msg->map_buf[0] = vpage_create_raw3(0, 0, hd).raw;
|
||||
printf("query..\n");
|
||||
tag = msg_tag_init4(0, 0, 1, ret);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void ns_test(void)
|
||||
assert(ret >= 0);
|
||||
ret = cli_ns_query("shell", &tmp_ipc_hd);
|
||||
assert(ret >= 0);
|
||||
|
||||
ulog_write_str(u_get_global_env()->log_hd, "ns test success.\n");
|
||||
}
|
||||
int main(int argc, char *args[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user