Merged patacongo/nuttx into master

This commit is contained in:
David Sidrane
2016-03-17 11:41:26 -10:00
1532 changed files with 70287 additions and 21010 deletions
+789 -22
View File
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# Directories.mk
#
# Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -124,6 +124,12 @@ else
OTHERDIRS += audio
endif
ifeq ($(CONFIG_DRIVERS_WIRELESS),y)
NONFSDIRS += wireless
else
OTHERDIRS += wireless
endif
# CLEANDIRS are the directories that will clean in. These are
# all directories that we know about.
# KERNDEPDIRS are the directories in which we will build target dependencies.
+7 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# FlatLibs.mk
#
# Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -109,6 +109,12 @@ ifeq ($(CONFIG_AUDIO),y)
NUTTXLIBS += lib$(DELIM)libaudio$(LIBEXT)
endif
# Add libraries for the Wireless sub-system
ifeq ($(CONFIG_WIRELESS),y)
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
endif
# Export all libraries
EXPORTLIBS = $(NUTTXLIBS)
+32 -1
View File
@@ -165,7 +165,7 @@ config BUILD_PROTECTED
config BUILD_KERNEL
bool "NuttX kernel build"
depends on ARCH_USE_MMU && ARCH_ADDRENV && EXPERIMENTAL
depends on ARCH_USE_MMU && ARCH_ADDRENV
select LIB_SYSCALL
---help---
Builds NuttX as a separately compiled kernel. No applications are
@@ -376,6 +376,12 @@ config ARCH_STDARG_H
ARCH_STDARG_H=y and providing. If ARCH_STDARG_H, is not defined, then
the stdarg.h header file will stay out-of-the-way in include/nuttx/.
config ARCH_DEBUG_H
bool "debug.h"
default n
---help---
The debug.h contains architecture dependent debugging primitives
endmenu # Customize Header Files
menu "Debug Options"
@@ -412,6 +418,7 @@ comment "Subsystem Debug Options"
config DEBUG_AUDIO
bool "Audio Device Debug Output"
default n
depends on AUDIO
---help---
Enable low level debug SYSLOG output from the audio subsystem and
device drivers. (disabled by default). Support for this debug option
@@ -420,6 +427,7 @@ config DEBUG_AUDIO
config DEBUG_BINFMT
bool "Binary Loader Debug Output"
default n
depends on !BINFMT_DISABLE
---help---
Enable binary loader debug SYSLOG output (disabled by default)
@@ -482,6 +490,15 @@ config DEBUG_SYSCALL
Enable very low level output related to system calls. This gives
you basically a poor man's version of strace.
config DEBUG_WIRELESS
bool "Wireless Device Debug Output"
default n
depends on WIRELESS
---help---
Enable low level debug SYSLOG output from the wireless subsystem and
device drivers. (disabled by default). Support for this debug option
is architecture-specific and may not be available for some MCUs.
comment "OS Function Debug Options"
config DEBUG_DMA
@@ -548,6 +565,16 @@ config DEBUG_INPUT
this debug option is board-specific and may not be available for
some boards.
config DEBUG_DISCRETE
bool "Discrete I/O Debug Output"
default n
depends on DISCRETE_IO
---help---
Enable low level debug SYSLOG output from the discrete I/O device
drivers such as LEDs and I/O expanders (disabled by default).
Support for this debug option is board-specific and may not be
available for some boards.
config DEBUG_ANALOG
bool "Analog Device Debug Output"
default n
@@ -766,6 +793,10 @@ menu "Audio Support"
source audio/Kconfig
endmenu
menu "Wireless Support"
source wireless/Kconfig
endmenu
menu "Binary Loader"
source binfmt/Kconfig
endmenu
+7 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# KernalLibs.mk
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -104,6 +104,12 @@ ifeq ($(CONFIG_AUDIO),y)
NUTTXLIBS += lib$(DELIM)libaudio$(LIBEXT)
endif
# Add libraries for the Wireless sub-system
ifeq ($(CONFIG_WIRELESS),y)
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
endif
# Export only the user libraries
EXPORTLIBS = $(USERLIBS)
+12 -7
View File
@@ -64,7 +64,6 @@ $(ARCH_SRC)$(DELIM)libkarch$(LIBEXT): context
lib$(DELIM)libkarch$(LIBEXT): $(ARCH_SRC)$(DELIM)libkarch$(LIBEXT)
$(Q) install $(ARCH_SRC)$(DELIM)libkarch$(LIBEXT) lib$(DELIM)libkarch$(LIBEXT)
sched$(DELIM)libsched$(LIBEXT): context
$(Q) $(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) KERNEL=y EXTRADEFINES=$(KDEFINE)
@@ -119,6 +118,18 @@ audio$(DELIM)libaudio$(LIBEXT): context
lib$(DELIM)libaudio$(LIBEXT): audio$(DELIM)libaudio$(LIBEXT)
$(Q) install audio$(DELIM)libaudio$(LIBEXT) lib$(DELIM)libaudio$(LIBEXT)
wireless$(DELIM)libwireless$(LIBEXT): context
$(Q) $(MAKE) -C wireless TOPDIR="$(TOPDIR)" libwireless$(LIBEXT) KERNEL=y EXTRADEFINES=$(KDEFINE)
lib$(DELIM)libwireless$(LIBEXT): wireless$(DELIM)libwireless$(LIBEXT)
$(Q) install wireless$(DELIM)libwireless$(LIBEXT) lib$(DELIM)libwireless$(LIBEXT)
$(ARCH_SRC)$(DELIM)libarch$(LIBEXT): context
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT) KERNEL=y EXTRADEFINES=$(KDEFINE)
lib$(DELIM)libarch$(LIBEXT): $(ARCH_SRC)$(DELIM)libarch$(LIBEXT)
$(Q) install $(ARCH_SRC)$(DELIM)libarch$(LIBEXT) lib$(DELIM)libarch$(LIBEXT)
# Special case
syscall$(DELIM)libstubs$(LIBEXT): context
@@ -190,9 +201,3 @@ mm$(DELIM)libmm$(LIBEXT): context
lib$(DELIM)libmm$(LIBEXT): mm$(DELIM)libmm$(LIBEXT)
$(Q) install mm$(DELIM)libmm$(LIBEXT) lib$(DELIM)libmm$(LIBEXT)
$(ARCH_SRC)$(DELIM)libarch$(LIBEXT): context
$(Q) $(MAKE) -C $(ARCH_SRC) TOPDIR="$(TOPDIR)" libarch$(LIBEXT)
lib$(DELIM)libarch$(LIBEXT): $(ARCH_SRC)$(DELIM)libarch$(LIBEXT)
$(Q) install $(ARCH_SRC)$(DELIM)libarch$(LIBEXT) lib$(DELIM)libarch$(LIBEXT)
+27 -11
View File
@@ -1,7 +1,7 @@
############################################################################
# Makefile.unix
#
# Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2012, 2014-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -72,9 +72,13 @@ ARCH_SRC = $(ARCH_DIR)/src
ARCH_INC = $(ARCH_DIR)/include
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y)
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
BOARD_DIR = $(TOPDIR)$(DELIM)$(CONFIG_ARCH_BOARD_CUSTOM_DIR)
else
BOARD_DIR = $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
endif
else
BOARD_DIR = $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)
endif
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
@@ -265,7 +269,10 @@ include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT)
# Targets used to create dependencies
tools/mkdeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkdeps$(HOSTEXEEXT)
tools/cnvwindeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" cnvwindeps$(HOSTEXEEXT)
# dirlinks, and helpers
#
@@ -456,12 +463,12 @@ download: $(BIN)
# pass1dep: Create pass1 build dependencies
# pass2dep: Create pass2 build dependencies
pass1dep: context tools/mkdeps$(HOSTEXEEXT)
pass1dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT)
$(Q) for dir in $(USERDEPDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \
done
pass2dep: context tools/mkdeps$(HOSTEXEEXT)
pass2dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT)
$(Q) for dir in $(KERNDEPDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend; \
done
@@ -473,19 +480,22 @@ pass2dep: context tools/mkdeps$(HOSTEXEEXT)
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
# README.txt file in the NuttX tools GIT repository for additional information.
config:
config: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf Kconfig
oldconfig:
oldconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf --oldconfig Kconfig
menuconfig:
olddefconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf --olddefconfig Kconfig
menuconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-mconf Kconfig
qconfig:
qconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-qconf Kconfig
gconfig:
gconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-gconf Kconfig
# export
@@ -556,11 +566,17 @@ endif
# as a convenience, the following targets are included to support housekeeping
# functions in the user application directory from the NuttX build directory.
#
# apps_preconfig: Prepare applications to be configured
# apps_clean: Perform the clean operation only in the user application
# directory
# apps_distclean: Perform the distclean operation only in the user application
# directory.
apps_preconfig:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" preconfig
endif
apps_clean:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" clean
+19 -6
View File
@@ -1,7 +1,7 @@
############################################################################
# Makefile.win
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -65,9 +65,13 @@ ARCH_SRC = $(ARCH_DIR)\src
ARCH_INC = $(ARCH_DIR)\include
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y)
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y)
BOARD_DIR = $(TOPDIR)$(DELIM)$(CONFIG_ARCH_BOARD_CUSTOM_DIR)
else
BOARD_DIR = $(TOPDIR)${DELIM}configs$(DELIM)$(CONFIG_ARCH_BOARD)
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
endif
else
BOARD_DIR = $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)
endif
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
@@ -476,13 +480,16 @@ pass2dep: context tools\mkdeps$(HOSTEXEEXT)
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
# misc\tools\README.txt for additional information.
config:
config: apps_preconfig
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& kconfig-conf Kconfig
oldconfig:
oldconfig: apps_preconfig
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& kconfig-conf --oldconfig Kconfig
menuconfig: configenv
olddefconfig: apps_preconfig
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& kconfig-conf --olddefconfig Kconfig
menuconfig: configenv apps_preconfig
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& kconfig-mconf Kconfig
# export
@@ -545,11 +552,17 @@ endif
# as a convenience, the following targets are included to support housekeeping
# functions in the user application directory from the NuttX build directory.
#
# apps_preconfig: Prepare applications to be configured
# apps_clean: Perform the clean operation only in the user application
# directory
# apps_distclean: Perform the distclean operation only in the user application
# directory.
apps_preconfig:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C "$(APPDIR)" TOPDIR="$(TOPDIR)" preconfig
endif
apps_clean:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C "$(APPDIR)" TOPDIR="$(TOPDIR)" clean
+7 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# ProtectedLibs.mk
#
# Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -114,6 +114,12 @@ ifeq ($(CONFIG_AUDIO),y)
NUTTXLIBS += lib$(DELIM)libaudio$(LIBEXT)
endif
# Add libraries for the Wireless sub-system
ifeq ($(CONFIG_WIRELESS),y)
NUTTXLIBS += lib$(DELIM)libwireless$(LIBEXT)
endif
# Export only the user libraries
EXPORTLIBS = $(USERLIBS)
+38 -12
View File
@@ -79,6 +79,10 @@ Installing Cygwin
the answer to that and so will continue to recommend installing
EVERYTHING.
You should certainly be able to omit "Science", "Math", and
"Publishing". You can try omitting KDE, Gnome, GTK, and other
graphics packages if you don't plan to use them.
After installing Cygwin, you will get lots of links for installed
tools and shells. I use the RXVT native shell. It is fast and reliable
and does not require you to run the Cygwin X server (which is neither
@@ -472,6 +476,16 @@ Refreshing Configurations
be? Enter ? in response to the 'make oldconfig' prompt and it will show
you the help text that goes with the option.
If you don't want to make any decisions are are willing to just accep the
recommended default value for each new configuration item, an even easier
way is:
make oldefconfig
The olddefconfig target will simply bring you configuration up to date with
the current Kconfig files, setting any new options to the default value.
No questions asked.
NuttX Configuration Tool
------------------------
@@ -1107,17 +1121,6 @@ Window Native Toolchain Issues
is not a long as you might think because there is no dependency checking
if you are using a native Windows toolchain. That bring us to #3:
3. Dependencies are not made when using Windows versions of the GCC on a POSIX
platform (i.e., Cygwin). This is because the dependencies are generated
using Windows paths which do not work with the Cygwin make.
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
If you are building natively on Windows, then no such conflict exists
and the best selection is:
MKDEP = $(TOPDIR)/tools/mkdeps.exe
General Pre-built Toolchain Issues
To continue with the list of "Window Native Toolchain Issues" we can add
@@ -1251,6 +1254,8 @@ nuttx/
|- configs/
| |- amber/
| | `- README.txt
| |- arduino-mega2560/
| | `- README.txt
| |- arduino-due/
| | `- README.txt
| |- avr32dev1/
@@ -1304,6 +1309,8 @@ nuttx/
| | `- README.txt
| |- kwikstik-k40/
| | `- README.txt
| |- launchxl-tms57004/
| | `- README.txt
| |- lincoln60/
| | `- README.txt
| |- lm3s6432-s2e/
@@ -1314,8 +1321,12 @@ nuttx/
| | `- README.txt
| |- lpc4330-xplorer/
| | `- README.txt
| |- lpc4337-ws/
| | `- README.txt
| |- lpc4357-evb/
| | `- README.txt
| |- lpc4370-link2/
| | `- README.txt
| |- lpcxpresso-lpc1115/
| | `- README.txt
| |- lpcxpresso-lpc1768/
@@ -1359,6 +1370,8 @@ nuttx/
| | `- README.txt
| |- olimex-stm32-h405/
| | `- README.txt
| |- olimex-stm32-h407/
| | `- README.txt
| |- olimex-stm32-p107/
| | `- README.txt
| |- olimex-stm32-p207/
@@ -1385,6 +1398,10 @@ nuttx/
| | `- README.txt
| |- rgmp/
| | `- README.txt
| |- sabre-6quad/
| | `- README.txt
| |- sama5d2-xult/
| | `- README.txt
| |- sama5d3x-ek/
| | `- README.txt
| |- sama5d3-xplained/
@@ -1407,9 +1424,12 @@ nuttx/
| | `- README.txt
| |- sam4s-xplained-pro/
| | `- README.txt
| |- samv7i-xult/
| |- same70-xplained/
| | `- README.txt
| |- samv71-xult/
| | `- README.txt
| |- sim/
| | |- include/README.txt
| | `- README.txt
| |- shenzhou/
| | `- README.txt
@@ -1453,6 +1473,8 @@ nuttx/
| | `- README.txt
| |- twr-k60n512/
| | `- README.txt
| |- u-blox-co27/
| | `- README.txt
| |- ubw32/
| | `- README.txt
| |- us7032evb1/
@@ -1538,6 +1560,8 @@ apps/
| |- json/README.txt
| |- pashello/README.txt
| `- README.txt
|- gpsutils/
| `- minmea/README.txt
|- graphics/
| `- tiff/README.txt
|- interpreters/
@@ -1573,6 +1597,8 @@ apps/
| | `- README.txt
| |- nxplayer
| | `- README.txt
| |- symtab/
| | `- README.txt
| |- usbmsc
| | `- README.txt
| |- zmodem
+1209 -1
View File
File diff suppressed because it is too large Load Diff
+138 -132
View File
@@ -1,4 +1,5 @@
NuttX TODO List (Last updated August 6, 2015)
NuttX TODO List (Last updated February 18, 2016)
NuttX TODO List (Last updated February 18, 2016)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -9,27 +10,29 @@ issues reated to each board port.
nuttx/
(12) Task/Scheduler (sched/)
(13) Task/Scheduler (sched/)
(1) Memory Management (mm/)
(3) Signals (sched/signal, arch/)
(2) pthreads (sched/pthread)
(0) Message Queues (sched/mqueue)
(4) C++ Support
(6) Kernel/Protected Build
(3) C++ Support
(6) Binary loaders (binfmt/)
(12) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(12) Libraries (libc/, libm/)
(0) Other drivers (drivers/)
(11) Libraries (libc/, libm/)
(11) File system/Generic drivers (fs/, drivers/)
(8) Graphics subsystem (graphics/)
(1) Pascal add-on (pcode/)
(2) Build system / Toolchains
(3) Linux/Cywgin simulation (arch/sim)
(5) ARM (arch/arm/)
(1) Build system / Toolchains
(4) Linux/Cywgin simulation (arch/sim)
(4) ARM (arch/arm/)
apps/
(4) Network Utilities (apps/netutils/)
(3) NuttShell (NSH) (apps/nshlib)
(3) Network Utilities (apps/netutils/)
(2) NuttShell (NSH) (apps/nshlib)
(1) System libraries apps/system (apps/system)
(4) Other Applications & Tests (apps/examples/)
@@ -213,6 +216,27 @@ o Task/Scheduler (sched/)
Status: Open
Priority: Medium-ish
Title: SCALABILITY
Description: Task control information is retained in simple lists. This
is completely appropriate for small embedded systems where
the number of tasks, N, is relatively small. Most list
operations are O(N). This could become as issue if N gets
very large.
In that case, these simple lists should be replaced with
something more performant such as a balanced tree in the
case of ordered lists. Fortunately, most internal lists are
hidden behind simple accessor functions and so the internal
data structures can be changed if need with very little impact.
Explicity refereence to the list strucutre are hidden behnid
the macro this_task().
Status: Open
Priority: Low. Things are just the way that we want them for the way
that NuttX is used today.
o Memory Managment (mm/)
^^^^^^^^^^^^^^^^^^^^^^
@@ -314,9 +338,17 @@ o Signals (sched/signal, arch/)
embedded system.
Title: SIGEV_THREAD
Description: sig_notify() logic does not support SIGEV_THREAD; structure
struct sigevent does not provide required members sigev_notify_function
or sigev_notify_attributes.
Description: Implementation of support for support for SIGEV_THREAD is available
only in the FLAT build mode because it uses the OS work queues to
perform the callback. The alternative for the PROTECTED and KERNEL
builds would be to create pthreads in the user space to perform the
callbacks. That is not a very attractive solution due to performance
issues. It would also require some additional logic to specify the
TCB of the parent so that the pthread could be bound to the correct
group.
There is also some user-space logic in libc/aio/lio_listio.c. That
logic could use the user-space work queue for the callbacks.
Status: Low, there are alternative designs. However, these features
are required by the POSIX standard.
Priority: Low for now
@@ -414,36 +446,20 @@ o Kernel/Protected Build
COMMAND KERNEL INTERFACE(s)
-------- ----------------------------------------------
losetup losetup(), loteardown()
mkfatfs mkfatfs
mkrd ramdisk_register()
dd bchlib_setup(), bchlib_read(), bchlib_write(),
bchlib_teardown()
ps sched_foreach()
ifup netdev_foreach()
ifdown netdev_foreach()
ifconfig netdev_foreach(), g_netstats
ping icmp_ping()
The busybox mkfatfs does not involve any OS calls; it does
its job by simply opening the block driver (using open/xopen)
and modifying it with write operations. See:
http://git.busybox.net/busybox/tree/util-linux/mkfs_vfat.c
Status: Open
Priority: Medium/High -- the kernel build configuration is not fully fielded
yet.
Title: NSH free COMMAND LIMITATION
Description: The NSH 'free' command only shows memory usage in the user
heap only, not usage in the kernel heap. I am thinking that
kernel heap memory usage should be available in /proc/memory.
Status: Open
Priority: Medium/High
Title: TELNETD PARTITIONING.
Description: Telnetd is implemented as a driver that resides in the apps/
directory. In the kernel/protected build modes, the driver
logic must be moved into the kernel part of the build (nuttx/,
although the application level interfaces must stay in apps/).
Status: Open
Priority: Medium
Title: NxTERM PARTITIONING.
Description: NxTerm is implemented (correctly) as a driver that resides
in the nuttx/ directory. However, the user interfaces must be
@@ -508,6 +524,10 @@ o Kernel/Protected Build
console output. The requests for the pid() are part of the
implementation of the I/O's re-entrant semaphore implementation and
would not be an issue in the more general case.
Update:
One solution might be to used CONFIG_TLS, add the PID to struct
tls_info_s. Then the PID could be obtained without a system call.
Status: Open
Priority: Low-Medium. Right now, I do not know if these syscalls are a
real performance issue or not. The above statistics were collected
@@ -563,20 +583,6 @@ o C++ Support
would be to get a hold of the compilers definition of size_t.
Priority: Low.
Title: STATIC CONSTRUCTORS
Description: Need to call static constructors
Update: Static constructors are implemented for the STM32 F4 and
this will provide the model for all solutions. Basically, if
CONFIG_HAVE_CXXINITIALIZE=y is defined in the configuration, then
board-specific code must provide the interface up_cxxinitialize().
up_cxxinitialize() is called from application logic to initialize
all static class instances. This TODO item probably has to stay
open because this solution is only available on STM32 F4.
Status: Open
Priority: Low, depends on toolchain. Call to gcc's built-in static
constructor logic will probably have to be performed by
user logic in the application.
Title: STATIC CONSTRUCTORS AND MULTITASKING
Description: The logic that calls static constructors operates on the main
thread of the initial user application task. Any static
@@ -801,25 +807,6 @@ o Network (net/, drivers/net)
Status: Open
Priority: Low
Title: STANDARDIZE ETHERNET DRIVER STATISTICS
Description: Need to standardize collection of statistics from network
drivers. Currently they are useless because they are not
accessible. The solution is to standardize the structure
that holds the drivers statistics. Then apps/nshlib
ifconfig command could present the driver statistics.
Currently these drivers support non-standard statistics:
arch/arm/src/kinetis/kinetis_enet.c
arch/arm/src/lpc17xx/lpc17_ethernet.c
arch/arm/src/tiva/lm3s_ethernet.c
arch/mips/src/pic32mx/pic32mx-ethernet.c
arch/z80/src/ez80/ez80_emac.c
The other Ethernet drivers support no statistics.
Status: Open
Priority: Low. This is not a bug but an enhancement idea.
Title: CONCURRENT TCP SEND OPERATIONS
Description: At present, there cannot be two concurrent active TCP send
operations in progress using the same socket. This is because
@@ -990,6 +977,12 @@ o Network (net/, drivers/net)
Priority: Low. I don't know of any issues now, but I am sure that
someone will encounter this in the future.
Title: MISSING netdb INTERFACES
Description: There is no implementation for many netdb interfaces such as
getaddrinfo(), freeaddrinfo(), getnameinfo(), etc.
Status: Open
Priority: Low
o USB (drivers/usbdev, drivers/usbhost)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1197,11 +1190,6 @@ o Libraries (libc/)
Status: Open
Priority: Low
Title: DAYS OF THE WEEK
Description: strftime() and other timing functions do not handle days of the week.
Status: Open
Priority: Low
Title: RESETTING GETOPT()
Description: There is an issue with the way that getopt() handles errors that
return '?'.
@@ -1293,12 +1281,16 @@ o Libraries (libc/)
it does not return at all as the loop in it does not
converge, hanging your app.
"There are likely many other issues like these as the Rhombs
"There are likely many other issues like these as the Rhombus
OS code has not been tested or used that much. Sorry for not
providing patches, but we found it easier just to switch the
math library."
Ref: https://groups.yahoo.com/neo/groups/nuttx/conversations/messages/7805
UPDATE: 2015-09-01: A fix for the noted problems with asin()
has been applied.
Status: Open
Priority: Low for casual users but clearly high if you need care about
these incorrect corner case behaviors in the math libraries.
@@ -1308,8 +1300,8 @@ o File system / Generic drivers (fs/, drivers/)
NOTE: The NXFFS file system has its own TODO list at nuttx/fs/nxffs/README.txt
Title: CHMOD() AND TRUNCATE()
Description: Implement chmod(), truncate().
Title: CHMOD(), TRUNCATE(), AND FSTAT()
Description: Implement chmod(), truncate(), and fstat().
Status: Open
Priority: Low
@@ -1545,6 +1537,7 @@ o Graphics subsystem (graphics/)
Status: Open
Priority: Low, not a serious issue but worth noting. There is no plan
to change this behavior.
o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^
@@ -1568,16 +1561,6 @@ o Pascal Add-On (pcode/)
o Build system
^^^^^^^^^^^^
Title: WINDOWS DEPENDENCY GENERATION
Description: Dependency generation is currently disabled when a Windows native
toolchain is used in a POSIX-like environment (like Cygwin). The
issue is that the Windows tool generates dependencies use Windows
path formatting and this fails with the dependency file (Make.dep)
is include). Perhaps the only issue is that all of the Windows
dependencies needed to be quoted in the Make.dep files.
Status: Open
Priority: Low -- unless some dependency-related build issues is discovered.
Title: MAKE EXPORT LIMITATIONS
Description: The top-level Makefile 'export' target that will bundle up all of the
NuttX libraries, header files, and the startup object into an export-able
@@ -1591,6 +1574,9 @@ o Build system
Status: Open
Priority: Low.
o Other drivers (drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^
o Linux/Cywgin simulation (arch/sim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1623,18 +1609,81 @@ o Linux/Cywgin simulation (arch/sim)
"faked" during IDLE loop processing and, as a result, there is no
task pre-emption because there are no asynchronous events. This could
probably be fixed if the "timer interrupt" were driver by Linux
signals. NOTE: You would also have to implement irqsave() and
irqrestore() to block and (conditionally) unblock the signal.
signals. NOTE: You would also have to implement up_irq_save() and
up_irq_restore() to block and (conditionally) unblock the signal.
Status: Open
Priority: Low
Title: SMP SIMULATION ISSUES
Description: The configuration has basic support SMP testing. The simulation
supports the emulation of multiple CPUs by creating multiple
pthreads, each run a copy of the simulation in the same process
address space.
At present, the SMP simulation is not fully functional: It does
operate on the simulated CPU threads for a few context switches
then fails during a setjmp() operation. I suspect that this is
not an issue with the NuttX SMP logic but more likely some chaos
in the pthread controls. I have seen similar such strange behavior
other times that I have tried to use setjmp/longmp from a signal
handler! Like when I tried to implement simulated interrupts
using signals.
Apparently, if longjmp is invoked from the context of a signal
handler, the result is undefined:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1318.htm
You can enable SMP for ostest configuration by enabling:
-# CONFIG_EXPERIMENTAL is not set
+CONFIG_EXPERIMENTAL=y
+CONFIG_SPINLOCK=y
+CONFIG_SMP=y
+CONFIG_SMP_NCPUS=2
+CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
You also must enable near-realtime-performance otherwise even long
timeouts will expire before a CPU thread even has a chance to
execute.
-# CONFIG_SIM_WALLTIME is not set
+CONFIG_SIM_WALLTIME=y
And you can enable some additional debug output with:
-# CONFIG_DEBUG_SCHED is not set
+CONFIG_DEBUG_SCHED=y
-# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_SCHED_INSTRUMENTATION=y
The NSH configuration can also be forced to run SMP, but
suffers from the same quirky behavior. I can be made
reliable if you modify arch/sim/src/up_idle.c so that
the IDLE loop only runs for CPU0. Otherwise, often
simuart_post() will be called from CPU1 and it will try
to restart NSH on CPU0 and, again, the same quirkiness
occurs.
But for example, this command:
nsh> sleep 1 &
will execute the sleep command on CPU1 which has worked
every time that I have tried it (which is not too many
times).
Status: Open
Priority: Low, SMP is important, but SMP on the simulator is not
o ARM (arch/arm/)
^^^^^^^^^^^^^^^
Title: IMPROVED ARM INTERRUPT HANDLING
Description: ARM interrupt handling performance could be improved in some
ways. One easy way is to use a pointer to the context save
area in current_regs instead of using up_copystate so much.
area in g_current_regs instead of using up_copystate so much.
This approach is already implemented for the ARM Cortex-M0,
Cortex-M3, Cortex-M4, and Cortex-A5 families. But still needs
@@ -1694,31 +1743,6 @@ o ARM (arch/arm/)
If your design needs continuous interrupts like this, please try
the above change and, please, submit a patch with the working fix.
Title: STACK ALIGNMENT IN INTERRUPT HANDLERS
Description: The EABI standard requires that the stack always have a 32-byte
alignment. There is no guarantee at present that the stack will be
so aligned in an interrupt handler. Therefore, I would expect some
issues if, for example, floating point or perhaps long long operations
were performed in an interrupt handler.
This issue exists for ARM7, ARM9, Cortex-M0, Cortex-M3, and
Cortex-M4 but has been addressed for the Cortex-A5. The fix
is really simple can cannot be incorporated without some
substantial testing. For ARM, the fix is the following logic
arround each call into C code from assembly:
mov r4, sp /* Save the SP in a preserved register */
bic sp, sp, #7 /* Force 8-byte alignment */
bl cfunction /* Call the C function */
mov sp, r4 /* Restore the possibly unaligned stack pointer */
This same issue applies to the interrupt stack which is, I think
improperly aligned in almost all cases (except Cortex-A5).
Status: Open
Priority: Low for me because I never do floating point operations in
interrupt handlers.
Title: IMPROVED TASK START-UP AND SYSCALL RETURN
Description: Couldn't up_start_task and up_start_pthread syscalls be
eliminated. Wouldn't this work to get us from kernel-
@@ -1758,18 +1782,6 @@ o Network Utilities (apps/netutils/)
Status: Open. An annoyance, but not a real problem.
Priority: Low
Title: DHCPD ACCESSES KERNEL PRIVATE INTERFACE
Description: arp_update() is referenced outside of nuttx/net. It is used in
in the netutils/ DHCPD logic to set entries in the ARP table.
That is violation of the separation of kernel and OS
functionality. As a consequence, dhcpd will not work with the
NuttX kernel built.
This direct OS call needs to be replaced with a network ioctl()
call.
Status: Open
Priority: Medium. Important for full functionality with kernel build.
Title: NETWORK MONITOR NOT GENERALLY AVAILABLE
Description: The NSH network management logic has general applicability
but is currently useful only because it is embedded in the NSH
@@ -1787,13 +1799,7 @@ o NuttShell (NSH) (apps/nshlib)
show status for the single interface on the command line; it will
still show status for all interfaces.
Status: Open
Priority: Low (multiple network interfaces not fully supported yet anyway).
Title: ARP COMMAND
Description: Add an ARP command so that we can see and modify the contents of
the ARP table.
Status: Open
Priority: Low (enhancement)
Priority: Low
Title: ARPPING COMMAND
Description: Add an arping command
+1 -1
Submodule arch updated: 6190d66466...feb41dfa8e
+10
View File
@@ -0,0 +1,10 @@
/Make.dep
/.depend
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src
+6 -6
View File
@@ -379,7 +379,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case AUDIOIOC_GETCAPS:
{
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s*)((uintptr_t)arg);
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s *)((uintptr_t)arg);
DEBUGASSERT(lower->ops->getcaps != NULL);
audvdbg("AUDIOIOC_GETCAPS: Device=%d\n", caps->ac_type);
@@ -393,7 +393,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case AUDIOIOC_CONFIGURE:
{
FAR const struct audio_caps_desc_s *caps =
(FAR const struct audio_caps_desc_s*)((uintptr_t)arg);
(FAR const struct audio_caps_desc_s *)((uintptr_t)arg);
DEBUGASSERT(lower->ops->configure != NULL);
audvdbg("AUDIOIOC_INITIALIZE: Device=%d\n", caps->caps.ac_type);
@@ -873,11 +873,11 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)
char path[AUDIO_MAX_DEVICE_PATH];
static bool dev_audio_created = false;
#ifndef CONFIG_AUDIO_CUSTOM_DEV_PATH
const char* devname = "/dev/audio";
FAR const char *devname = "/dev/audio";
#elif !defined(CONFIG_AUDIO_DEV_ROOT)
const char* devname = CONFIG_AUDIO_DEV_PATH;
const char* ptr;
char* pathptr;
FAR const char *devname = CONFIG_AUDIO_DEV_PATH;
FAR const char *ptr;
FAR char *pathptr;
#endif
/* Allocate the upper-half data structure */
+17 -17
View File
@@ -259,23 +259,23 @@ static void pcm_callback(FAR void *arg, uint16_t reason,
#ifdef CONFIG_PCM_DEBUG
static void pcm_dump(FAR const struct wav_header_s *wav)
{
dbg( "Wave file header\n");
dbg( " Header Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->hdr.chunkid);
dbg( " Chunk Size: %u\n", wav->hdr.chunklen);
dbg( " Format: 0x%08x\n", wav->hdr.format);
dbg( " Format Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->fmt.chunkid);
dbg( " Chunk Size: %u\n", wav->fmt.chunklen);
dbg( " Audio Format: 0x%04x\n", wav->fmt.format);
dbg( " Num. Channels: %d\n", wav->fmt.nchannels);
dbg( " Sample Rate: %u\n", wav->fmt.samprate);
dbg( " Byte Rate: %u\n", wav->fmt.byterate);
dbg( " Block Align: %d\n", wav->fmt.align);
dbg( " Bits Per Sample: %d\n", wav->fmt.bpsamp);
dbg( " Data Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->data.chunkid);
dbg( " Chunk Size: %u\n", wav->data.chunklen);
dbg("Wave file header\n");
dbg(" Header Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->hdr.chunkid);
dbg(" Chunk Size: %u\n", wav->hdr.chunklen);
dbg(" Format: 0x%08x\n", wav->hdr.format);
dbg(" Format Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->fmt.chunkid);
dbg(" Chunk Size: %u\n", wav->fmt.chunklen);
dbg(" Audio Format: 0x%04x\n", wav->fmt.format);
dbg(" Num. Channels: %d\n", wav->fmt.nchannels);
dbg(" Sample Rate: %u\n", wav->fmt.samprate);
dbg(" Byte Rate: %u\n", wav->fmt.byterate);
dbg(" Block Align: %d\n", wav->fmt.align);
dbg(" Bits Per Sample: %d\n", wav->fmt.bpsamp);
dbg(" Data Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->data.chunkid);
dbg(" Chunk Size: %u\n", wav->data.chunklen);
}
#endif
+2 -7
View File
@@ -1,7 +1,7 @@
############################################################################
# nxflat/Makefile
#
# Copyright (C) 2007-2009, 2012-2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2009, 2012-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@ CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(TOPDIR)$(DELIM)sched"}
BINFMT_ASRCS =
BINFMT_CSRCS = binfmt_globals.c binfmt_register.c binfmt_unregister.c
BINFMT_CSRCS += binfmt_loadmodule.c binfmt_unloadmodule.c binfmt_execmodule.c
BINFMT_CSRCS += binfmt_exec.c binfmt_dumpmodule.c
BINFMT_CSRCS += binfmt_exec.c binfmt_copyargv.c binfmt_dumpmodule.c
ifeq ($(CONFIG_BINFMT_EXEPATH),y)
BINFMT_CSRCS += binfmt_exepath.c
@@ -56,11 +56,6 @@ ifeq ($(CONFIG_SCHED_HAVE_PARENT),y)
BINFMT_CSRCS += binfmt_schedunload.c
endif
# Symbol table source files
BINFMT_CSRCS += symtab_findbyname.c symtab_findbyvalue.c
BINFMT_CSRCS += symtab_findorderedbyname.c symtab_findorderedbyvalue.c
ifeq ($(CONFIG_LIBC_EXECFUNCS),y)
BINFMT_CSRCS += binfmt_execsymtab.c
endif
+26 -6
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* binfmt/binfmt_internal.h
* binfmt/binfmt.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __BINFMT_BINFMT_INTERNAL_H
#define __BINFMT_BINFMT_INTERNAL_H
#ifndef __BINFMT_BINFMT_H
#define __BINFMT_BINFMT_H
/****************************************************************************
* Included Files
@@ -68,9 +68,9 @@ extern "C"
EXTERN FAR struct binfmt_s *g_binfmts;
/***********************************************************************
/****************************************************************************
* Public Function Prototypes
***********************************************************************/
****************************************************************************/
/****************************************************************************
* Name: dump_module
@@ -92,6 +92,26 @@ int dump_module(FAR const struct binary_s *bin);
# define dump_module(bin)
#endif
/****************************************************************************
* Name: binfmt_copyargv
*
* Description:
* In the kernel build, the argv list will likely lie in the caller's
* address environment and, hence, by inaccessible when we swith to the
* address environment of the new process address environment. So we
* do not have any real option other than to copy the callers argv[] list.
*
* Input Parameter:
* bin - Load structure
* argv - Argument list
*
* Returned Value:
* Zero (OK) on sucess; a negater erro value on failure.
*
****************************************************************************/
int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv);
/****************************************************************************
* Name: binfmt_freeargv
*
@@ -117,5 +137,5 @@ void binfmt_freeargv(FAR struct binary_s *bin);
}
#endif
#endif /* __BINFMT_BINFMT_INTERNAL_H */
#endif /* __BINFMT_BINFMT_H */
+197
View File
@@ -0,0 +1,197 @@
/****************************************************************************
* binfmt/binfmt_copyargv.c
*
* Copyright (C) 2009, 2013-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <string.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* This is an artificial limit to detect error conditions where an argv[]
* list is not properly terminated.
*/
#define MAX_EXEC_ARGS 256
/****************************************************************************
* Public Function
****************************************************************************/
/****************************************************************************
* Name: binfmt_copyargv
*
* Description:
* In the kernel build, the argv list will likely lie in the caller's
* address environment and, hence, by inaccessible when we switch to the
* address environment of the new process address environment. So we
* do not have any real option other than to copy the callers argv[] list.
*
* Input Parameter:
* bin - Load structure
* argv - Argument list
*
* Returned Value:
* Zero (OK) on sucess; a negater erro value on failure.
*
****************************************************************************/
int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv)
{
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
FAR char *ptr;
size_t argvsize;
size_t argsize;
int nargs;
int i;
/* Get the number of arguments and the size of the argument list */
bin->argv = (FAR char **)NULL;
bin->argbuffer = (FAR char *)NULL;
if (argv)
{
argsize = 0;
nargs = 0;
for (i = 0; argv[i]; i++)
{
/* Increment the size of the allocation with the size of the next string */
argsize += (strlen(argv[i]) + 1);
nargs++;
/* This is a sanity check to prevent running away with an unterminated
* argv[] list. MAX_EXEC_ARGS should be sufficiently large that this
* never happens in normal usage.
*/
if (nargs > MAX_EXEC_ARGS)
{
bdbg("ERROR: Too many arguments: %lu\n", (unsigned long)argvsize);
return -E2BIG;
}
}
bvdbg("args=%d argsize=%lu\n", nargs, (unsigned long)argsize);
/* Allocate the argv array and an argument buffer */
if (argsize > 0)
{
argvsize = (nargs + 1) * sizeof(FAR char *);
bin->argbuffer = (FAR char *)kmm_malloc(argvsize + argsize);
if (!bin->argbuffer)
{
bdbg("ERROR: Failed to allocate the argument buffer\n");
return -ENOMEM;
}
/* Copy the argv list */
bin->argv = (FAR char **)bin->argbuffer;
ptr = bin->argbuffer + argvsize;
for (i = 0; argv[i]; i++)
{
bin->argv[i] = ptr;
argsize = strlen(argv[i]) + 1;
memcpy(ptr, argv[i], argsize);
ptr += argsize;
}
/* Terminate the argv[] list */
bin->argv[i] = (FAR char *)NULL;
}
}
return OK;
#else
/* Just save the caller's argv pointer */
bin->argv = argv;
return OK;
#endif
}
/****************************************************************************
* Name: binfmt_freeargv
*
* Description:
* Release the copied argv[] list.
*
* Input Parameter:
* binp - Load structure
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
void binfmt_freeargv(FAR struct binary_s *binp)
{
/* Is there an allocated argument buffer */
if (binp->argbuffer)
{
/* Free the argument buffer */
kmm_free(binp->argbuffer);
}
/* Nullify the allocated argv[] array and the argument buffer pointers */
binp->argbuffer = (FAR char *)NULL;
binp->argv = (FAR char **)NULL;
}
#endif
#endif /* !CONFIG_BINFMT_DISABLE */
+5 -5
View File
@@ -45,7 +45,7 @@
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_BINFMT) && !defined(CONFIG_BINFMT_DISABLE)
@@ -65,11 +65,11 @@
* Private Functions
****************************************************************************/
/***********************************************************************
/****************************************************************************
* Public Functions
***********************************************************************/
****************************************************************************/
/***********************************************************************
/****************************************************************************
* Name: dump_module
*
* Description:
@@ -80,7 +80,7 @@
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
***********************************************************************/
****************************************************************************/
int dump_module(FAR const struct binary_s *bin)
{
+1 -120
View File
@@ -46,129 +46,10 @@
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* This is an artificial limit to detect error conditions where an argv[]
* list is not properly terminated.
*/
#define MAX_EXEC_ARGS 256
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: binfmt_copyargv
*
* Description:
* In the kernel build, the argv list will likely lie in the caller's
* address environment and, hence, by inaccessible when we swith to the
* address environment of the new process address environment. So we
* do not have any real option other than to copy the callers argv[] list.
*
* Input Parameter:
* bin - Load structure
* argv - Argument list
*
* Returned Value:
* Zero (OK) on sucess; a negater erro value on failure.
*
****************************************************************************/
static inline int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv)
{
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
FAR char *ptr;
size_t argvsize;
size_t argsize;
int nargs;
int i;
/* Get the number of arguments and the size of the argument list */
bin->argv = (FAR char **)NULL;
bin->argbuffer = (FAR char *)NULL;
if (argv)
{
argsize = 0;
nargs = 0;
for (i = 0; argv[i]; i++)
{
/* Increment the size of the allocation with the size of the next string */
argsize += (strlen(argv[i]) + 1);
nargs++;
/* This is a sanity check to prevent running away with an unterminated
* argv[] list. MAX_EXEC_ARGS should be sufficiently large that this
* never happens in normal usage.
*/
if (nargs > MAX_EXEC_ARGS)
{
bdbg("ERROR: Too many arguments: %lu\n", (unsigned long)argvsize);
return -E2BIG;
}
}
bvdbg("args=%d argsize=%lu\n", nargs, (unsigned long)argsize);
/* Allocate the argv array and an argument buffer */
if (argsize > 0)
{
argvsize = (nargs + 1) * sizeof(FAR char *);
bin->argbuffer = (FAR char *)kmm_malloc(argvsize + argsize);
if (!bin->argbuffer)
{
bdbg("ERROR: Failed to allocate the argument buffer\n");
return -ENOMEM;
}
/* Copy the argv list */
bin->argv = (FAR char **)bin->argbuffer;
ptr = bin->argbuffer + argvsize;
for (i = 0; argv[i]; i++)
{
bin->argv[i] = ptr;
argsize = strlen(argv[i]) + 1;
memcpy(ptr, argv[i], argsize);
ptr += argsize;
}
/* Terminate the argv[] list */
bin->argv[i] = (FAR char *)NULL;
}
}
return OK;
#else
/* Just save the caller's argv pointer */
bin->argv = argv;
return OK;
#endif
}
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
+3 -3
View File
@@ -53,7 +53,7 @@
#include <nuttx/binfmt/binfmt.h>
#include "sched/sched.h"
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
@@ -159,7 +159,7 @@ int exec_module(FAR const struct binary_s *binp)
/* Allocate a TCB for the new task. */
tcb = (FAR struct task_tcb_s*)kmm_zalloc(sizeof(struct task_tcb_s));
tcb = (FAR struct task_tcb_s *)kmm_zalloc(sizeof(struct task_tcb_s));
if (!tcb)
{
err = ENOMEM;
@@ -189,7 +189,7 @@ int exec_module(FAR const struct binary_s *binp)
* will need to change if/when we want to support dynamic stack allocation.
*/
stack = (FAR uint32_t*)kumm_malloc(binp->stacksize);
stack = (FAR uint32_t *)kumm_malloc(binp->stacksize);
if (!stack)
{
err = ENOMEM;
+7 -6
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/binfmt_execsymtab.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <assert.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/binfmt/symtab.h>
@@ -68,7 +69,7 @@
#endif
/****************************************************************************
* Public Variables
* Public Data
****************************************************************************/
#ifdef CONFIG_EXECFUNCS_HAVE_SYMTAB
@@ -116,10 +117,10 @@ void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
* size are returned as a single atomic operation.
*/
flags = irqsave();
flags = enter_critical_section();
*symtab = g_exec_symtab;
*nsymbols = g_exec_nsymbols;
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@@ -147,10 +148,10 @@ void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
* size are set as a single atomic operation.
*/
flags = irqsave();
flags = enter_critical_section();
g_exec_symtab = symtab;
g_exec_nsymbols = nsymbols;
irqrestore(flags);
leave_critical_section(flags);
}
#endif /* CONFIG_LIBC_EXECFUNCS */
+3 -3
View File
@@ -142,7 +142,7 @@ EXEPATH_HANDLE exepath_init(void)
return (EXEPATH_HANDLE)exepath;
}
/****************************************************************************
/****************************************************************************
* Name: exepath_next
*
* Description:
@@ -190,7 +190,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath)
* in the PATH variable have been considered.
*/
for (;;)
for (; ; )
{
/* Make sure that exepath->next points to the beginning of a string */
@@ -244,7 +244,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath)
/* Verify that a regular file exists at this path */
ret = stat(fullpath, &buf);;
ret = stat(fullpath, &buf);
if (ret == OK && S_ISREG(buf.st_mode))
{
return fullpath;
+1 -1
View File
@@ -46,7 +46,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
+1 -1
View File
@@ -46,7 +46,7 @@
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
+8 -7
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/binfmt_schedunload.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,10 +43,11 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_SCHED_HAVE_PARENT)
@@ -84,7 +85,7 @@ FAR struct binary_s *g_unloadhead;
* pid - The task ID of the child task
* bin - This structure must have been allocated with kmm_malloc() and must
* persist until the task unloads
*
*
* Returned Value:
* None
@@ -105,10 +106,10 @@ static void unload_list_add(pid_t pid, FAR struct binary_s *bin)
* interrupts.
*/
flags = irqsave();
flags = enter_critical_section();
bin->flink = g_unloadhead;
g_unloadhead = bin;
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@@ -313,13 +314,13 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
/* Emergency removal from the list */
flags = irqsave();
flags = enter_critical_section();
if (unload_list_remove(pid) != bin)
{
blldbg("ERROR: Failed to remove structure\n");
}
irqrestore(flags);
leave_critical_section(flags);
goto errout;
}
+1 -34
View File
@@ -48,7 +48,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
@@ -211,38 +211,5 @@ int unload_module(FAR struct binary_s *binp)
return OK;
}
/****************************************************************************
* Name: binfmt_freeargv
*
* Description:
* Release the copied argv[] list.
*
* Input Parameter:
* binp - Load structure
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
void binfmt_freeargv(FAR struct binary_s *binp)
{
/* Is there an allocated argument buffer */
if (binp->argbuffer)
{
/* Free the argument buffer */
kmm_free(binp->argbuffer);
}
/* Nullify the allocated argv[] array and the argument buffer pointers */
binp->argbuffer = (FAR char *)NULL;
binp->argv = (FAR char **)NULL;
}
#endif
#endif /* CONFIG_BINFMT_DISABLE */
+1 -1
View File
@@ -46,7 +46,7 @@
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
#include "binfmt.h"
#ifndef CONFIG_BINFMT_DISABLE
+3
View File
@@ -116,6 +116,7 @@ static int builtin_loadbinary(struct binary_s *binp)
{
int errval = get_errno();
bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
close(fd);
return -errval;
}
@@ -128,6 +129,7 @@ static int builtin_loadbinary(struct binary_s *binp)
{
int errval = get_errno();
bdbg("ERROR: %s is not a builtin application\n", filename);
close(fd);
return -errval;
}
@@ -140,6 +142,7 @@ static int builtin_loadbinary(struct binary_s *binp)
binp->entrypt = b->main;
binp->stacksize = b->stacksize;
binp->priority = b->priority;
close(fd);
return OK;
}
+1 -1
View File
@@ -198,7 +198,7 @@ static void elf_dumpentrypt(FAR struct binary_s *binp,
}
#endif
elf_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt,
elf_dumpbuffer("Entry code", (FAR const uint8_t *)binp->entrypt,
MIN(loadinfo->textsize - loadinfo->ehdr.e_entry, 512));
#ifdef CONFIG_ARCH_ADDRENV
+1 -5
View File
@@ -49,11 +49,7 @@
#include <nuttx/binfmt/elf.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
+1 -1
View File
@@ -113,7 +113,7 @@ static inline int elf_readrel(FAR struct elf_loadinfo_s *loadinfo,
/* And, finally, read the symbol table entry into memory */
return elf_read(loadinfo, (FAR uint8_t*)rel, sizeof(Elf32_Rel), offset);
return elf_read(loadinfo, (FAR uint8_t *)rel, sizeof(Elf32_Rel), offset);
}
/****************************************************************************
+3 -3
View File
@@ -163,7 +163,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
{
/* Allocate memory to hold a copy of the .ctor section */
loadinfo->ctoralloc = (binfmt_ctor_t*)kumm_malloc(ctorsize);
loadinfo->ctoralloc = (binfmt_ctor_t *)kumm_malloc(ctorsize);
if (!loadinfo->ctoralloc)
{
bdbg("Failed to allocate memory for .ctors\n");
@@ -174,7 +174,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
/* Read the section header table into memory */
ret = elf_read(loadinfo, (FAR uint8_t*)loadinfo->ctors, ctorsize,
ret = elf_read(loadinfo, (FAR uint8_t *)loadinfo->ctors, ctorsize,
shdr->sh_offset);
if (ret < 0)
{
@@ -206,7 +206,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
* will be relocated via the normal mechanism.
*/
loadinfo->ctors = (binfmt_ctor_t*)shdr->sh_addr;
loadinfo->ctors = (binfmt_ctor_t *)shdr->sh_addr;
}
}
+3 -3
View File
@@ -163,7 +163,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
{
/* Allocate memory to hold a copy of the .dtor section */
loadinfo->ctoralloc = (binfmt_dtor_t*)kumm_malloc(dtorsize);
loadinfo->ctoralloc = (binfmt_dtor_t *)kumm_malloc(dtorsize);
if (!loadinfo->ctoralloc)
{
bdbg("Failed to allocate memory for .dtors\n");
@@ -174,7 +174,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
/* Read the section header table into memory */
ret = elf_read(loadinfo, (FAR uint8_t*)loadinfo->dtors, dtorsize,
ret = elf_read(loadinfo, (FAR uint8_t *)loadinfo->dtors, dtorsize,
shdr->sh_offset);
if (ret < 0)
{
@@ -206,7 +206,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
* will be relocated via the normal mechanism.
*/
loadinfo->dtors = (binfmt_dtor_t*)shdr->sh_addr;
loadinfo->dtors = (binfmt_dtor_t *)shdr->sh_addr;
}
}
+3 -3
View File
@@ -172,19 +172,19 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo)
/* Read the ELF ehdr from offset 0 */
ret = elf_read(loadinfo, (FAR uint8_t*)&loadinfo->ehdr, sizeof(Elf32_Ehdr), 0);
ret = elf_read(loadinfo, (FAR uint8_t *)&loadinfo->ehdr, sizeof(Elf32_Ehdr), 0);
if (ret < 0)
{
bdbg("Failed to read ELF header: %d\n", ret);
return ret;
}
elf_dumpbuffer("ELF header", (FAR const uint8_t*)&loadinfo->ehdr, sizeof(Elf32_Ehdr));
elf_dumpbuffer("ELF header", (FAR const uint8_t *)&loadinfo->ehdr, sizeof(Elf32_Ehdr));
/* Verify the ELF header */
ret = elf_verifyheader(&loadinfo->ehdr);
if (ret <0)
if (ret < 0)
{
/* This may not be an error because we will be called to attempt loading
* EVERY binary. If elf_verifyheader() does not recognize the ELF header,
+2 -2
View File
@@ -157,8 +157,8 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
/* Read each section into memory that is marked SHF_ALLOC + SHT_NOBITS */
bvdbg("Loaded sections:\n");
text = (FAR uint8_t*)loadinfo->textalloc;
data = (FAR uint8_t*)loadinfo->dataalloc;
text = (FAR uint8_t *)loadinfo->textalloc;
data = (FAR uint8_t *)loadinfo->dataalloc;
for (i = 0; i < loadinfo->ehdr.e_shnum; i++)
{
+2 -2
View File
@@ -68,9 +68,9 @@
****************************************************************************/
#if defined(ELF_DUMP_READDATA)
static inline void elf_dumpreaddata(char *buffer, int buflen)
static inline void elf_dumpreaddata(FAR char *buffer, int buflen)
{
uint32_t *buf32 = (uint32_t*)buffer;
FAR uint32_t *buf32 = (FAR uint32_t *)buffer;
int i;
int j;
+6 -4
View File
@@ -117,7 +117,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
buffer = loadinfo->iobuffer;
bytesread = 0;
for (;;)
for (; ; )
{
/* Get the number of bytes to read */
@@ -211,16 +211,18 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
/* Allocate memory to hold a working copy of the sector header table */
loadinfo->shdr = (FAR Elf32_Shdr*)kmm_malloc(shdrsize);
loadinfo->shdr = (FAR FAR Elf32_Shdr *)kmm_malloc(shdrsize);
if (!loadinfo->shdr)
{
bdbg("Failed to allocate the section header table. Size: %ld\n", (long)shdrsize);
bdbg("Failed to allocate the section header table. Size: %ld\n",
(long)shdrsize);
return -ENOMEM;
}
/* Read the section header table into memory */
ret = elf_read(loadinfo, (FAR uint8_t*)loadinfo->shdr, shdrsize, loadinfo->ehdr.e_shoff);
ret = elf_read(loadinfo, (FAR uint8_t *)loadinfo->shdr, shdrsize,
loadinfo->ehdr.e_shoff);
if (ret < 0)
{
bdbg("Failed to read section header table: %d\n", ret);
+2 -2
View File
@@ -107,7 +107,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
bytesread = 0;
for (;;)
for (; ; )
{
/* Get the number of bytes to read */
@@ -239,7 +239,7 @@ int elf_readsym(FAR struct elf_loadinfo_s *loadinfo, int index,
/* And, finally, read the symbol table entry into memory */
return elf_read(loadinfo, (FAR uint8_t*)sym, sizeof(Elf32_Sym), offset);
return elf_read(loadinfo, (FAR uint8_t *)sym, sizeof(Elf32_Sym), offset);
}
/****************************************************************************
+4 -1
View File
@@ -53,7 +53,10 @@
* Private Constant Data
****************************************************************************/
static const char g_elfmagic[EI_MAGIC_SIZE] = { 0x7f, 'E', 'L', 'F' };
static const char g_elfmagic[EI_MAGIC_SIZE] =
{
0x7f, 'E', 'L', 'F'
};
/****************************************************************************
* Private Functions
+14 -14
View File
@@ -102,14 +102,14 @@
static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32I Offset: %08x I-Space: %p\n",
offset, loadinfo->ispace + sizeof(struct nxflat_hdr_s));
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += (uint32_t)(loadinfo->ispace + sizeof(struct nxflat_hdr_s));
bvdbg(" After: %08x\n", *addr);
@@ -141,14 +141,14 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n",
offset, loadinfo->dspace->region);
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += (uint32_t)(loadinfo->dspace->region);
bvdbg(" After: %08x\n", *addr);
@@ -183,14 +183,14 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
static inline int nxflat_bindrel32id(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n",
offset, loadinfo->dspace->region);
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += ((uint32_t)loadinfo->ispace - (uint32_t)(loadinfo->dspace->region));
bvdbg(" After: %08x\n", *addr);
@@ -231,7 +231,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
/* The NXFLAT header is the first thing at the beginning of the ISpace. */
hdr = (FAR struct nxflat_hdr_s*)loadinfo->ispace;
hdr = (FAR struct nxflat_hdr_s *)loadinfo->ispace;
/* From this, we can get the offset to the list of relocation entries */
@@ -348,8 +348,8 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
#ifdef CONFIG_NXFLAT_DUMPBUFFER
if (ret == OK && nrelocs > 0)
{
relocs = (FAR struct nxflat_reloc_s*)(offset - loadinfo->isize + loadinfo->dspace->region);
nxflat_dumpbuffer("GOT", (FAR const uint8_t*)relocs, nrelocs * sizeof(struct nxflat_reloc_s));
relocs = (FAR struct nxflat_reloc_s *)(offset - loadinfo->isize + loadinfo->dspace->region);
nxflat_dumpbuffer("GOT", (FAR const uint8_t *)relocs, nrelocs * sizeof(struct nxflat_reloc_s));
}
#endif
@@ -397,7 +397,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
/* The NXFLAT header is the first thing at the beginning of the ISpace. */
hdr = (FAR struct nxflat_hdr_s*)loadinfo->ispace;
hdr = (FAR struct nxflat_hdr_s *)loadinfo->ispace;
/* From this, we can get the offset to the list of symbols imported by
* this module and the number of symbols imported by this module.
@@ -440,7 +440,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
DEBUGASSERT(offset >= loadinfo->isize &&
offset < loadinfo->isize + loadinfo->dsize);
imports = (struct nxflat_import_s*)
imports = (FAR struct nxflat_import_s *)
(offset - loadinfo->isize + loadinfo->dspace->region);
/* Now, traverse the list of imported symbols and attempt to bind
@@ -462,7 +462,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
offset = imports[i].i_funcname;
DEBUGASSERT(offset < loadinfo->isize);
symname = (char*)(offset + loadinfo->ispace + sizeof(struct nxflat_hdr_s));
symname = (FAR char *)(offset + loadinfo->ispace + sizeof(struct nxflat_hdr_s));
/* Find the exported symbol value for this this symbol name. */
@@ -494,7 +494,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
#ifdef CONFIG_NXFLAT_DUMPBUFFER
if (nimports > 0)
{
nxflat_dumpbuffer("Imports", (FAR const uint8_t*)imports, nimports * sizeof(struct nxflat_import_s));
nxflat_dumpbuffer("Imports", (FAR const uint8_t *)imports, nimports * sizeof(struct nxflat_import_s));
}
#endif
@@ -549,7 +549,7 @@ static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
/* Zero the BSS area */
memset((void*)(loadinfo->dspace->region + loadinfo->datasize), 0,
memset((FAR void *)(loadinfo->dspace->region + loadinfo->datasize), 0,
loadinfo->bsssize);
/* Restore the original address environment */
+3 -2
View File
@@ -118,14 +118,15 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
/* Read the NXFLAT header from offset 0 */
ret = nxflat_read(loadinfo, (char*)&loadinfo->header,
ret = nxflat_read(loadinfo, (FAR char *)&loadinfo->header,
sizeof(struct nxflat_hdr_s), 0);
if (ret < 0)
{
bdbg("Failed to read NXFLAT header: %d\n", ret);
return ret;
}
nxflat_dumpbuffer("NXFLAT header", (FAR const uint8_t*)&loadinfo->header,
nxflat_dumpbuffer("NXFLAT header", (FAR const uint8_t *)&loadinfo->header,
sizeof(struct nxflat_hdr_s));
/* Verify the NXFLAT header */
+3 -2
View File
@@ -147,7 +147,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
*/
loadinfo->ispace = (uint32_t)mmap(NULL, loadinfo->isize, PROT_READ,
MAP_SHARED|MAP_FILE, loadinfo->filfd, 0);
MAP_SHARED | MAP_FILE, loadinfo->filfd, 0);
if (loadinfo->ispace == (uint32_t)MAP_FAILED)
{
bdbg("Failed to map NXFLAT ISpace: %d\n", errno);
@@ -189,7 +189,8 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
* DSpace memory.
*/
ret = nxflat_read(loadinfo, (char*)loadinfo->dspace->region, dreadsize, doffset);
ret = nxflat_read(loadinfo, (FAR char *)loadinfo->dspace->region,
dreadsize, doffset);
if (ret < 0)
{
bdbg("Failed to read .data section: %d\n", ret);
+2 -2
View File
@@ -69,9 +69,9 @@
****************************************************************************/
#if defined(NXFLAT_DUMP_READDATA)
static inline void nxflat_dumpreaddata(char *buffer, int buflen)
static inline void nxflat_dumpreaddata(FAR char *buffer, int buflen)
{
uint32_t *buf32 = (uint32_t*)buffer;
FAR uint32_t *buf32 = (FAR uint32_t *)buffer;
int i;
int j;
+2 -2
View File
@@ -79,14 +79,14 @@
*
****************************************************************************/
int nxflat_unload(struct nxflat_loadinfo_s *loadinfo)
int nxflat_unload(FAR struct nxflat_loadinfo_s *loadinfo)
{
/* Release the memory segments */
/* Release the I-Space mmap'ed file */
if (loadinfo->ispace)
{
munmap((void*)loadinfo->ispace, loadinfo->isize);
munmap((FAR void *)loadinfo->ispace, loadinfo->isize);
loadinfo->ispace = 0;
}
+2
View File
@@ -50,6 +50,8 @@ Files include in this directory include:
xxd -g 1 -i romfs.img >romfs.h
then cleaned up with an editor to conform with NuttX coding standards.
Also, the data definitions in the romfs.h file should be marked with
'const' qualifier the so that the data will be stored in FLASH.
Test Configuration
------------------
+7 -7
View File
@@ -187,7 +187,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
*/
binp->entrypt = (main_t)(loadinfo.ispace + loadinfo.entryoffs);
binp->mapped = (void*)loadinfo.ispace;
binp->mapped = (FAR void *)loadinfo.ispace;
binp->mapsize = loadinfo.isize;
binp->stacksize = loadinfo.stacksize;
@@ -202,7 +202,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
#ifdef CONFIG_ARCH_ADDRENV
# warning "REVISIT"
#else
binp->alloc[0] = (void*)loadinfo.dspace;
binp->alloc[0] = (FAR void *)loadinfo.dspace;
#endif
#ifdef CONFIG_ARCH_ADDRENV
@@ -213,7 +213,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
up_addrenv_clone(&loadinfo.addrenv, &binp->addrenv);
#endif
nxflat_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt,
nxflat_dumpbuffer("Entry code", (FAR const uint8_t *)binp->entrypt,
MIN(loadinfo.isize - loadinfo.entryoffs, 512));
nxflat_uninit(&loadinfo);
@@ -227,11 +227,11 @@ errout:
return ret;
}
/***********************************************************************
/****************************************************************************
* Public Functions
***********************************************************************/
****************************************************************************/
/***********************************************************************
/****************************************************************************
* Name: nxflat_initialize
*
* Description:
@@ -244,7 +244,7 @@ errout:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
***********************************************************************/
****************************************************************************/
int nxflat_initialize(void)
{
+1 -1
View File
@@ -352,7 +352,7 @@ static int pcode_load(struct binary_s *binp)
{
/* Set up for the next gulp */
DEBUGASSERT(nread > 0 && nread <=remaining);
DEBUGASSERT(nread > 0 && nread <= remaining);
remaining -= nread;
ptr += nread;
}

Some files were not shown because too many files have changed in this diff Show More