From 16be59858afa332cc8a0f8e61a215e1deea5e897 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 5 Apr 2011 20:54:00 +0000 Subject: Clean kernel-/user-mode module build git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3469 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Makefile | 27 ++++++++++++++++++------ nuttx/arch/arm/src/common/up_createstack.c | 7 +++--- nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c | 2 +- nuttx/configs/sam3u-ek/kernel/Makefile | 4 +++- nuttx/fs/fs_closedir.c | 8 +++---- nuttx/fs/fs_fdopen.c | 4 ++-- nuttx/fs/fs_inode.c | 8 +++---- nuttx/fs/fs_inoderelease.c | 5 +++-- nuttx/fs/fs_inoderemove.c | 5 +++-- nuttx/fs/fs_inodereserve.c | 7 +++--- nuttx/fs/fs_opendir.c | 6 +++--- nuttx/fs/fs_select.c | 6 +++--- nuttx/lib/Makefile | 30 ++++++++++++++++++++++++-- nuttx/lib/lib_internal.h | 34 ++++++++++++++++++++++++++---- nuttx/lib/misc/lib_init.c | 3 +-- nuttx/lib/stdio/lib_dtoa.c | 5 +++-- nuttx/lib/stdio/lib_fclose.c | 5 +++-- nuttx/lib/string/lib_strdup.c | 5 +++-- nuttx/lib/unistd/lib_chdir.c | 2 +- nuttx/tools/mkconfig.c | 11 +++++++++- 21 files changed, 134 insertions(+), 52 deletions(-) (limited to 'nuttx') diff --git a/nuttx/Makefile b/nuttx/Makefile index 30e92e135..f9cb1b782 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -175,7 +175,7 @@ endif # USERLIBS is the list of libraries used to build the final user-space # application -NUTTXLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) lib/liblib$(LIBEXT) +NUTTXLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) USERLIBS = # Add libraries for syscall support. The C library will be needed by @@ -183,10 +183,10 @@ USERLIBS = # is placed in user space (only). ifeq ($(CONFIG_NUTTX_KERNEL),y) -NUTTXLIBS += syscall/libstubs$(LIBEXT) -USERLIBS += syscall/libproxies$(LIBEXT) lib/liblib$(LIBEXT) mm/libmm$(LIBEXT) +NUTTXLIBS += syscall/libstubs$(LIBEXT) lib/libklib$(LIBEXT) +USERLIBS += syscall/libproxies$(LIBEXT) lib/libulib$(LIBEXT) mm/libmm$(LIBEXT) else -NUTTXLIBS += mm/libmm$(LIBEXT) +NUTTXLIBS += mm/libmm$(LIBEXT) lib/liblib$(LIBEXT) endif # Add libraries for network support. CXX, CXXFLAGS, and COMPILEXX must @@ -246,6 +246,7 @@ NUTTXLIBS += graphics/libgraphics$(LIBEXT) endif # This is the name of the final target + BIN = nuttx$(EXEEXT) all: $(BIN) @@ -256,28 +257,34 @@ tools/mkconfig: @$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig # Create the include/nuttx/config.h file + include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig tools/mkconfig $(TOPDIR) > include/nuttx/config.h # link the arch//include dir to include/arch + include/arch: Make.defs @$(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch # Link the configs//include dir to include/arch/board + include/arch/board: include/arch Make.defs include/arch @$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board # Link the configs//src dir to arch//src/board + $(ARCH_SRC)/board: Make.defs @$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board # Link arch//include/ to arch//include/chip + $(ARCH_SRC)/chip: Make.defs ifneq ($(CONFIG_ARCH_CHIP),) @$(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip endif # Link arch//src/ to arch//src/chip + include/arch/chip: include/arch Make.defs ifneq ($(CONFIG_ARCH_CHIP),) @$(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip @@ -307,6 +314,9 @@ check_context: # Possible kernel-mode builds +lib/libklib$(LIBEXT): context + @$(MAKE) -C lib TOPDIR="$(TOPDIR)" libklib$(LIBEXT) EXTRADEFINES=$(KDEFINE) + sched/libsched$(LIBEXT): context @$(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE) @@ -336,8 +346,8 @@ syscall/libstubs$(LIBEXT): context # Possible user-mode builds -lib/liblib$(LIBEXT): context - @$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT) +lib/libulib$(LIBEXT): context + @$(MAKE) -C lib TOPDIR="$(TOPDIR)" libulib$(LIBEXT) libxx/liblibxx$(LIBEXT): context @$(MAKE) -C libxx TOPDIR="$(TOPDIR)" liblibxx$(LIBEXT) @@ -351,6 +361,11 @@ $(APPDIR)/libapps$(LIBEXT): context syscall/libproxies$(LIBEXT): context @$(MAKE) -C syscall TOPDIR="$(TOPDIR)" libproxies$(LIBEXT) +# Possible non-kernel builds + +lib/liblib$(LIBEXT): context + @$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT) + # If the 2 pass build option is selected, then this pass1 target is # configured to built before the pass2 target. This pass1 target may, as an # example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an diff --git a/nuttx/arch/arm/src/common/up_createstack.c b/nuttx/arch/arm/src/common/up_createstack.c index 0c9f0809f..6b8094b5b 100644 --- a/nuttx/arch/arm/src/common/up_createstack.c +++ b/nuttx/arch/arm/src/common/up_createstack.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_createstack.c * - * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ #include #include -#include #include #include @@ -97,9 +96,9 @@ int up_create_stack(_TCB *tcb, size_t stack_size) if (!tcb->stack_alloc_ptr) { #ifdef CONFIG_DEBUG - tcb->stack_alloc_ptr = (uint32_t*)zalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t*)kzalloc(stack_size); #else - tcb->stack_alloc_ptr = (uint32_t*)malloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t*)kmalloc(stack_size); #endif } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h index 7a08f7445..7601fefca 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h @@ -197,7 +197,7 @@ * Configuration: * CONFIG_USBHOST_OHCIRAM_SIZE 1536 * CONFIG_USBHOST_NEDS 2 - * CONFIG_USBHOST_NEDS 3 + * CONFIG_USBHOST_NTDS 3 * CONFIG_USBHOST_TDBUFFERS 3 * CONFIG_USBHOST_TDBUFSIZE 128 * CONFIG_USBHOST_IOBUFSIZE 512 diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c index 86457bf40..17a14fea8 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -2596,7 +2596,7 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) /* Initialize user-configurable request/descriptor transfer buffers */ buffer = (uint8_t *)LPC17_TBFREE_BASE; - for (i = 0; i < CONFIG_USBHOST_NEDS; i++) + for (i = 0; i < CONFIG_USBHOST_TDBUFFERS; i++) { /* Put the TD buffer in a free list */ diff --git a/nuttx/configs/sam3u-ek/kernel/Makefile b/nuttx/configs/sam3u-ek/kernel/Makefile index 688ad0e62..4c1810503 100755 --- a/nuttx/configs/sam3u-ek/kernel/Makefile +++ b/nuttx/configs/sam3u-ek/kernel/Makefile @@ -66,17 +66,19 @@ all: $(TOPDIR)/nuttx_user.elf $(TOPDIR)/User.map $(BOARD_INCLUDE)/user_map.h # Create the nuttx_user.elf file containing all of the user-mode code nuttx_user.elf: - @echo "LD: nuttx_user.elf" @$(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC) $(TOPDIR)/nuttx_user.elf: nuttx_user.elf + @echo "LD: nuttx_user.elf" @cp -a nuttx_user.elf $(TOPDIR)/nuttx_user.elf $(TOPDIR)/User.map: nuttx_user.elf + @echo "MK: User.map" @$(NM) nuttx_user.elf >$(TOPDIR)/User.map @$(CROSSDEV)size nuttx_user.elf $(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map + @echo "MK: user_map.h" @echo "/* configs/$(CONFIG_ARCH_BOARD)/include/user_map.h" > $(BOARD_INCLUDE)/user_map.h @echo " *" >> $(BOARD_INCLUDE)/user_map.h @echo " * This is an auto-generated file.. Do not edit this file!" >> $(BOARD_INCLUDE)/user_map.h diff --git a/nuttx/fs/fs_closedir.c b/nuttx/fs/fs_closedir.c index bfc4f5249..d88bc3347 100644 --- a/nuttx/fs/fs_closedir.c +++ b/nuttx/fs/fs_closedir.c @@ -39,10 +39,10 @@ #include -#include #include #include +#include #include #include @@ -134,17 +134,17 @@ int closedir(FAR DIR *dirp) /* Then release the container */ - free(idir); + kfree(idir); return OK; #ifndef CONFIG_DISABLE_MOUNTPOINT errout_with_inode: inode_release(inode); - free(idir); + kfree(idir); #endif errout: - *get_errno_ptr() = ret; + errno = ret; return ERROR; } diff --git a/nuttx/fs/fs_fdopen.c b/nuttx/fs/fs_fdopen.c index d0a44f9e8..9445e97fa 100644 --- a/nuttx/fs/fs_fdopen.c +++ b/nuttx/fs/fs_fdopen.c @@ -40,12 +40,12 @@ #include #include -#include #include #include #include #include +#include #include /**************************************************************************** @@ -145,7 +145,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR _TCB *tcb) /* Allocate the IO buffer */ - stream->fs_bufstart = malloc(CONFIG_STDIO_BUFFER_SIZE); + stream->fs_bufstart = kmalloc(CONFIG_STDIO_BUFFER_SIZE); if (!stream) { err = ENOMEM; diff --git a/nuttx/fs/fs_inode.c b/nuttx/fs/fs_inode.c index f0d6b6948..6bbdea287 100644 --- a/nuttx/fs/fs_inode.c +++ b/nuttx/fs/fs_inode.c @@ -1,7 +1,7 @@ /**************************************************************************** - * fs_inode.c + * fs/fs_inode.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -179,7 +179,7 @@ void inode_semtake(void) * the wait was awakened by a signal. */ - ASSERT(*get_errno_ptr() == EINTR); + ASSERT(errno == EINTR); } } @@ -308,7 +308,7 @@ void inode_free(FAR struct inode *node) { inode_free(node->i_peer); inode_free(node->i_child); - free(node); + kfree(node); } } diff --git a/nuttx/fs/fs_inoderelease.c b/nuttx/fs/fs_inoderelease.c index db114c936..58aaf3659 100644 --- a/nuttx/fs/fs_inoderelease.c +++ b/nuttx/fs/fs_inoderelease.c @@ -39,8 +39,9 @@ #include -#include #include + +#include #include #include "fs_internal.h" @@ -95,7 +96,7 @@ void inode_release(FAR struct inode *node) { inode_semgive(); inode_free(node->i_child); - free(node); + kfree(node); } else { diff --git a/nuttx/fs/fs_inoderemove.c b/nuttx/fs/fs_inoderemove.c index ff8dcc2ee..cdc61f66a 100644 --- a/nuttx/fs/fs_inoderemove.c +++ b/nuttx/fs/fs_inoderemove.c @@ -39,8 +39,9 @@ #include -#include #include + +#include #include #include "fs_internal.h" @@ -144,7 +145,7 @@ int inode_remove(const char *path) /* And delete it now -- recursively to delete all of its children */ inode_free(node->i_child); - free(node); + kfree(node); return OK; } } diff --git a/nuttx/fs/fs_inodereserve.c b/nuttx/fs/fs_inodereserve.c index f38e349bc..da73b0ac9 100644 --- a/nuttx/fs/fs_inodereserve.c +++ b/nuttx/fs/fs_inodereserve.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_registerreserve.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,8 +39,9 @@ #include -#include #include + +#include #include #include "fs_internal.h" @@ -89,7 +90,7 @@ static void inode_namecpy(char *dest, const char *src) static FAR struct inode *inode_alloc(const char *name) { int namelen = inode_namelen(name); - FAR struct inode *node = (FAR struct inode*)zalloc(FSNODE_SIZE(namelen)); + FAR struct inode *node = (FAR struct inode*)kzalloc(FSNODE_SIZE(namelen)); if (node) { inode_namecpy(node->i_name, name); diff --git a/nuttx/fs/fs_opendir.c b/nuttx/fs/fs_opendir.c index 0b164734b..b0aae94f6 100644 --- a/nuttx/fs/fs_opendir.c +++ b/nuttx/fs/fs_opendir.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include #include @@ -235,7 +235,7 @@ FAR DIR *opendir(FAR const char *path) * container. */ - dir = (FAR struct fs_dirent_s *)zalloc(sizeof(struct fs_dirent_s)); + dir = (FAR struct fs_dirent_s *)kzalloc(sizeof(struct fs_dirent_s)); if (!dir) { /* Insufficient memory to complete the operation.*/ @@ -306,7 +306,7 @@ FAR DIR *opendir(FAR const char *path) /* Nasty goto's make error handling simpler */ errout_with_direntry: - free(dir); + kfree(dir); errout_with_semaphore: inode_semgive(); diff --git a/nuttx/fs/fs_select.c b/nuttx/fs/fs_select.c index 57f5c36fe..213530e44 100644 --- a/nuttx/fs/fs_select.c +++ b/nuttx/fs/fs_select.c @@ -41,7 +41,6 @@ #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include +#include #include #include "fs_internal.h" @@ -111,7 +111,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, /* Allocate the descriptor list for poll() */ - pollset = (struct pollfd *)zalloc(nfds * sizeof(struct pollfd)); + pollset = (struct pollfd *)kzalloc(nfds * sizeof(struct pollfd)); if (!pollset) { errno = ENOMEM; @@ -208,7 +208,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, } } - free(pollset); + kfree(pollset); return ret; } diff --git a/nuttx/lib/Makefile b/nuttx/lib/Makefile index 54ba764ff..2484fc3bf 100644 --- a/nuttx/lib/Makefile +++ b/nuttx/lib/Makefile @@ -80,7 +80,9 @@ QUEUEDEPPATH = --dep-path queue MISCDEPPATH = --dep-path misc VPATH = stdio:stdlib:unistd:sched:string:pthread:semaphore:signal:mqueue:math:net:time:libgen:queue:misc -BIN = liblib$(LIBEXT) +UBIN = libulib$(LIBEXT) +KBIN = libklib$(LIBEXT) +BIN = liblib$(LIBEXT) all: $(BIN) @@ -95,6 +97,22 @@ $(BIN): $(OBJS) $(call ARCHIVE, $@, $${obj}); \ done ; ) +ifneq ($(BIN),$(UBIN)) +.userlib: + @$(MAKE) $(UBIN) BIN=$(UBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) + @touch .userlib + +$(UBIN): kclean .userlib +endif + +ifneq ($(BIN),$(KBIN)) +.kernlib: + @$(MAKE) $(KBIN) BIN=$(KBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) + @touch .kernlib + +$(KBIN): uclean .kernlib +endif + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(STDIODEPPATH) $(STDLIBDEPPATH) \ $(UNISTDDEPPATH) $(SCHEDDEPPATH) $(STRINGDEPPATH) $(PTHREADDEPPATH) \ @@ -105,7 +123,15 @@ $(BIN): $(OBJS) depend: .depend -clean: +uclean: + @rm -f $(UBIN) .userlib *~ .*.swp + $(call CLEAN) + +kclean: + @rm -f $(KBIN) .kernlib *~ .*.swp + $(call CLEAN) + +clean: uclean kclean @rm -f $(BIN) *~ .*.swp $(call CLEAN) diff --git a/nuttx/lib/lib_internal.h b/nuttx/lib/lib_internal.h index 6ec2fe201..b9c74304e 100644 --- a/nuttx/lib/lib_internal.h +++ b/nuttx/lib/lib_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * lib/lib_internal.h * - * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include #include + #include /**************************************************************************** @@ -57,10 +58,35 @@ # define CONFIG_LIB_HOMEDIR "/" #endif +/* If C std I/O buffering is not supported, then we don't need its semaphore + * protection. + */ + #if CONFIG_STDIO_BUFFER_SIZE <= 0 -# define lib_sem_initialize(s) -# define lib_take_semaphore(s) -# define lib_give_semaphore(s) +# define lib_sem_initialize(s) +# define lib_take_semaphore(s) +# define lib_give_semaphore(s) +#endif + +/* The NuttX C library an be build in two modes: (1) as a standard, C-libary + * that can be used by normal, user-space applications, or (2) as a special, + * kernel-mode C-library only used within the OS. If NuttX is not being + * built as separated kernel- and user-space modules, then only the first + * mode is supported. + */ + +#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +# include +# define lib_malloc(s) kmalloc(s) +# define lib_zalloc(s) kzalloc(s) +# define lib_realloc(p,s) krealloc(p,s) +# define lib_free(p) kfree(p) +#else +# include +# define lib_malloc(s) malloc(s) +# define lib_zalloc(s) zalloc(s) +# define lib_realloc(p,s) realloc(p,s) +# define lib_free(p) free(p) #endif #define LIB_BUFLEN_UNKNOWN INT_MAX diff --git a/nuttx/lib/misc/lib_init.c b/nuttx/lib/misc/lib_init.c index 107c73c07..112b0a3c7 100644 --- a/nuttx/lib/misc/lib_init.c +++ b/nuttx/lib/misc/lib_init.c @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -83,7 +82,7 @@ void weak_const_function lib_initialize(void) FAR struct streamlist *lib_alloclist(void) { FAR struct streamlist *list; - list = (FAR struct streamlist*)zalloc(sizeof(struct streamlist)); + list = (FAR struct streamlist*)lib_zalloc(sizeof(struct streamlist)); if (list) { int i; diff --git a/nuttx/lib/stdio/lib_dtoa.c b/nuttx/lib/stdio/lib_dtoa.c index 942ed2033..894af4f42 100755 --- a/nuttx/lib/stdio/lib_dtoa.c +++ b/nuttx/lib/stdio/lib_dtoa.c @@ -45,10 +45,11 @@ #include -#include #include #include +#include "lib_internal.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -142,7 +143,7 @@ static Bigint *Balloc(int k) else { x = 1 << k; - rv = (Bigint *) malloc(sizeof(Bigint) + (x - 1) * sizeof(long)); + rv = (Bigint *)lib_malloc(sizeof(Bigint) + (x - 1) * sizeof(long)); rv->k = k; rv->maxwds = x; } diff --git a/nuttx/lib/stdio/lib_fclose.c b/nuttx/lib/stdio/lib_fclose.c index 4a9ded90b..8d53b387b 100644 --- a/nuttx/lib/stdio/lib_fclose.c +++ b/nuttx/lib/stdio/lib_fclose.c @@ -39,12 +39,13 @@ #include -#include #include #include #include #include +#include "lib_internal.h" + /**************************************************************************** * Global Functions ****************************************************************************/ @@ -68,7 +69,7 @@ int fclose(FAR FILE *stream) if (stream->fs_bufstart) { - free(stream->fs_bufstart); + lib_free(stream->fs_bufstart); } /* Clear the whole structure */ diff --git a/nuttx/lib/string/lib_strdup.c b/nuttx/lib/string/lib_strdup.c index 04ecaffbe..a353c629d 100644 --- a/nuttx/lib/string/lib_strdup.c +++ b/nuttx/lib/string/lib_strdup.c @@ -39,9 +39,10 @@ #include -#include #include +#include "lib_internal.h" + /************************************************************************ * Global Functions ************************************************************************/ @@ -51,7 +52,7 @@ FAR char *strdup(const char *s) FAR char *news = NULL; if (s) { - news = (FAR char*)malloc(strlen(s) + 1); + news = (FAR char*)lib_malloc(strlen(s) + 1); if (news) { strcpy(news, s); diff --git a/nuttx/lib/unistd/lib_chdir.c b/nuttx/lib/unistd/lib_chdir.c index c054f2b23..f79b424ff 100644 --- a/nuttx/lib/unistd/lib_chdir.c +++ b/nuttx/lib/unistd/lib_chdir.c @@ -164,7 +164,7 @@ int chdir(FAR const char *path) alloc = strdup(oldpwd); /* kludge needed because environment is realloc'ed */ setenv("OLDPWD", alloc, TRUE); - free(alloc); + lib_free(alloc); /* Set the cwd to the input 'path' */ diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c index ff02a58c0..cee430cd6 100644 --- a/nuttx/tools/mkconfig.c +++ b/nuttx/tools/mkconfig.c @@ -1,7 +1,7 @@ /**************************************************************************** * tools/mkconfig.c * - * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -288,6 +288,15 @@ int main(int argc, char **argv, char **envp) printf("# undef CONFIG_STDIO_BUFFER_SIZE\n"); printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n"); printf("#endif\n\n"); + printf("/* We are building a kernel version of the C library, then some user-space features\n"); + printf(" * need to be disabled\n"); + printf(" */\n\n"); + printf("#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__)\n"); + printf("# undef CONFIG_STDIO_BUFFER_SIZE\n"); + printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n"); + printf("# undef CONFIG_NUNGET_CHARS\n"); + printf("# define CONFIG_NUNGET_CHARS 0\n"); + printf("#endif\n\n"); printf("/* If the maximum message size is zero, then we assume that message queues\n"); printf(" * support should be disabled\n"); printf(" */\n\n"); -- cgit v1.2.3