From 354116817a07fe13eae9ddfb21c369d67552c72a Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 5 Apr 2011 01:46:55 +0000 Subject: Progress toward kernel build git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3465 42af7a65-404d-4744-a932-0658087f49c3 --- apps/nshlib/nsh_parse.c | 4 ++-- apps/nshlib/nsh_proccmds.c | 2 ++ nuttx/configs/sam3u-ek/kernel/Makefile | 18 +++++++++++++----- nuttx/configs/sam3u-ek/kernel/kernel.ld | 14 +++++++++++++- nuttx/configs/sam3u-ek/knsh/defconfig | 10 ++++++++++ nuttx/fs/Makefile | 7 ++++++- nuttx/include/sys/syscall.h | 30 +++++++++++++++++++++--------- nuttx/syscall/Makefile | 1 - nuttx/syscall/stub_lookup.c | 19 +++++++++++-------- nuttx/syscall/stub_lookup.h | 6 ++++++ nuttx/syscall/syscall.csv | 2 ++ 11 files changed, 86 insertions(+), 27 deletions(-) diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index e93c624fa..fe7423f66 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -153,7 +153,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if CONFIG_NFILE_DESCRIPTORS > 0 -# ifndef CONFIG_NSH_DISABLE_LS +# ifndef CONFIG_NSH_DISABLE_DD { "dd", cmd_dd, 3, 6, "if= of= [bs=] [count=] [skip=]" }, # endif #endif @@ -194,7 +194,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #ifndef CONFIG_DISABLE_SIGNALS -# ifndef CONFIG_NSH_DISABLE_SLEEP +# ifndef CONFIG_NSH_DISABLE_KILL { "kill", cmd_kill, 3, 3, "- " }, # endif #endif diff --git a/apps/nshlib/nsh_proccmds.c b/apps/nshlib/nsh_proccmds.c index 0ee48a71d..7abd50ec1 100644 --- a/apps/nshlib/nsh_proccmds.c +++ b/apps/nshlib/nsh_proccmds.c @@ -69,6 +69,7 @@ typedef int (*exec_t)(void); * Private Data ****************************************************************************/ +#ifndef CONFIG_NSH_DISABLE_PS static const char *g_statenames[] = { "INVALID ", @@ -85,6 +86,7 @@ static const char *g_statenames[] = "MQNFULL " #endif }; +#endif /**************************************************************************** * Public Data diff --git a/nuttx/configs/sam3u-ek/kernel/Makefile b/nuttx/configs/sam3u-ek/kernel/Makefile index dd3e1892c..38abe2b0a 100755 --- a/nuttx/configs/sam3u-ek/kernel/Makefile +++ b/nuttx/configs/sam3u-ek/kernel/Makefile @@ -74,7 +74,7 @@ $(TOPDIR)/nuttx_user.elf: nuttx_user.elf $(TOPDIR)/User.map: nuttx_user.elf @$(NM) nuttx_user.elf >$(TOPDIR)/User.map - @$(CROSSDEV)size $(TOPDIR)/User.map + @$(CROSSDEV)size nuttx_user.elf $(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map @echo "/* configs/$(CONFIG_ARCH_BOARD)/include/user_map.h" > $(BOARD_INCLUDE)/user_map.h @@ -85,10 +85,18 @@ $(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map @echo "#ifndef __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)/user_map.h @echo "#define __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)/user_map.h @echo "" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_ENTRYPOINT `grep user_start $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_DATASOURCE `grep _eronly $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_DATADESTSTART `grep _sdata $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_DATADESTEND `grep _edata $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "/* General memory map */" >> $(BOARD_INCLUDE)/user_map.h + @echo "" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_ENTRYPOINT 0x`grep \" user_start$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "" >> $(BOARD_INCLUDE)/user_map.h + @echo "/* Memory manager entry points */" >> $(BOARD_INCLUDE)/user_map.h + @echo "" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_MALLOC 0x`grep \" malloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_REALLOC 0x`grep \" realloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_FREE 0x`grep \" free$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h @echo "" >> $(BOARD_INCLUDE)/user_map.h @echo "#endif /* __ARCH_BOARD_USER_MAP_H */" >> $(BOARD_INCLUDE)/user_map.h diff --git a/nuttx/configs/sam3u-ek/kernel/kernel.ld b/nuttx/configs/sam3u-ek/kernel/kernel.ld index 72f79d9d7..267963978 100644 --- a/nuttx/configs/sam3u-ek/kernel/kernel.ld +++ b/nuttx/configs/sam3u-ek/kernel/kernel.ld @@ -62,9 +62,21 @@ MEMORY sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K } +# Force user_start into the link. This is the application entry point + +EXTERN(user_start) + +# Make sure that the critical memory management functions are in user-space. +# Currently, the plan is that the memory manager will reside in user-space +# but be usable both by kernel- and user-space code + +EXTERN(malloc) +EXTERN(realloc) +EXTERN(free) + OUTPUT_ARCH(arm) ENTRY(user_start) -EXTERN(user_start) + SECTIONS { .text : { diff --git a/nuttx/configs/sam3u-ek/knsh/defconfig b/nuttx/configs/sam3u-ek/knsh/defconfig index b6aa4aba2..6602685c5 100755 --- a/nuttx/configs/sam3u-ek/knsh/defconfig +++ b/nuttx/configs/sam3u-ek/knsh/defconfig @@ -339,6 +339,16 @@ CONFIG_SCHED_WORKPERIOD=(50*1000) CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SIG_SIGWORK=4 +# +# These NSH commands are (temporarily) disable because more support is needed +# for these commands to work with CONFIG_NUTTX_KERNEL +# +CONFIG_NSH_DISABLE_MKRD=y +CONFIG_NSH_DISABLE_MKFATFS=y +CONFIG_NSH_DISABLE_LOSETUP=y +CONFIG_NSH_DISABLE_DD=y +CONFIG_NSH_DISABLE_PS=y + # # The following can be used to disable categories of # APIs supported by the OS. If the compiler supports diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 0810be494..3423250ba 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -48,11 +48,16 @@ CSRCS += fs_open.c fs_close.c fs_read.c fs_write.c fs_ioctl.c \ fs_poll.c fs_select.c fs_lseek.c fs_dup.c fs_filedup.c \ fs_dup2.c fs_fcntl.c fs_filedup2.c fs_mmap.c fs_opendir.c \ fs_closedir.c fs_stat.c fs_readdir.c fs_seekdir.c fs_rewinddir.c \ - fs_files.c fs_inode.c fs_fdopen.c fs_inodefind.c fs_inodereserve.c \ + fs_files.c fs_inode.c fs_inodefind.c fs_inodereserve.c \ fs_statfs.c fs_inoderemove.c fs_registerdriver.c fs_unregisterdriver.c \ fs_inodeaddref.c fs_inoderelease.c CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \ fs_findblockdriver.c fs_openblockdriver.c fs_closeblockdriver.c + +ifneq ($(CONFIG_NFILE_STREAMS),0) +CSRCS += fs_fdopen.c +endif + ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) CSRCS += fs_mount.c fs_umount.c fs_fsync.c fs_unlink.c fs_rename.c \ fs_mkdir.c fs_rmdir.c diff --git a/nuttx/include/sys/syscall.h b/nuttx/include/sys/syscall.h index c4527c9fa..09e4a632f 100644 --- a/nuttx/include/sys/syscall.h +++ b/nuttx/include/sys/syscall.h @@ -193,18 +193,28 @@ # define SYS_stat (__SYS_filedesc+13) # define SYS_statfs (__SYS_filedesc+14) # define SYS_telldir (__SYS_filedesc+15) + +# if CONFIG_NFILE_STREAMS > 0 +# define SYS_fs_fdopen (__SYS_filedesc+16) +# define SYS_sched_getstreams (__SYS_filedesc+17) +# define __SYS_mountpoint (__SYS_filedesc+18) +# else +# define __SYS_mountpoint (__SYS_filedesc+16) +# endif + # if !defined(CONFIG_DISABLE_MOUNTPOINT) -# define SYS_fsync (__SYS_filedesc+16) -# define SYS_mkdir (__SYS_filedesc+17) -# define SYS_mount (__SYS_filedesc+18) -# define SYS_rename (__SYS_filedesc+19) -# define SYS_rmdir (__SYS_filedesc+20) -# define SYS_umount (__SYS_filedesc+21) -# define SYS_unlink (__SYS_filedesc+22) -# define __SYS_pthread (__SYS_filedesc+23) +# define SYS_fsync (__SYS_mountpoint+0) +# define SYS_mkdir (__SYS_mountpoint+1) +# define SYS_mount (__SYS_mountpoint+2) +# define SYS_rename (__SYS_mountpoint+3) +# define SYS_rmdir (__SYS_mountpoint+4) +# define SYS_umount (__SYS_mountpoint+5) +# define SYS_unlink (__SYS_mountpoint+6) +# define __SYS_pthread (__SYS_mountpoint+7) # else -# define __SYS_pthread (__SYS_filedesc+16) +# define __SYS_pthread __SYS_mountpoint # endif + #else # define __SYS_pthread __SYS_filedesc #endif @@ -241,6 +251,7 @@ # define SYS_pthread_setspecific (__SYS_pthread+26) # define SYS_pthread_testcancel (__SYS_pthread+27) # define SYS_pthread_yield (__SYS_pthread+28) + # ifndef CONFIG_DISABLE_SIGNAL # define SYS_pthread_cond_timedwait (__SYS_pthread+29) # define SYS_pthread_kill (__SYS_pthread+30) @@ -249,6 +260,7 @@ # else # define __SYS_mqueue (__SYS_pthread+29) # endif + #else # define __SYS_mqueue __SYS_pthread #endif diff --git a/nuttx/syscall/Makefile b/nuttx/syscall/Makefile index c96ca3ef4..7ef1a4629 100644 --- a/nuttx/syscall/Makefile +++ b/nuttx/syscall/Makefile @@ -92,7 +92,6 @@ $(MKSYSCALL): @$(MAKE) -C $(TOPDIR)/tools -f Makefile.host mksyscall .context: syscall.csv - echo "Rebuilding stubs and proxies" @(cd proxies; $(MKSYSCALL) -p $(CSVFILE);) @(cd stubs; $(MKSYSCALL) -s $(CSVFILE);) @touch $@ diff --git a/nuttx/syscall/stub_lookup.c b/nuttx/syscall/stub_lookup.c index f2a717898..108019b34 100644 --- a/nuttx/syscall/stub_lookup.c +++ b/nuttx/syscall/stub_lookup.c @@ -76,10 +76,10 @@ extern uintptr_t STUB_sem_post(uintptr_t parm1); extern uintptr_t STUB_sem_trywait(uintptr_t parm1); extern uintptr_t STUB_sem_unlink(uintptr_t parm1); extern uintptr_t STUB_sem_wait(uintptr_t parm1); -extern uintptr_t (uintptr_t parm1); -extern uintptr_t (uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); -extern uintptr_t (uintptr_t parm1); -extern uintptr_t (uintptr_t parm1); +extern uintptr_t STUB_set_errno(uintptr_t parm1); +extern uintptr_t STUB_task_create(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); +extern uintptr_t STUB_task_delete(uintptr_t parm1); +extern uintptr_t STUB_task_restart(uintptr_t parm1); extern uintptr_t STUB_up_assert(uintptr_t parm1, uintptr_t parm2); extern uintptr_t STUB_up_assert_code(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); @@ -150,6 +150,9 @@ extern uintptr_t STUB_stat(uintptr_t parm1, uintptr_t parm2); extern uintptr_t STUB_statfs(uintptr_t parm1, uintptr_t parm2); extern uintptr_t STUB_telldir(uintptr_t parm1); +extern uintptr_t STUB_fs_fdopen(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); +extern uintptr_t STUB_sched_getstreams(void); + extern uintptr_t STUB_fsync(uintptr_t parm1); extern uintptr_t STUB_mkdir(uintptr_t parm1, uintptr_t parm2); extern uintptr_t STUB_mount(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); @@ -239,18 +242,18 @@ extern uintptr_t STUB_socket(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); const union syscall_stubfunc_u *g_stublookup[SYS_nsyscalls] = { # undef STUB_LOOKUP1 -# define STUB_LOOKUP1(n,p) p +# define STUB_LOOKUP1(n,p) (union syscall_stubfunc_u *)p # undef STUB_LOOKUP -# define STUB_LOOKUP(n,p) , p +# define STUB_LOOKUP(n,p) , (union syscall_stubfunc_u *)p # include "stub_lookup.h" }; const uint8_t g_stubnparms[SYS_nsyscalls] = { # undef STUB_LOOKUP1 -# define STUB_LOOKUP1(n,p) { n } +# define STUB_LOOKUP1(n,p) n # undef STUB_LOOKUP -# define STUB_LOOKUP(n,p) , { n } +# define STUB_LOOKUP(n,p) , n # include "stub_lookup.h" }; diff --git a/nuttx/syscall/stub_lookup.h b/nuttx/syscall/stub_lookup.h index c20ebf262..112fdd16a 100644 --- a/nuttx/syscall/stub_lookup.h +++ b/nuttx/syscall/stub_lookup.h @@ -150,6 +150,12 @@ STUB_LOOKUP(3, STUB_up_assert_code) /* SYS_up_assert_code */ STUB_LOOKUP(2, STUB_stat) /* SYS_stat */ STUB_LOOKUP(2, STUB_statfs) /* SYS_statfs */ STUB_LOOKUP(1, STUB_telldir) /* SYS_telldir */ + +# if CONFIG_NFILE_STREAMS > 0 + STUB_LOOKUP(3, STUB_fs_fdopen) /* SYS_fs_fdopen */ + STUB_LOOKUP(0, STUB_sched_getstreams) /* SYS_sched_getstreams */ +#endif + # if !defined(CONFIG_DISABLE_MOUNTPOINT) STUB_LOOKUP(1, STUB_fsync) /* SYS_fsync */ STUB_LOOKUP(2, STUB_mkdir) /* SYS_mkdir */ diff --git a/nuttx/syscall/syscall.csv b/nuttx/syscall/syscall.csv index 35785bae6..4ec12f23b 100644 --- a/nuttx/syscall/syscall.csv +++ b/nuttx/syscall/syscall.csv @@ -13,6 +13,7 @@ "dup2","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int" "exit","stdlib.h","","void","int" "fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..." +"fs_fdopen","nuttx/fs.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR struct file_struct*","int","int","FAR _TCB*" "fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int" "get_errno","errno.h","","int" "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*" @@ -81,6 +82,7 @@ "rmdir","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*" "sched_getparam","sched.h","","int","pid_t","struct sched_param*" "sched_getscheduler","sched.h","","int","pid_t" +"sched_getstreams","nuttx/sched.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR struct streamlist*" "sched_lock","sched.h","","int" "sched_lockcount","sched.h","","int32_t" "sched_rr_get_interval","sched.h","","int","pid_t","struct timespec*" -- cgit v1.2.3