Misc fixes to repair some of the breakage to the SAMA5D4-EK elf configuration caused by changes for the knsh configuration
This commit is contained in:
parent
a20e584dab
commit
0fc55d042f
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/arch.h
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -137,6 +137,7 @@ struct group_addrenv_s
|
||||
|
||||
FAR uintptr_t *text[ARCH_TEXT_NSECTS];
|
||||
FAR uintptr_t *data[ARCH_DATA_NSECTS];
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
FAR uintptr_t *heap[ARCH_HEAP_NSECTS];
|
||||
|
||||
/* Initial heap allocation (in bytes). This exists only provide an
|
||||
@ -146,6 +147,7 @@ struct group_addrenv_s
|
||||
*/
|
||||
|
||||
size_t heapsize;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct group_addrenv_s group_addrenv_t;
|
||||
|
@ -510,6 +510,7 @@ int up_addrenv_create(size_t textsize, size_t datasize, size_t heapsize,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
/* Allocate heap space pages */
|
||||
|
||||
ret = up_addrenv_create_region(addrenv->heap, ARCH_HEAP_NSECTS,
|
||||
@ -526,6 +527,7 @@ int up_addrenv_create(size_t textsize, size_t datasize, size_t heapsize,
|
||||
*/
|
||||
|
||||
addrenv->heapsize = (size_t)ret << MM_PGSHIFT;
|
||||
#endif
|
||||
return OK;
|
||||
|
||||
errout:
|
||||
@ -564,12 +566,14 @@ int up_addrenv_destroy(FAR group_addrenv_t *addrenv)
|
||||
up_addrenv_destroy_region(addrenv->data, ARCH_DATA_NSECTS,
|
||||
CONFIG_ARCH_DATA_VBASE);
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
/* Destroy the heap region */
|
||||
|
||||
up_addrenv_destroy_region(addrenv->heap, ARCH_HEAP_NSECTS,
|
||||
CONFIG_ARCH_HEAP_VBASE);
|
||||
|
||||
memset(addrenv, 0, sizeof(group_addrenv_t));
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -654,11 +658,13 @@ int up_addrenv_vdata(FAR group_addrenv_t *addrenv, uintptr_t textsize,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
ssize_t up_addrenv_heapsize(FAR const group_addrenv_t *addrenv)
|
||||
{
|
||||
DEBUGASSERT(addrenv);
|
||||
return (ssize_t)addrenv->heapsize;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_addrenv_select
|
||||
@ -742,6 +748,7 @@ int up_addrenv_select(FAR const group_addrenv_t *addrenv,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
for (vaddr = CONFIG_ARCH_HEAP_VBASE, i = 0;
|
||||
i < ARCH_HEAP_NSECTS;
|
||||
vaddr += SECTION_SIZE, i++)
|
||||
@ -765,6 +772,7 @@ int up_addrenv_select(FAR const group_addrenv_t *addrenv,
|
||||
mmu_l1_clrentry(vaddr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -812,6 +820,7 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
|
||||
mmu_l1_restore(vaddr, oldenv->data[i]);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
for (vaddr = CONFIG_ARCH_HEAP_VBASE, i = 0;
|
||||
i < ARCH_HEAP_NSECTS;
|
||||
vaddr += SECTION_SIZE, i++)
|
||||
@ -820,6 +829,7 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
|
||||
|
||||
mmu_l1_restore(vaddr, oldenv->heap[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ static void exec_ctors(FAR void *arg)
|
||||
int exec_module(FAR const struct binary_s *binp)
|
||||
{
|
||||
FAR struct task_tcb_s *tcb;
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
|
||||
save_addrenv_t oldenv;
|
||||
#endif
|
||||
FAR uint32_t *stack;
|
||||
@ -165,7 +165,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
|
||||
/* Instantiate the address environment containing the user heap */
|
||||
|
||||
ret = up_addrenv_select(&binp->addrenv, &oldenv);
|
||||
@ -260,7 +260,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
goto errout_with_stack;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
|
||||
/* Restore the address environment of the caller */
|
||||
|
||||
ret = up_addrenv_restore(&oldenv);
|
||||
@ -281,10 +281,10 @@ errout_with_stack:
|
||||
goto errout;
|
||||
|
||||
errout_with_addrenv:
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
|
||||
(void)up_addrenv_restore(&oldenv);
|
||||
#endif
|
||||
errout_with_tcb:
|
||||
#endif
|
||||
kmm_free(tcb);
|
||||
errout:
|
||||
set_errno(err);
|
||||
|
@ -3707,13 +3707,13 @@ Configurations
|
||||
|
||||
4. A system call interface is enabled and the ELF test programs interface with the base RTOS code system calls. This eliminates the need for symbol tables to link with the base RTOS (symbol tables are still used, however, to interface with the common C library instaniation). Relevant configuration settings:
|
||||
|
||||
RTOS Features -> System call support
|
||||
CONFIG_LIB_SYSCALL=y : Enable system call support
|
||||
CONFIG_SYS_NNEST=2 : Max number of nested system calls
|
||||
CONFIG_SYS_RESERVED=1 : SYStem call 0 is reserved on this platform
|
||||
RTOS Features -> System call support
|
||||
CONFIG_LIB_SYSCALL=y : Enable system call support
|
||||
CONFIG_SYS_NNEST=2 : Max number of nested system calls
|
||||
CONFIG_SYS_RESERVED=1 : SYStem call 0 is reserved on this platform
|
||||
|
||||
Application Configurations -> Examples -> ELF Loader Example
|
||||
CONFIG_EXAMPLES_ELF_SYSCALL=y : Link apps with the SYStem call library
|
||||
Application Configurations -> Examples -> ELF Loader Example
|
||||
CONFIG_EXAMPLES_ELF_SYSCALL=y : Link apps with the SYStem call library
|
||||
|
||||
STATUS:
|
||||
2014-8-24: This configuration works with the address environment
|
||||
@ -3726,6 +3726,11 @@ Configurations
|
||||
http://www.nuttx.org/doku.php?id=wiki:nxinternal:memconfigs#task_create
|
||||
|
||||
2014-8-29: System call interface verified.
|
||||
2014-9-11: There has been some breakage due to changes for the knsh
|
||||
configuration. This test now hangs after running the first
|
||||
ELF program. With GDB I can see that the IDLE loop is running
|
||||
but apparently either ELF main program is deadlocked. Need to
|
||||
revisit.
|
||||
|
||||
knsh:
|
||||
An NSH configuration used to test the SAMA5D kenel build configuration.
|
||||
|
@ -368,6 +368,7 @@ CONFIG_PREALLOC_TIMERS=4
|
||||
#
|
||||
# Tasks and Scheduling
|
||||
#
|
||||
# CONFIG_INIT_NONE is not set
|
||||
CONFIG_INIT_ENTRYPOINT=y
|
||||
# CONFIG_INIT_FILEPATH is not set
|
||||
CONFIG_USER_ENTRYPOINT="elf_main"
|
||||
|
@ -47,26 +47,50 @@
|
||||
************************************************************************/
|
||||
/* How can we access the errno variable? */
|
||||
|
||||
#undef __DIRECT_ERRNO_ACCESS
|
||||
#if !defined(CONFIG_LIB_SYSCALL)
|
||||
/* No system calls? Then there can only be direct access */
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
|
||||
/* Flat build */
|
||||
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
|
||||
/* We still might be using system calls in user code. If so, then
|
||||
* user code will have no direct access to the errno variable.
|
||||
*/
|
||||
|
||||
#elif !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
|
||||
/* Flat build... complete access */
|
||||
# undef __DIRECT_ERRNO_ACCESS
|
||||
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
# else
|
||||
/* Flat build with no system calls OR internal kernel logic... There
|
||||
* is direct access.
|
||||
*/
|
||||
|
||||
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
||||
/* Kernel portion of protected build. The Kernel has access */
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
# endif
|
||||
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
#elif defined(CONFIG_BUILD_PROTECTED)
|
||||
# if defined(__KERNEL__)
|
||||
/* Kernel portion of protected build. Kernel code has direct access */
|
||||
|
||||
#elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
|
||||
/* Kernel only build. The kernel has access */
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
# else
|
||||
/* User portion of protected build. Application code has only indirect
|
||||
* access
|
||||
*/
|
||||
|
||||
# undef __DIRECT_ERRNO_ACCESS
|
||||
# endif
|
||||
|
||||
#elif defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__)
|
||||
# if defined(__KERNEL__)
|
||||
/* Kernel build. Kernel code has direct access */
|
||||
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
|
||||
# else
|
||||
/* User libraries for the kernel. Only indirect access from user
|
||||
* libraries */
|
||||
|
||||
# undef __DIRECT_ERRNO_ACCESS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Convenience/compatibility definition.
|
||||
|
Loading…
Reference in New Issue
Block a user