Add interfaces to dynamically change symbol tables used by posix_spawn, execv, and execl. This is needed for testing.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5506 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
04acfabe32
commit
4db4c1fd62
@ -182,6 +182,10 @@ ifeq ($(CONFIG_EXAMPLES_PWM),y)
|
|||||||
CONFIGURED_APPS += examples/pwm
|
CONFIGURED_APPS += examples/pwm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_EXAMPLES_POSIXSPAWN),y)
|
||||||
|
CONFIGURED_APPS += examples/posix_spawn
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_EXAMPLES_QENCODER),y)
|
ifeq ($(CONFIG_EXAMPLES_QENCODER),y)
|
||||||
CONFIGURED_APPS += examples/qencoder
|
CONFIGURED_APPS += examples/qencoder
|
||||||
endif
|
endif
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc
|
SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc
|
||||||
SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount
|
SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount
|
||||||
SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage
|
SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage
|
||||||
SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays
|
SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm posix_spawn qencoder
|
||||||
SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip
|
SUBDIRS += relays rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip
|
||||||
SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson
|
SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson
|
||||||
|
|
||||||
# Sub-directories that might need context setup. Directories may need
|
# Sub-directories that might need context setup. Directories may need
|
||||||
|
@ -329,10 +329,10 @@ examples/elf
|
|||||||
each program in the ROMFS file system is executed. Requires CONFIG_ELF.
|
each program in the ROMFS file system is executed. Requires CONFIG_ELF.
|
||||||
Other configuration options:
|
Other configuration options:
|
||||||
|
|
||||||
CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block.
|
CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block
|
||||||
For example, the N in /dev/ramN. Used for registering the RAM block driver
|
driver. For example, the N in /dev/ramN. Used for registering the RAM
|
||||||
that will hold the ROMFS file system containing the ELF executables to be
|
block driver that will hold the ROMFS file system containing the ELF
|
||||||
tested. Default: 0
|
executables to be tested. Default: 0
|
||||||
|
|
||||||
CONFIG_EXAMPLES_ELF_DEVPATH - The path to the ROMFS block driver device. This
|
CONFIG_EXAMPLES_ELF_DEVPATH - The path to the ROMFS block driver device. This
|
||||||
must match EXAMPLES_ELF_DEVMINOR. Used for registering the RAM block driver
|
must match EXAMPLES_ELF_DEVMINOR. Used for registering the RAM block driver
|
||||||
@ -348,7 +348,7 @@ examples/elf
|
|||||||
|
|
||||||
Similarly for C++ flags which must be provided in CXXELFFLAGS.
|
Similarly for C++ flags which must be provided in CXXELFFLAGS.
|
||||||
|
|
||||||
2. Your top-level nuttx/Make.defs file must alos include an approproate definition,
|
2. Your top-level nuttx/Make.defs file must also include an approproate definition,
|
||||||
LDELFFLAGS, to generate a relocatable ELF object. With GNU LD, this should
|
LDELFFLAGS, to generate a relocatable ELF object. With GNU LD, this should
|
||||||
include '-r' and '-e main' (or _main on some platforms).
|
include '-r' and '-e main' (or _main on some platforms).
|
||||||
|
|
||||||
@ -1202,6 +1202,80 @@ examples/poll
|
|||||||
|
|
||||||
CONFIGURED_APPS += uiplib
|
CONFIGURED_APPS += uiplib
|
||||||
|
|
||||||
|
examples/posix_spawn
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This is a simple test of the posix_spawn() API. The example derives from
|
||||||
|
examples/elf. As a result, these tests are built using the relocatable
|
||||||
|
ELF format installed in a ROMFS file system. At run time, the test program
|
||||||
|
in the ROMFS file system is spawned using posix_spawn().
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
|
||||||
|
CONFIG_BINFMT_DISABLE=n - Don't disable the binary loader
|
||||||
|
CONFIG_ELF=y - Enable ELF binary loader
|
||||||
|
CONFIG_LIBC_EXECFUNCS=y - Enable support for posix_spawn
|
||||||
|
CONFIG_EXECFUNCS_SYMTAB="exports" - The name of the symbol table
|
||||||
|
created by the test.
|
||||||
|
CONFIG_EXECFUNCS_NSYMBOLS=10 - Value does not matter, it will be
|
||||||
|
corrected at runtime.
|
||||||
|
CONFIG_POSIX_SPAWN_STACKSIZE=768 - This default setting.
|
||||||
|
|
||||||
|
Test-specific configuration options:
|
||||||
|
|
||||||
|
CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR - The minor device number of the ROMFS
|
||||||
|
block. driver. For example, the N in /dev/ramN. Used for registering the
|
||||||
|
RAM block driver that will hold the ROMFS file system containing the ELF
|
||||||
|
executables to be tested. Default: 0
|
||||||
|
|
||||||
|
CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH - The path to the ROMFS block driver
|
||||||
|
device. This must match EXAMPLES_POSIXSPAWN_DEVMINOR. Used for
|
||||||
|
registering the RAM block driver that will hold the ROMFS file system
|
||||||
|
containing the ELF executables to be tested. Default: "/dev/ram0"
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
|
||||||
|
1. CFLAGS should be provided in CELFFLAGS. RAM and FLASH memory regions
|
||||||
|
may require long allcs. For ARM, this might be:
|
||||||
|
|
||||||
|
CELFFLAGS = $(CFLAGS) -mlong-calls
|
||||||
|
|
||||||
|
Similarly for C++ flags which must be provided in CXXELFFLAGS.
|
||||||
|
|
||||||
|
2. Your top-level nuttx/Make.defs file must also include an approproate
|
||||||
|
definition, LDELFFLAGS, to generate a relocatable ELF object. With GNU
|
||||||
|
LD, this should include '-r' and '-e main' (or _main on some platforms).
|
||||||
|
|
||||||
|
LDELFFLAGS = -r -e main
|
||||||
|
|
||||||
|
If you use GCC to link, you make also need to include '-nostdlib' or
|
||||||
|
'-nostartfiles' and '-nodefaultlibs'.
|
||||||
|
|
||||||
|
3. This example also requires genromfs. genromfs can be build as part of the
|
||||||
|
nuttx toolchain. Or can built from the genromfs sources that can be found
|
||||||
|
at misc/tools/genromfs-0.5.2.tar.gz. In any event, the PATH variable must
|
||||||
|
include the path to the genromfs executable.
|
||||||
|
|
||||||
|
4. ELF size: The ELF files in this example are, be default, quite large
|
||||||
|
because they include a lot of "build garbage". You can greatly reduce the
|
||||||
|
size of the ELF binaries are using the 'objcopy --strip-unneeded' command to
|
||||||
|
remove un-necessary information from the ELF files.
|
||||||
|
|
||||||
|
5. Simulator. You cannot use this example with the the NuttX simulator on
|
||||||
|
Cygwin. That is because the Cygwin GCC does not generate ELF file but
|
||||||
|
rather some Windows-native binary format.
|
||||||
|
|
||||||
|
If you really want to do this, you can create a NuttX x86 buildroot toolchain
|
||||||
|
and use that be build the ELF executables for the ROMFS file system.
|
||||||
|
|
||||||
|
6. Linker scripts. You might also want to use a linker scripts to combine
|
||||||
|
sections better. An example linker script is at nuttx/binfmt/libelf/gnu-elf.ld.
|
||||||
|
That example might have to be tuned for your particular linker output to
|
||||||
|
position additional sections correctly. The GNU LD LDELFFLAGS then might
|
||||||
|
be:
|
||||||
|
|
||||||
|
LDELFFLAGS = -r -e main -T$(TOPDIR)/binfmt/libelf/gnu-elf.ld
|
||||||
|
|
||||||
examples/pwm
|
examples/pwm
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user