Skip to content

Commit

Permalink
First round of changes to get the ELF configuration building again
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-nutt committed Sep 16, 2014
1 parent 62a11fd commit 925fc9a
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 48 deletions.
4 changes: 2 additions & 2 deletions arch/arm/src/armv7-a/arm_pgalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "mmu.h"
#include "pgalloc.h"

#if defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)
#ifdef CONFIG_BUILD_KERNEL

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -317,4 +317,4 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages)
return brkaddr;
}

#endif /* CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */
#endif /* CONFIG_BUILD_KERNEL */
2 changes: 1 addition & 1 deletion include/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
FAR char * const argv[]);
int task_activate(FAR struct tcb_s *tcb);

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL
int task_create(FAR const char *name, int priority, int stack_size,
main_t entry, FAR char * const argv[]);
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/spawn.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct posix_spawnattr_s
sigset_t sigmask; /* Signals to be masked */
#endif

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL
/* Used only by task_spawn (non-standard) */

size_t stacksize; /* Task stack size */
Expand Down Expand Up @@ -141,7 +141,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
posix_spawn(pid,path,file_actions,attr,argv,envp)
#endif

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL
/* Non-standard task_spawn interface. This function uses the same
* semantics to execute a file in memory at 'entry', giving it the name
* 'name'.
Expand Down
6 changes: 2 additions & 4 deletions include/sys/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,17 @@
* address environments.
*/

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL
# define SYS_task_create (CONFIG_SYS_RESERVED+22)
# define __SYS_task_delete (CONFIG_SYS_RESERVED+23)

/* pgalloc() is only available with address environments with the page
* allocator selected. MMU support from the CPU is also required.
*/

#elif defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)
#else
# define SYS_pgalloc (CONFIG_SYS_RESERVED+22)
# define __SYS_task_delete (CONFIG_SYS_RESERVED+23)
#else
# define __SYS_task_delete (CONFIG_SYS_RESERVED+22)
#endif

# define SYS_task_delete __SYS_task_delete
Expand Down
2 changes: 1 addition & 1 deletion libc/spawn/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CSRCS += lib_psa_getsigmask.c lib_psa_setsigmask.c
endif

ifneq ($(CONFIG_ARCH_ADDRENV),y)
ifneq ($(CONFIG_BUILD_KERNEL),y)
CSRCS += lib_psa_getstacksize.c lib_psa_setstacksize.c
endif

Expand Down
4 changes: 2 additions & 2 deletions libc/spawn/lib_psa_getstacksize.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <spawn.h>
#include <assert.h>

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL

/****************************************************************************
* Public Functions
Expand Down Expand Up @@ -75,4 +75,4 @@ int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
return OK;
}

#endif /* !CONFIG_ARCH_ADDRENV */
#endif /* !CONFIG_BUILD_KERNEL */
4 changes: 2 additions & 2 deletions libc/spawn/lib_psa_setstacksize.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <spawn.h>
#include <assert.h>

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL

/****************************************************************************
* Public Functions
Expand Down Expand Up @@ -74,4 +74,4 @@ int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize)
return OK;
}

#endif /* !CONFIG_ARCH_ADDRENV */
#endif /* !CONFIG_BUILD_KERNEL */
5 changes: 2 additions & 3 deletions mm/kmm_sbrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@

#include <nuttx/mm.h>

#if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_ARCH_ADDRENV) && \
defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)
#if defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -89,4 +88,4 @@ FAR void *kmm_sbrk(intptr_t incr)
return mm_sbrk(&g_kmmheap, incr, UINTPTR_MAX);
}

#endif /* CONFIG_MM_KERNEL_HEAP && CONFIG_ARCH_ADDRENV && ... */
#endif /* CONFIG_BUILD_KERNEL && __KERNEL__ */
5 changes: 2 additions & 3 deletions mm/mm_sbrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
#include <nuttx/mm.h>
#include <nuttx/pgalloc.h>

#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \
defined(CONFIG_ARCH_USE_MMU)
#ifdef CONFIG_BUILD_KERNEL

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -166,4 +165,4 @@ FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr,
set_errno(err);
return (FAR void *)-1;
}
#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */
#endif /* CONFIG_BUILD_KERNEL */
4 changes: 2 additions & 2 deletions mm/umm_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* Pre-processor Definitions
****************************************************************************/

#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
#ifdef CONFIG_BUILD_KERNEL
/* In the kernel build, there a multiple user heaps; one for each task
* group. In this build configuration, the user heap structure lies
* in a reserved region at the beginning of the .bss/.data address
Expand Down Expand Up @@ -103,7 +103,7 @@

FAR void *malloc(size_t size)
{
#ifdef CONFIG_ARCH_ADDRENV
#ifdef CONFIG_BUILD_KERNEL
FAR void *brkaddr;
FAR void *mem;

Expand Down
17 changes: 4 additions & 13 deletions mm/umm_sbrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,23 @@
#include <unistd.h>

#include <nuttx/mm.h>
#include <nuttx/addrenv.h>
#include <nuttx/pgalloc.h>

#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \
defined(CONFIG_ARCH_USE_MMU) && (!defined(CONFIG_BUILD_PROTECTED) || \
!defined(__KERNEL__))
#if defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__)

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
/* In the kernel build, there a multiple user heaps; one for each task
* group. In this build configuration, the user heap structure lies
* in a reserved region at the beginning of the .bss/.data address
* space (CONFIG_ARCH_DATA_VBASE). The size of that region is given by
* ARCH_DATA_RESERVE_SIZE
*/

# include <nuttx/addrenv.h>
# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)

#else
/* Otherwise, the user heap data structures are in common .bss */

# define USR_HEAP &g_mmheap
#endif
#define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)

/****************************************************************************
* Public Functions
Expand Down Expand Up @@ -110,4 +101,4 @@ FAR void *sbrk(intptr_t incr)
return mm_sbrk(USR_HEAP, incr, CONFIG_ARCH_HEAP_NPAGES << MM_PGSHIFT);
}

#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && ... */
#endif /* CONFIG_BUILD_KERNEL && !__KERNEL__ */
13 changes: 6 additions & 7 deletions sched/task/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,19 @@
#
############################################################################

TSK_SRCS = task_create.c task_init.c task_setup.c task_activate.c
TSK_SRCS += task_start.c task_delete.c task_exit.c task_exithook.c
TSK_SRCS += task_recover.c task_restart.c task_spawnparms.c
TSK_SRCS += task_terminate.c task_getgroup.c task_prctl.c task_getpid.c
TSK_SRCS += exit.c
TSK_SRCS = task_init.c task_setup.c task_activate.c task_start.c
TSK_SRCS += task_delete.c task_exit.c task_exithook.c task_recover.c
TSK_SRCS += task_restart.c task_spawnparms.c task_terminate.c
TSK_SRCS += task_getgroup.c task_prctl.c task_getpid.c exit.c

ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
ifeq ($(CONFIG_SCHED_WAITPID),y)
TSK_SRCS += task_vfork.c
endif
endif

ifneq ($(CONFIG_ARCH_ADDRENV),y)
TSK_SRCS += task_spawn.c
ifneq ($(CONFIG_BUILD_KERNEL),y)
TSK_SRCS += task_create.c task_spawn.c
endif

ifneq ($(CONFIG_BINFMT_DISABLE),y)
Expand Down
3 changes: 3 additions & 0 deletions sched/task/task_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#include "group/group.h"
#include "task/task.h"

#ifndef CONFIG_BUILD_KERNEL

/****************************************************************************
* Definitions
****************************************************************************/
Expand Down Expand Up @@ -270,3 +272,4 @@ int kernel_thread(FAR const char *name, int priority,
return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size, entry, argv);
}

#endif /* CONFIG_BUILD_KERNEL */
4 changes: 2 additions & 2 deletions sched/task/task_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include "task/spawn.h"
#include "task/task.h"

#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -455,4 +455,4 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
return ret;
}

#endif /* CONFIG_ARCH_ADDRENV */
#endif /* CONFIG_BUILD_KERNEL */
4 changes: 2 additions & 2 deletions syscall/syscall.csv
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"nanosleep","time.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const struct timespec *", "FAR struct timespec*"
"open","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","int","..."
"opendir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR DIR*","FAR const char*"
"pgalloc", "nuttx/arch.h", "defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)", "uintptr_t", "uintptr_t", "unsigned int"
"pgalloc", "nuttx/arch.h", "defined(CONFIG_BUILD_KERNEL)", "uintptr_t", "uintptr_t", "unsigned int"
"pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*"
"poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int"
"prctl","sys/prctl.h", "CONFIG_TASK_NAME_SIZE > 0","int","int","..."
Expand Down Expand Up @@ -124,7 +124,7 @@
"stat","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","FAR struct stat*"
#"statfs","stdio.h","","int","FAR const char*","FAR struct statfs*"
"statfs","sys/statfs.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","struct statfs*"
"task_create","sched.h","!defined(CONFIG_ARCH_ADDRENV)","int","FAR const char*","int","int","main_t","FAR char * const []|FAR char * const *"
"task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char*","int","int","main_t","FAR char * const []|FAR char * const *"
#"task_create","sched.h","","int","const char*","int","main_t","FAR char * const []|FAR char * const *"
"task_delete","sched.h","","int","pid_t"
"task_restart","sched.h","","int","pid_t"
Expand Down
4 changes: 2 additions & 2 deletions syscall/syscall_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ SYSCALL_LOOKUP(sem_trywait, 1, STUB_sem_trywait)
SYSCALL_LOOKUP(sem_unlink, 1, STUB_sem_unlink)
SYSCALL_LOOKUP(sem_wait, 1, STUB_sem_wait)
SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno)
#ifndef CONFIG_ARCH_ADDRENV
#ifndef CONFIG_BUILD_KERNEL
SYSCALL_LOOKUP(task_create, 5, STUB_task_create)
#elif defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)
#else
SYSCALL_LOOKUP(pgalloc, 2, STUB_pgalloc)
#endif
SYSCALL_LOOKUP(task_delete, 1, STUB_task_delete)
Expand Down

0 comments on commit 925fc9a

Please sign in to comment.