Verify PATH variable in apps/examples/elf

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5445 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-12-19 22:18:30 +00:00
parent 272fc3b523
commit db3e7613bc
8 changed files with 68 additions and 22 deletions

View File

@ -3799,3 +3799,5 @@
address environment interfaces. If CONFIG_ADDRENV=y, then binfmt/
will now create an address environment for new tasks (instead of
just malloc'ing the task memory).
* configs/stm32f4discovery/elf: Enable support/test of the PATH
to find executables using a relative path.

View File

@ -111,6 +111,7 @@ config ARCH_CHIP_STM32
select ARCH_HAVE_CMNVECTOR
select ARCH_HAVE_MPU
select ARCH_HAVE_I2CRESET
select ARCH_IRQPRIO
---help---
STMicro STM32 architectures (ARM Cortex-M3/4).

View File

@ -42,6 +42,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

View File

@ -146,11 +146,11 @@ int load_module(FAR struct binary_s *bin)
#endif
{
/* Were we given a relative path? Or an absolute path to the file to
* be loaded.
* be loaded? Absolute paths start with '/'.
*/
#ifdef CONFIG_BINFMT_EXEPATH
if (bin->filename[0] == '/')
if (bin->filename[0] != '/')
{
FAR const char *relpath;
FAR char *fullpath;
@ -168,7 +168,7 @@ int load_module(FAR struct binary_s *bin)
{
/* Get the next absolute file path */
while ((fullpath = exepath_next(handle, relpath)))
while ((fullpath = exepath_next(handle, relpath)) != NULL)
{
/* Try to load the file at this path */

View File

@ -83,7 +83,7 @@
****************************************************************************/
#ifdef CONFIG_BINFMT_CONSTRUCTORS
static inline void exec_dtors(FAR const struct binary_s *binp)
static inline int exec_dtors(FAR const struct binary_s *binp)
{
binfmt_dtor_t *dtor = binp->dtors;
#ifdef CONFIG_ADDRENV

View File

@ -64,7 +64,7 @@
****************************************************************************/
/****************************************************************************
* Name: elf_addrenv_create
* Name: elf_addrenv_alloc
*
* Description:
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
@ -83,7 +83,7 @@
*
****************************************************************************/
int elf_addrenv_create(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
{
#ifdef CONFIG_ADDRENV
FAR void *vaddr;

View File

@ -65,7 +65,7 @@
****************************************************************************/
/****************************************************************************
* Name: nxflat_addrenv_create
* Name: nxflat_addrenv_alloc
*
* Description:
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
@ -84,7 +84,7 @@
*
****************************************************************************/
int nxflat_addrenv_create(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
{
FAR struct dspace_s *dspace;
#ifdef CONFIG_ADDRENV

View File

@ -8,6 +8,14 @@ CONFIG_NUTTX_NEWCONFIG=y
# Build Setup
#
# CONFIG_EXPERIMENTAL is not set
# CONFIG_HOST_LINUX is not set
# CONFIG_HOST_OSX is not set
CONFIG_HOST_WINDOWS=y
# CONFIG_HOST_OTHER is not set
# CONFIG_WINDOWS_NATIVE is not set
CONFIG_WINDOWS_CYGWIN=y
# CONFIG_WINDOWS_MSYS is not set
# CONFIG_WINDOWS_OTHER is not set
#
# Build Configuration
@ -73,12 +81,24 @@ CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CORTEXM4=y
CONFIG_ARCH_FAMILY="armv7-m"
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_HAVE_CMNVECTOR=y
# CONFIG_ARMV7M_CMNVECTOR is not set
# CONFIG_ARCH_FPU is not set
CONFIG_ARCH_HAVE_MPU=y
# CONFIG_ARMV7M_MPU is not set
CONFIG_ARCH_IRQPRIO=y
CONFIG_BOARD_LOOPSPERMSEC=16717
# CONFIG_ARCH_CALIBRATION is not set
#
# ARMV7M Configuration Options
#
# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set
# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set
# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set
# CONFIG_SERIAL_TERMIOS is not set
#
@ -88,8 +108,14 @@ CONFIG_BOARD_LOOPSPERMSEC=16717
# CONFIG_ARCH_CHIP_STM32F100CB is not set
# CONFIG_ARCH_CHIP_STM32F100R8 is not set
# CONFIG_ARCH_CHIP_STM32F100RB is not set
# CONFIG_ARCH_CHIP_STM32F100RC is not set
# CONFIG_ARCH_CHIP_STM32F100RD is not set
# CONFIG_ARCH_CHIP_STM32F100RE is not set
# CONFIG_ARCH_CHIP_STM32F100V8 is not set
# CONFIG_ARCH_CHIP_STM32F100VB is not set
# CONFIG_ARCH_CHIP_STM32F100VC is not set
# CONFIG_ARCH_CHIP_STM32F100VD is not set
# CONFIG_ARCH_CHIP_STM32F100VE is not set
# CONFIG_ARCH_CHIP_STM32F103RET6 is not set
# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set
# CONFIG_ARCH_CHIP_STM32F103VET6 is not set
@ -107,13 +133,6 @@ CONFIG_ARCH_CHIP_STM32F407VG=y
# CONFIG_ARCH_CHIP_STM32F407IE is not set
# CONFIG_ARCH_CHIP_STM32F407IG is not set
CONFIG_STM32_STM32F40XX=y
CONFIG_STM32_CODESOURCERYW=y
# CONFIG_STM32_CODESOURCERYL is not set
# CONFIG_STM32_ATOLLIC_LITE is not set
# CONFIG_STM32_ATOLLIC_PRO is not set
# CONFIG_STM32_DEVKITARM is not set
# CONFIG_STM32_RAISONANCE is not set
# CONFIG_STM32_BUILDROOT is not set
# CONFIG_STM32_DFU is not set
#
@ -122,14 +141,14 @@ CONFIG_STM32_CODESOURCERYW=y
# CONFIG_STM32_ADC1 is not set
# CONFIG_STM32_ADC2 is not set
# CONFIG_STM32_ADC3 is not set
# CONFIG_STM32_CRC is not set
# CONFIG_STM32_DMA1 is not set
# CONFIG_STM32_DMA2 is not set
# CONFIG_STM32_BKPSRAM is not set
# CONFIG_STM32_CAN1 is not set
# CONFIG_STM32_CAN2 is not set
# CONFIG_STM32_CCMDATARAM is not set
# CONFIG_STM32_CRC is not set
# CONFIG_STM32_CRYP is not set
# CONFIG_STM32_DMA1 is not set
# CONFIG_STM32_DMA2 is not set
# CONFIG_STM32_DAC1 is not set
# CONFIG_STM32_DAC2 is not set
# CONFIG_STM32_DCMI is not set
@ -174,6 +193,7 @@ CONFIG_STM32_USART2=y
#
# Alternate Pin Mapping
#
# CONFIG_STM32_FLASH_PREFETCH is not set
# CONFIG_STM32_JTAG_DISABLE is not set
# CONFIG_STM32_JTAG_FULL_ENABLE is not set
# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
@ -182,6 +202,11 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
CONFIG_STM32_CCMEXCLUDE=y
#
# U[S]ART Configuration
#
# CONFIG_USART2_RS485 is not set
#
# USB Host Configuration
#
@ -191,7 +216,11 @@ CONFIG_STM32_CCMEXCLUDE=y
#
# CONFIG_ARCH_NOINTC is not set
# CONFIG_ARCH_DMA is not set
CONFIG_ARCH_IRQPRIO=y
# CONFIG_CUSTOM_STACK is not set
# CONFIG_ADDRENV is not set
CONFIG_ARCH_STACKDUMP=y
# CONFIG_ENDIAN_BIG is not set
#
# Board Settings
@ -280,7 +309,6 @@ CONFIG_PREALLOC_TIMERS=4
#
# Stack and heap information
#
# CONFIG_CUSTOM_STACK is not set
CONFIG_IDLETHREAD_STACKSIZE=1024
CONFIG_USERMAIN_STACKSIZE=2048
CONFIG_PTHREAD_STACK_MIN=256
@ -316,8 +344,6 @@ CONFIG_DEV_LOWCONSOLE=y
# CONFIG_16550_UART is not set
CONFIG_ARCH_HAVE_USART2=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_CONFIG_SERIAL_NPOLLWAITERS=2
CONFIG_USART2_SERIAL_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set
@ -381,12 +407,15 @@ CONFIG_MM_REGIONS=2
# Binary Formats
#
# CONFIG_BINFMT_DISABLE is not set
CONFIG_BINFMT_EXEPATH=y
CONFIG_PATH_INITIAL="/mnt/romfs"
# CONFIG_NXFLAT is not set
CONFIG_ELF=y
CONFIG_ELF_ALIGN_LOG2=2
CONFIG_ELF_STACKSIZE=2048
CONFIG_ELF_BUFFERSIZE=128
CONFIG_ELF_BUFFERINCR=32
# CONFIG_PIC is not set
CONFIG_BINFMT_CONSTRUCTORS=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
@ -410,10 +439,20 @@ CONFIG_ARCH_LOWPUTC=y
CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_ARCH_ROMGETC is not set
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
#
# Basic CXX Support
#
# CONFIG_C99_BOOL8 is not set
CONFIG_HAVE_CXX=y
# CONFIG_HAVE_CXXINITIALIZE is not set
# CONFIG_CXX_NEWLONG is not set
#
# uClibc++ Standard C++ Library
#
# CONFIG_UCLIBCXX is not set
#
# Application Configuration
#
@ -430,6 +469,7 @@ CONFIG_HAVE_CXX=y
# CONFIG_EXAMPLES_CAN is not set
# CONFIG_EXAMPLES_CDCACM is not set
# CONFIG_EXAMPLES_COMPOSITE is not set
# CONFIG_EXAMPLES_CXXTEST is not set
# CONFIG_EXAMPLES_DHCPD is not set
CONFIG_EXAMPLES_ELF=y
CONFIG_EXAMPLES_ELF_DEVMINOR=0
@ -440,6 +480,7 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0"
# CONFIG_EXAMPLES_HELLOXX is not set
# CONFIG_EXAMPLES_JSON is not set
# CONFIG_EXAMPLES_HIDKBD is not set
# CONFIG_EXAMPLES_KEYPADTEST is not set
# CONFIG_EXAMPLES_IGMP is not set
# CONFIG_EXAMPLES_LCDRW is not set
# CONFIG_EXAMPLES_MM is not set
@ -494,6 +535,7 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0"
#
# Networking Utilities
#
# CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_DHCPC is not set
# CONFIG_NETUTILS_DHCPD is not set
# CONFIG_NETUTILS_FTPC is not set