Squashed commit of the following:

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

     arch/arm/src/armv7-m:  Implement SYSTICK timer driver

   Author: anchao <anchao@pinecone.net>

     configs/sim/loadable:  Add loadable demo for arch sim
     sched/init: Restore previously reverted option to mount block device for INIT_FILEPATH case
     configs/stm3240g-eval/knxwm: Fix build breakage.

   Author: Gregory Nutt <gnutt@nuttx.org>
     configs:  With recent changes to apps/ all configurations that build applications as modules must now also select CONFIG_APPS_LOADABLE.

   Author: anchao <anchao@pinecone.net>
      configs/sim/loadable:  Add loadable demo for arch sim
       Kconfig and tools/Makefile.unix and : add dynamic application loadable support
This commit is contained in:
anchao 2018-08-23 11:08:22 -06:00 committed by Gregory Nutt
parent 22a44465e4
commit 95163b2c59
12 changed files with 83 additions and 17 deletions

10
Kconfig
View File

@ -161,6 +161,16 @@ config APPS_DIR
example, to include makefile fragments (e.g., .config or Make.defs) example, to include makefile fragments (e.g., .config or Make.defs)
or to set up include file paths. or to set up include file paths.
config BUILD_LOADABLE
bool "NuttX application loadable build"
default n if !BUILD_KERNEL
default y if BUILD_KERNEL
---help---
Automatically selected if KERNEL build is selected.
This selection only effects the behavior of the 'make export'
target and currently has no effect unless you wish to build
loadable applications in a FLAT build.
choice choice
prompt "Memory organization" prompt "Memory organization"
default BUILD_FLAT default BUILD_FLAT

View File

@ -22,6 +22,7 @@ CONFIG_BINFMT_EXEPATH=y
CONFIG_BOARDCTL_RESET=y CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=12061 CONFIG_BOARD_LOOPSPERMSEC=12061
CONFIG_BUILD_LOADABLE=y
CONFIG_BUILD_PROTECTED=y CONFIG_BUILD_PROTECTED=y
CONFIG_C99_BOOL8=y CONFIG_C99_BOOL8=y
CONFIG_CODECS_HASH_MD5=y CONFIG_CODECS_HASH_MD5=y

View File

@ -21,6 +21,7 @@ CONFIG_BINFMT_EXEPATH=y
CONFIG_BOARDCTL_RESET=y CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=12061 CONFIG_BOARD_LOOPSPERMSEC=12061
CONFIG_BUILD_LOADABLE=y
CONFIG_BUILTIN=y CONFIG_BUILTIN=y
CONFIG_C99_BOOL8=y CONFIG_C99_BOOL8=y
CONFIG_CODECS_HASH_MD5=y CONFIG_CODECS_HASH_MD5=y

View File

@ -561,6 +561,12 @@ ipforward
Additional required settings will also be selected when you manually Additional required settings will also be selected when you manually
select the above via 'make menuconfig'. select the above via 'make menuconfig'.
loadable
This configuration provides an example of loadable apps. It cannot used
with any Windows configuration, however, because Windows does not use
the ELF format.
minibasic minibasic
This configuration was used to test the Mini Basic port at This configuration was used to test the Mini Basic port at

View File

@ -1,4 +1,3 @@
CONFIG_APPS_LOADABLE=y
CONFIG_ARCH="sim" CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_BOARD_SIM=y
@ -6,26 +5,31 @@ CONFIG_ARCH_SIM=y
CONFIG_BINFMT_EXEPATH=y CONFIG_BINFMT_EXEPATH=y
CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_INITIALIZE=y
CONFIG_BUILD_LOADABLE=y
CONFIG_BUILTIN=y CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y CONFIG_CLOCK_MONOTONIC=y
CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y CONFIG_DEBUG_SYMBOLS=y
CONFIG_ELF=y CONFIG_ELF=y
CONFIG_EXAMPLES_HELLO=y CONFIG_EXAMPLES_HELLO=m
CONFIG_EXAMPLES_HELLO_STACKSIZE=8192 CONFIG_EXAMPLES_HELLO_STACKSIZE=8192
CONFIG_EXECFUNCS_HAVE_SYMTAB=y CONFIG_EXECFUNCS_HAVE_SYMTAB=y
CONFIG_FS_HOSTFS=y CONFIG_FS_HOSTFS=y
CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=4096 CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_FILEPATH=y CONFIG_INIT_FILEPATH=y
CONFIG_INIT_MOUNT=y
CONFIG_INIT_MOUNT_DATA="fs=../apps/exe/system" CONFIG_INIT_MOUNT_DATA="fs=../apps/exe/system"
CONFIG_INIT_MOUNT_FLAGS=0x1 CONFIG_INIT_MOUNT_FLAGS=0x1
CONFIG_INIT_MOUNT_FSTYPE="hostfs" CONFIG_INIT_MOUNT_FSTYPE="hostfs"
CONFIG_INIT_MOUNT_SOURCE=""
CONFIG_INIT_MOUNT_TARGET="/system" CONFIG_INIT_MOUNT_TARGET="/system"
CONFIG_LIBC_EXECFUNCS=y CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMSET_OPTSPEED=y CONFIG_MEMSET_OPTSPEED=y
CONFIG_NSH_ARCHINIT=y CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILE_APPS=y
CONFIG_NSH_LINELEN=128 CONFIG_NSH_LINELEN=128
CONFIG_NSH_READLINE=y CONFIG_NSH_READLINE=y
CONFIG_PATH_INITIAL="/system/bin" CONFIG_PATH_INITIAL="/system/bin"
@ -40,7 +44,7 @@ CONFIG_SIM_M32=y
CONFIG_SIM_WALLTIME=y CONFIG_SIM_WALLTIME=y
CONFIG_START_MONTH=6 CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008 CONFIG_START_YEAR=2008
CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NSH=m
CONFIG_TIME_EXTENDED=y CONFIG_TIME_EXTENDED=y
CONFIG_USERMAIN_STACKSIZE=4096 CONFIG_USERMAIN_STACKSIZE=4096
CONFIG_USER_INITPATH="/system/bin/nsh" CONFIG_USER_INITPATH="/system/bin/nsh"

View File

@ -44,6 +44,7 @@
#include <sys/mount.h> #include <sys/mount.h>
#include <debug.h> #include <debug.h>
#include <nuttx/binfmt/elf.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>

View File

@ -77,7 +77,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif endif
ARCHCFLAGS = -fno-builtin ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti -fpermissive
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES = ARCHDEFINES =

View File

@ -363,6 +363,40 @@ config INIT_NEXPORTS
Any kernel mode symbols tables would not be usable for resolving Any kernel mode symbols tables would not be usable for resolving
symbols in user mode executables. symbols in user mode executables.
menuconfig INIT_MOUNT
bool "Auto-mount init file system"
default n
depends on !DISABLE_MOUNTPOINT
---help---
In order to use the the initial startup program when CONFIG_INIT_FILEPATH
is provided, it is necessary to mount the initial file system that
provides init program. Normally this mount is done in the board-specific
initialization logic. However, if the mount is very simple, it can be
performed by the OS bring-up logic itself by selecting this option.
if INIT_MOUNT
config INIT_MOUNT_SOURCE
string "The block device to mount"
default "/dev/ram0"
config INIT_MOUNT_TARGET
string "Path to the mounted file system"
default "/bin"
config INIT_MOUNT_FSTYPE
string "The file system type to mount"
default "romfs"
config INIT_MOUNT_FLAGS
hex "Flags passed to mount"
default 0
config INIT_MOUNT_DATA
string "Additional data passed to mount"
default ""
endif # INIT_MOUNT
endif # INIT_FILEPATH endif # INIT_FILEPATH
config RR_INTERVAL config RR_INTERVAL

View File

@ -45,7 +45,9 @@
#include <sched.h> #include <sched.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <debug.h> #include <debug.h>
#include <sys/mount.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/board.h> #include <nuttx/board.h>
@ -98,10 +100,6 @@
* program. * program.
*/ */
# ifndef CONFIG_BOARD_INITIALIZE
# warning You probably need CONFIG_BOARD_INITIALIZE to mount the file system
# endif
# ifndef CONFIG_USER_INITPATH # ifndef CONFIG_USER_INITPATH
/* Path to the initialization program must have been provided */ /* Path to the initialization program must have been provided */
@ -287,6 +285,16 @@ static inline void os_do_appstart(void)
board_initialize(); board_initialize();
#endif #endif
#ifdef CONFIG_INIT_MOUNT
/* Mount the file system containing the init program. */
ret = mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET,
CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS,
CONFIG_INIT_MOUNT_DATA);
DEBUGASSERT(ret >= 0);
UNUSED(ret);
#endif
/* Start the application initialization program from a program in a /* Start the application initialization program from a program in a
* mounted file system. Presumably the file system was mounted as part * mounted file system. Presumably the file system was mounted as part
* of the board_initialize() operation. * of the board_initialize() operation.
@ -297,6 +305,7 @@ static inline void os_do_appstart(void)
ret = exec(CONFIG_USER_INITPATH, NULL, CONFIG_INIT_SYMTAB, ret = exec(CONFIG_USER_INITPATH, NULL, CONFIG_INIT_SYMTAB,
CONFIG_INIT_NEXPORTS); CONFIG_INIT_NEXPORTS);
ASSERT(ret >= 0); ASSERT(ret >= 0);
UNUSED(ret);
} }
#elif defined(CONFIG_INIT_NONE) #elif defined(CONFIG_INIT_NONE)

View File

@ -86,7 +86,7 @@
#undef get_errno #undef get_errno
#undef set_errno #undef set_errno
#include <nuttx/errno.h> #include <errno.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
/**************************************************************************** /****************************************************************************

View File

@ -166,10 +166,10 @@ MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
MKEXPORT_ARGS += -u MKEXPORT_ARGS += -u
else else ifeq ($(CONFIG_BUILD_KERNEL),y)
ifeq ($(CONFIG_BUILD_KERNEL),y) MKEXPORT_ARGS += -u
else ifeq ($(CONFIG_BUILD_LOADABLE),y)
MKEXPORT_ARGS += -u MKEXPORT_ARGS += -u
endif
endif endif
ifeq ($(V),2) ifeq ($(V),2)

View File

@ -158,11 +158,11 @@ MKEXPORT = tools\mkexport.bat
MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)" MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
MKEXPORT_ARGS = -u MKEXPORT_ARGS += -u
else else ifeq ($(CONFIG_BUILD_KERNEL),y)
ifeq ($(CONFIG_BUILD_KERNEL),y) MKEXPORT_ARGS += -u
MKEXPORT_ARGS = -u else ifeq ($(CONFIG_BUILD_LOADABLE),y)
endif MKEXPORT_ARGS += -u
endif endif
ifeq ($(V),2) ifeq ($(V),2)