From 8c5b57d449bae1b9f5b3b501356e486439f93ae0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 27 Nov 2012 15:09:12 +0000 Subject: configs/z8f64200100kit/ostest at same level as ez80 configurations; nuttx/arch/arm/src/lpc17xx/lpc17_i2c.cuninitialization fix git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5392 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/relays/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/examples') diff --git a/apps/examples/relays/Makefile b/apps/examples/relays/Makefile index 9d7b036d3..8e91ab572 100644 --- a/apps/examples/relays/Makefile +++ b/apps/examples/relays/Makefile @@ -64,7 +64,7 @@ ROOTDEPPATH = --dep-path . APPNAME = relays PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +STACKSIZE = 512 # Common build -- cgit v1.2.3 From c9230359ef3da96b4aa2517475eb910e25ea1620 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 29 Nov 2012 18:44:02 +0000 Subject: All ZNEO configurations converted to use the mconf/Kconfig tool git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5401 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/pashello/Makefile | 30 +- apps/examples/pashello/pashello.c | 4 +- apps/interpreters/Kconfig | 4 +- apps/interpreters/Make.defs | 4 +- apps/interpreters/ficl/Kconfig | 4 +- misc/pascal/nuttx/Makefile | 30 +- nuttx/ChangeLog | 4 + nuttx/arch/Kconfig | 4 + nuttx/arch/arm/Kconfig | 11 +- nuttx/arch/mips/Kconfig | 10 +- nuttx/arch/z16/Kconfig | 11 +- nuttx/arch/z16/src/z16f/Kconfig | 12 + nuttx/configs/Kconfig | 2 +- nuttx/configs/cloudctrl/nsh/defconfig | 4 +- nuttx/configs/ez80f910200kitg/README.txt | 4 +- nuttx/configs/ez80f910200kitg/ostest/defconfig | 4 +- nuttx/configs/ez80f910200zco/README.txt | 4 +- nuttx/configs/ez80f910200zco/ostest/defconfig | 4 +- nuttx/configs/fire-stm32v2/nsh/defconfig | 4 +- nuttx/configs/shenzhou/nsh/defconfig | 4 +- nuttx/configs/shenzhou/nxwm/defconfig | 4 +- nuttx/configs/shenzhou/thttpd/defconfig | 4 +- nuttx/configs/sim/cxxtest/defconfig | 4 +- nuttx/configs/sim/ostest/defconfig | 4 +- nuttx/configs/stm3240g-eval/discover/defconfig | 4 +- nuttx/configs/stm3240g-eval/xmlrpc/defconfig | 4 +- nuttx/configs/stm32f100rc_generic/nsh/defconfig | 4 +- nuttx/configs/stm32f100rc_generic/ostest/defconfig | 4 +- nuttx/configs/stm32f4discovery/cxxtest/defconfig | 4 +- nuttx/configs/stm32f4discovery/elf/defconfig | 4 +- nuttx/configs/stm32f4discovery/nxlines/defconfig | 4 +- nuttx/configs/stm32f4discovery/ostest/defconfig | 4 +- nuttx/configs/stm32f4discovery/winbuild/defconfig | 4 +- nuttx/configs/z16f2800100zcog/README.txt | 66 ++- nuttx/configs/z16f2800100zcog/ostest/appconfig | 39 -- nuttx/configs/z16f2800100zcog/ostest/defconfig | 609 +++++++++++++++------ nuttx/configs/z16f2800100zcog/pashello/defconfig | 601 ++++++++++++++------ nuttx/configs/z8encore000zco/README.txt | 4 +- nuttx/configs/z8encore000zco/ostest/defconfig | 4 +- nuttx/configs/z8f64200100kit/README.txt | 4 +- nuttx/configs/z8f64200100kit/ostest/defconfig | 4 +- nuttx/tools/incdir.sh | 2 +- 43 files changed, 1062 insertions(+), 483 deletions(-) delete mode 100644 nuttx/configs/z16f2800100zcog/ostest/appconfig (limited to 'apps/examples') diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 29a54461a..673838067 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -426,3 +426,5 @@ various DHCPC improvements(Darcy Gong). * apps/nshlib/nsh_apps.c: Fix compilation errors whenCONFIG_NSH_DISABLEBG=y. From Freddie Chopin. + * Rename CONFIG_PCODE and CONFIG_FICL as CONFIG_INTERPRETERS_PCODE and + CONFIG_INTERPRETERS_FICL for consistency with other configuration naming. diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile index 5876b9d2a..bb525c925 100644 --- a/apps/examples/pashello/Makefile +++ b/apps/examples/pashello/Makefile @@ -39,30 +39,38 @@ include $(APPDIR)/Make.defs # Pascal Add-On Example -ASRCS = -CSRCS = pashello.c device.c +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \ + "." \ + "$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)include" \ + "$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)insn$(DELIM)include"} + +ASRCS = +CSRCS = pashello.c device.c -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) + BIN = ..\..\libapps$(LIBEXT) else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = ../../libapps$(LIBEXT) + BIN = ../../libapps$(LIBEXT) endif endif -ROOTDEPPATH = --dep-path . +ROOTDEPPATH = --dep-path . # Common build -VPATH = +VPATH = all: .built .PHONY: clean depend distclean diff --git a/apps/examples/pashello/pashello.c b/apps/examples/pashello/pashello.c index b8c19b6a4..8f9fc8b22 100644 --- a/apps/examples/pashello/pashello.c +++ b/apps/examples/pashello/pashello.c @@ -43,8 +43,8 @@ #include #include -#include "apps/pcode/insn/pexec.h" -#include "apps/pcode/pedefs.h" +#include "pexec.h" +#include "pedefs.h" #include "pashello.h" /**************************************************************************** diff --git a/apps/interpreters/Kconfig b/apps/interpreters/Kconfig index 34cbf2eee..6e7d1ac4f 100644 --- a/apps/interpreters/Kconfig +++ b/apps/interpreters/Kconfig @@ -7,7 +7,7 @@ comment "Interpreters" source "$APPSDIR/interpreters/ficl/Kconfig" -config PCODE +config INTERPRETERS_PCODE bool "Pascal p-code interpreter" default n ---help--- @@ -16,6 +16,6 @@ config PCODE configuration implies that you have performed the required installation of the Pascal run-time code. -if PCODE +if INTERPRETERS_PCODE endif diff --git a/apps/interpreters/Make.defs b/apps/interpreters/Make.defs index 2fc4b26d4..5d808d5d6 100644 --- a/apps/interpreters/Make.defs +++ b/apps/interpreters/Make.defs @@ -34,10 +34,10 @@ # ############################################################################ -ifeq ($(CONFIG_PCODE),y) +ifeq ($(CONFIG_INTERPRETERS_PCODE),y) CONFIGURED_APPS += interpreters/pcode endif -ifeq ($(CONFIG_FICL),y) +ifeq ($(CONFIG_INTERPRETERS_FICL),y) CONFIGURED_APPS += interpreters/ficl endif diff --git a/apps/interpreters/ficl/Kconfig b/apps/interpreters/ficl/Kconfig index 1860a1591..ba6a7bc35 100644 --- a/apps/interpreters/ficl/Kconfig +++ b/apps/interpreters/ficl/Kconfig @@ -3,7 +3,7 @@ # see misc/tools/kconfig-language.txt. # -config FICL +config INTERPRETERS_FICL bool "Ficl Forth interpreter" default n ---help--- @@ -11,6 +11,6 @@ config FICL apps/interpreters/ficl directory. Use of this configuration assumes that you have performed the required installation of the Ficl run-time code. -if FICL +if INTERPRETERS_FICL endif diff --git a/misc/pascal/nuttx/Makefile b/misc/pascal/nuttx/Makefile index 396fae834..aa041eb23 100644 --- a/misc/pascal/nuttx/Makefile +++ b/misc/pascal/nuttx/Makefile @@ -41,21 +41,21 @@ include $(APPDIR)$(DELIM)Make.defs # Default tools ifeq ($(DIRLINK),) -DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh -DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh endif ifeq ($(WINTOOL),y) -INCDIROPT = -w + INCDIROPT = -w endif USRINCLUDES = ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(PCODEDIR)$(DELIM)include $(PCODEDIR)$(DELIM)insn$(DELIM)include} COMPILER = ${shell basename $(CC)} ifeq ($(COMPILER),zneocc.exe) -INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) + INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) else -INCLUDES = $(ARCHINCLUDES) $(USRINCLUDES) + INCLUDES = $(ARCHINCLUDES) $(USRINCLUDES) endif CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) @@ -73,14 +73,18 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)$(DELIM)libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)$(DELIM)libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif -ROOTDEPPATH = --dep-path . -PRUNDEPPATH = --dep-path insn$(DELIM)prun +ROOTDEPPATH = --dep-path . +PRUNDEPPATH = --dep-path insn$(DELIM)prun POFFDEPPATH = --dep-path libpoff PASDEPPATH = --dep-path libpas @@ -90,18 +94,10 @@ all: .built .PHONY: context depend clean distclean $(AOBJS): %$(OBJEXT): %.S -ifeq ($(COMPILER),zneocc.exe) - $(call ASSEMBLE, `cygpath -w $<`, $@) -else $(call ASSEMBLE, $<, $@) -endif $(COBJS): %$(OBJEXT): %.c -ifeq ($(COMPILER),zneocc.exe) - $(call COMPILE, `cygpath -w $<`, $@) -else $(call COMPILE, $<, $@) -endif $(APPDIR)$(DELIM)include$(DELIM)pcode: include @$(DIRLINK) $(PCODEDIR)$(DELIM)include $(APPDIR)$(DELIM)include$(DELIM)pcode diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index e0ca6c8dc..f986619a3 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3712,3 +3712,7 @@ From Freddie Chopin. * z8encore000zco/ostest and z8f64200100kit/ostest: Can now be modified to support the Windows native builds (see corresponding README.txt files). + * configures/z16f2800100zcog - All configurations updated to use the ZDS-II + 5.0.1 toolchain. + * configures/z16f2800100zcog - All configurations updated to use Kconfig/mconf + configuration tools. diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig index 5cee40628..6e55a5744 100644 --- a/nuttx/arch/Kconfig +++ b/nuttx/arch/Kconfig @@ -111,6 +111,10 @@ config ARCH_DMA bool default n +config ARCH_IRQPRIO + bool + default n + config ARCH_STACKDUMP bool "Dump stack on assertions" default n diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index 3233918ca..9fa73782d 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -46,6 +46,7 @@ config ARCH_CHIP_KINETIS bool "Freescale Kinetis" select ARCH_CORTEXM4 select ARCH_HAVE_MPU + select ARCH_IRQPRIO ---help--- Freescale Kinetis Architectures (ARM Cortex-M4) @@ -53,6 +54,7 @@ config ARCH_CHIP_LM3S bool "TI Stellaris" select ARCH_CORTEXM3 select ARCH_HAVE_MPU + select ARCH_IRQPRIO ---help--- TI Stellaris LMS3 architecutres (ARM Cortex-M3) @@ -60,6 +62,7 @@ config ARCH_CHIP_LPC17XX bool "NXP LPC17xx" select ARCH_CORTEXM3 select ARCH_HAVE_MPU + select ARCH_IRQPRIO ---help--- NXP LPC17xx architectures (ARM Cortex-M3) @@ -91,6 +94,7 @@ config ARCH_CHIP_LPC43XX select ARCH_HAVE_CMNVECTOR select ARMV7M_CMNVECTOR select ARCH_HAVE_MPU + select ARCH_IRQPRIO ---help--- NPX LPC43XX architectures (ARM Cortex-M4). @@ -98,6 +102,7 @@ config ARCH_CHIP_SAM3U bool "Atmel AT91SAM3U" select ARCH_CORTEXM3 select ARCH_HAVE_MPU + select ARCH_IRQPRIO ---help--- Atmel AT91SAM3U architectures (ARM Cortex-M3) @@ -222,12 +227,6 @@ config PAGING If set =y in your configation file, this setting will enable the on-demand paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html. -config ARCH_IRQPRIO - bool "Interrupt priority" - default y if ARCH_CORTEXM3 || ARCH_CORTEXM4 - ---help--- - Select if your board supports interrupt prioritization. - config BOARD_LOOPSPERMSEC int "Delay loops per millisecond" default 5000 diff --git a/nuttx/arch/mips/Kconfig b/nuttx/arch/mips/Kconfig index c642f7152..772b6f663 100644 --- a/nuttx/arch/mips/Kconfig +++ b/nuttx/arch/mips/Kconfig @@ -10,6 +10,8 @@ choice config ARCH_CHIP_PIC32MX bool "PIC32MX" + select ARCH_MIPS32 + select ARCH_IRQPRIO ---help--- Microchip PIC32MX320F032H (MIPS32) @@ -17,7 +19,7 @@ endchoice config ARCH_MIPS32 bool - default y if ARCH_CHIP_PIC32MX + default n config ARCH_FAMILY string @@ -27,12 +29,6 @@ config ARCH_CHIP string default "pic32mx" if ARCH_CHIP_PIC32MX -config ARCH_IRQPRIO - bool "Interrupt priority" - default y if ARCH_CHIP_PIC32MX - ---help--- - Select if your board supports interrupt prioritization. - config BOARD_LOOPSPERMSEC int "Delay loops per millisecond" default 5000 diff --git a/nuttx/arch/z16/Kconfig b/nuttx/arch/z16/Kconfig index a806e6ed1..52ea95c29 100644 --- a/nuttx/arch/z16/Kconfig +++ b/nuttx/arch/z16/Kconfig @@ -12,21 +12,29 @@ choice config ARCH_CHIP_Z16F2810 bool "Z16F2810" + select ARCH_CHIP_Z16F + select ARCH_IRQPRIO ---help--- ZiLOG Z16F2810 config ARCH_CHIP_Z16F2811 bool "Z16F2811" + select ARCH_CHIP_Z16F + select ARCH_IRQPRIO ---help--- ZiLOG Z16F2811 config ARCH_CHIP_Z16F3211 - bool "Z16F321" + bool "Z16F3211" + select ARCH_CHIP_Z16F + select ARCH_IRQPRIO ---help--- ZiLOG Z16F321 config ARCH_CHIP_Z16F6411 bool "Z16F6411" + select ARCH_CHIP_Z16F + select ARCH_IRQPRIO ---help--- ZiLOG Z16F6411 @@ -34,7 +42,6 @@ endchoice config ARCH_CHIP_Z16F bool - default y if ARCH_CHIP_Z16F2810 || ARCH_CHIP_Z16F2811 || ARCH_CHIP_Z16F3211 || ARCH_CHIP_Z16F6411 config ARCH_CHIP string diff --git a/nuttx/arch/z16/src/z16f/Kconfig b/nuttx/arch/z16/src/z16f/Kconfig index 826720ee7..5efc061a5 100644 --- a/nuttx/arch/z16/src/z16f/Kconfig +++ b/nuttx/arch/z16/src/z16f/Kconfig @@ -6,4 +6,16 @@ if ARCH_CHIP_Z16F comment "Z16F Configuration Options" +# UART0/1 always enabled + +config Z16F_UART0 + bool + default y + select ARCH_HAVE_UART0 + +config Z16F_UART1 + bool + default y + select ARCH_HAVE_UART1 + endif diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index a89e7cdea..bc3759722 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -555,7 +555,7 @@ config ARCH_BOARD_XTRS config ARCH_BOARD_Z16F2800100ZCOG bool "Zilog Z16F2800100ZCOG Development Kit" - depends on ARCH_CHIP_Z16F281 + depends on ARCH_CHIP_Z16F2811 select ARCH_HAVE_LEDS ---help--- z16f Microcontroller. This port use the ZiLIG z16f2800100zcog diff --git a/nuttx/configs/cloudctrl/nsh/defconfig b/nuttx/configs/cloudctrl/nsh/defconfig index 5547333d8..440cb3e0b 100644 --- a/nuttx/configs/cloudctrl/nsh/defconfig +++ b/nuttx/configs/cloudctrl/nsh/defconfig @@ -569,8 +569,8 @@ CONFIG_EXAMPLES_NSH=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/ez80f910200kitg/README.txt b/nuttx/configs/ez80f910200kitg/README.txt index 004f607d4..e314b0fe1 100644 --- a/nuttx/configs/ez80f910200kitg/README.txt +++ b/nuttx/configs/ez80f910200kitg/README.txt @@ -116,8 +116,8 @@ available: b. You can't use setenv.sh in the native Windows environment. Try scripts/setenv.bat instead. c. At present, the native Windows build fails at the final link stages. - The failure is due to problems in arch/z80/src/nuttx/linkcmd that - is autogenerated by arch/z80/src/Makefile.zdsii. The basic program + The failure is due to problems in arch/z80/src/nuttx.linkcmd that + is autogenerated by arch/z80/src/Makefile.zdsii. The basic problem is the spurious spaces and and carrirage returns are generated at the end of the lines after a line continuation (\ ^M). If these trailing bad characters are manually eliminated, then the build diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig index 757916281..0e399cfc7 100644 --- a/nuttx/configs/ez80f910200kitg/ostest/defconfig +++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig @@ -402,8 +402,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/ez80f910200zco/README.txt b/nuttx/configs/ez80f910200zco/README.txt index bc4e11e27..1bc9e56b8 100644 --- a/nuttx/configs/ez80f910200zco/README.txt +++ b/nuttx/configs/ez80f910200zco/README.txt @@ -130,8 +130,8 @@ ostest b. You can't use setenv.sh in the native Windows environment. Try scripts/setenv.bat instead. c. At present, the native Windows build fails at the final link stages. - The failure is due to problems in arch/z80/src/nuttx/linkcmd that - is autogenerated by arch/z80/src/Makefile.zdsii. The basic program + The failure is due to problems in arch/z80/src/nuttx.linkcmd that + is autogenerated by arch/z80/src/Makefile.zdsii. The basic problem is the spurious spaces and and carrirage returns are generated at the end of the lines after a line continuation (\ ^M). If these trailing bad characters are manually eliminated, then the build diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig index c82a60e3a..7597bcfd6 100644 --- a/nuttx/configs/ez80f910200zco/ostest/defconfig +++ b/nuttx/configs/ez80f910200zco/ostest/defconfig @@ -410,8 +410,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/fire-stm32v2/nsh/defconfig b/nuttx/configs/fire-stm32v2/nsh/defconfig index f126c51fd..8e371686b 100644 --- a/nuttx/configs/fire-stm32v2/nsh/defconfig +++ b/nuttx/configs/fire-stm32v2/nsh/defconfig @@ -812,8 +812,8 @@ CONFIG_EXAMPLES_USBMSC_DEVPATH3="/dev/mmcsd2" # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/shenzhou/nsh/defconfig b/nuttx/configs/shenzhou/nsh/defconfig index c1e1818a5..4c73b7a6c 100644 --- a/nuttx/configs/shenzhou/nsh/defconfig +++ b/nuttx/configs/shenzhou/nsh/defconfig @@ -569,8 +569,8 @@ CONFIG_EXAMPLES_NSH=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index a5ccc8bfb..ccc411a4d 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -841,8 +841,8 @@ CONFIG_NAMEDAPP=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/shenzhou/thttpd/defconfig b/nuttx/configs/shenzhou/thttpd/defconfig index 82884f4c3..e8f189282 100644 --- a/nuttx/configs/shenzhou/thttpd/defconfig +++ b/nuttx/configs/shenzhou/thttpd/defconfig @@ -741,8 +741,8 @@ CONFIG_EXAMPLES_NSH=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/sim/cxxtest/defconfig b/nuttx/configs/sim/cxxtest/defconfig index 1f99a6333..9c1da5494 100644 --- a/nuttx/configs/sim/cxxtest/defconfig +++ b/nuttx/configs/sim/cxxtest/defconfig @@ -361,8 +361,8 @@ CONFIG_EXAMPLES_CXXTEST=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index 708c82a79..26d132cd0 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -351,8 +351,8 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=8 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm3240g-eval/discover/defconfig b/nuttx/configs/stm3240g-eval/discover/defconfig index d7165573c..aefa05326 100644 --- a/nuttx/configs/stm3240g-eval/discover/defconfig +++ b/nuttx/configs/stm3240g-eval/discover/defconfig @@ -765,8 +765,8 @@ CONFIG_EXAMPLES_DISCOVER_NETMASK=0xffffff00 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm3240g-eval/xmlrpc/defconfig b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig index 308203e27..dd72d6ab3 100644 --- a/nuttx/configs/stm3240g-eval/xmlrpc/defconfig +++ b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig @@ -760,8 +760,8 @@ CONFIG_EXAMPLES_XMLRPC_NETMASK=0xffffff00 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f100rc_generic/nsh/defconfig b/nuttx/configs/stm32f100rc_generic/nsh/defconfig index b5698ad18..41bb86592 100644 --- a/nuttx/configs/stm32f100rc_generic/nsh/defconfig +++ b/nuttx/configs/stm32f100rc_generic/nsh/defconfig @@ -490,8 +490,8 @@ CONFIG_EXAMPLES_NSH=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f100rc_generic/ostest/defconfig b/nuttx/configs/stm32f100rc_generic/ostest/defconfig index 92faa7f03..c56503e1f 100644 --- a/nuttx/configs/stm32f100rc_generic/ostest/defconfig +++ b/nuttx/configs/stm32f100rc_generic/ostest/defconfig @@ -478,8 +478,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f4discovery/cxxtest/defconfig b/nuttx/configs/stm32f4discovery/cxxtest/defconfig index 6648d3b13..1b3df6d32 100644 --- a/nuttx/configs/stm32f4discovery/cxxtest/defconfig +++ b/nuttx/configs/stm32f4discovery/cxxtest/defconfig @@ -489,8 +489,8 @@ CONFIG_EXAMPLES_CXXTEST=y # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f4discovery/elf/defconfig b/nuttx/configs/stm32f4discovery/elf/defconfig index e4702507c..8d98fe696 100644 --- a/nuttx/configs/stm32f4discovery/elf/defconfig +++ b/nuttx/configs/stm32f4discovery/elf/defconfig @@ -485,8 +485,8 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f4discovery/nxlines/defconfig b/nuttx/configs/stm32f4discovery/nxlines/defconfig index 286dd55ed..4de3a0922 100644 --- a/nuttx/configs/stm32f4discovery/nxlines/defconfig +++ b/nuttx/configs/stm32f4discovery/nxlines/defconfig @@ -591,8 +591,8 @@ CONFIG_EXAMPLES_NXLINES_BPP=16 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f4discovery/ostest/defconfig b/nuttx/configs/stm32f4discovery/ostest/defconfig index da7c8d200..d260a87cb 100644 --- a/nuttx/configs/stm32f4discovery/ostest/defconfig +++ b/nuttx/configs/stm32f4discovery/ostest/defconfig @@ -498,8 +498,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/stm32f4discovery/winbuild/defconfig b/nuttx/configs/stm32f4discovery/winbuild/defconfig index e52719f25..311dd075d 100644 --- a/nuttx/configs/stm32f4discovery/winbuild/defconfig +++ b/nuttx/configs/stm32f4discovery/winbuild/defconfig @@ -498,8 +498,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/z16f2800100zcog/README.txt b/nuttx/configs/z16f2800100zcog/README.txt index 55ed22b10..0c69c75bc 100644 --- a/nuttx/configs/z16f2800100zcog/README.txt +++ b/nuttx/configs/z16f2800100zcog/README.txt @@ -94,13 +94,75 @@ Where is the specific board configuration that you wish to build. The following board-specific configurations are available: -- ostest +ostest +------ + This builds the examples/ostest application for execution from FLASH. See examples/README.txt for information about ostest. -- pashello + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. By default, this configuration assumes that you are using the + Cygwin environment on Windows. An option is to use the native + CMD.exe window build as described in the top-level README.txt + file. To set up that configuration: + + -CONFIG_WINDOWS_CYGWIN=y + +CONFIG_WINDOWS_NATIVE=y + + And after configuring, make sure that CONFIG_APPS_DIR uses + the back slash character. For example: + + CONFIG_APPS_DIR="..\apps" + + NOTES: + + a. If you need to change the toolchain path used in Make.defs, you + will need to use the short 8.3 filenames to avoid spaces. On my + PC, C:\PROGRA~1\ is is C:\Program Files\ and C:\PROGRA~2\ is + C:\Program Files (x86)\ + b. You can't use setenv.sh in the native Windows environment. Try + scripts/setenv.bat instead. + c. At present, the native Windows build fails at the final link stages. + The failure is due to problems in arch/z16/src/nuttx.linkcmd that + is autogenerated by arch/z16/src/Makefile. The basic problem + is the spurious spaces and and carrirage returns are generated at + the end of the lines after a line continuation (\ ^M). If these + trailing bad characters are manually eliminated, then the build + will succeed on the next try. + +pashello +-------- Configures to use examples/pashello for execution from FLASH See examples/README.txt for information about pashello. + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. The last time I tried building this configuration, there were + a few undefined symbols from the PCODE logic. It might require + a little TLC to get this all working again. + + 3. The native windows build has not been tried with this configuration + but should, in principle, work (see notes for the ostest configuration + above). + Check out any README.txt files in these s. diff --git a/nuttx/configs/z16f2800100zcog/ostest/appconfig b/nuttx/configs/z16f2800100zcog/ostest/appconfig deleted file mode 100644 index a0f5d2462..000000000 --- a/nuttx/configs/z16f2800100zcog/ostest/appconfig +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# configs/z16f2800100zcog/ostest/appconfig -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/ostest - diff --git a/nuttx/configs/z16f2800100zcog/ostest/defconfig b/nuttx/configs/z16f2800100zcog/ostest/defconfig index 16f017778..027d6d73c 100644 --- a/nuttx/configs/z16f2800100zcog/ostest/defconfig +++ b/nuttx/configs/z16f2800100zcog/ostest/defconfig @@ -1,150 +1,174 @@ -############################################################################ -# configs/z16f2800100zcog/ostest/defconfig -# -# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ -# -# Architecture selection # -CONFIG_ARCH="z16" +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +CONFIG_DEBUG=y +# CONFIG_DEBUG_VERBOSE is not set +# CONFIG_DEBUG_ENABLE is not set + +# +# Subsystem Debug Options +# +# CONFIG_DEBUG_MM is not set +# CONFIG_DEBUG_SCHED is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_DEBUG_LIB is not set +# CONFIG_DEBUG_BINFMT is not set +# CONFIG_DEBUG_GRAPHICS is not set + +# +# Driver Debug Options +# +# CONFIG_DEBUG_ANALOG is not set +# CONFIG_DEBUG_DMA is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set CONFIG_ARCH_Z16=y +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="z16" CONFIG_ARCH_CHIP="z16f" -CONFIG_ARCH_CHIP_Z16F=y -CONFIG_ARCH_CHIP_Z16F2810=n -CONFIG_ARCH_CHIP_Z16F2811=y -CONFIG_ARCH_CHIP_Z16F3211=n -CONFIG_ARCH_CHIP_Z16F6411=n -CONFIG_ARCH_BOARD="z16f2800100zcog" -CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y -CONFIG_ARCH_NOINTC=n -CONFIG_ARCH_IRQPRIO=y CONFIG_BOARD_LOOPSPERMSEC=1250 -CONFIG_ENDIAN_BIG=y -CONFIG_DRAM_SIZE=65536 -CONFIG_ARCH_LEDS=y + # -# Z16F specific device driver settings +# Z16 Configuration Options # -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART0_BAUD=57600 -CONFIG_UART1_BAUD=57600 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 +# CONFIG_ARCH_CHIP_Z16F2810 is not set +CONFIG_ARCH_CHIP_Z16F2811=y +# CONFIG_ARCH_CHIP_Z16F3211 is not set +# CONFIG_ARCH_CHIP_Z16F6411 is not set +CONFIG_ARCH_CHIP_Z16F=y # -# General build options +# Common Configuration Options # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_RAW_BINARY=n # -# General OS setup +# Z16F Configuration Options # -CONFIG_USER_ENTRYPOINT="ostest_main" -CONFIG_DEBUG=y -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y -CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n -CONFIG_TASK_NAME_SIZE=0 -CONFIG_START_YEAR=2008 -CONFIG_START_MONTH=1 -CONFIG_START_DAY=28 -CONFIG_JULIAN_TIME=n -CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=y -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n -CONFIG_SDCLONE_DISABLE=y +CONFIG_Z16F_UART0=y +CONFIG_Z16F_UART1=y # -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. +# Architecture Options # -# There are certain dependency relationships in these -# features. +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_ARCH_STACKDUMP is not set +CONFIG_ENDIAN_BIG=y + # -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. +# Board Settings # -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n -CONFIG_DISABLE_POLL=y +CONFIG_DRAM_START= +CONFIG_DRAM_SIZE=65536 # -# Misc libc settings +# Boot options # -CONFIG_NOPRINTF_FIELDWIDTH=y +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="z16f2800100zcog" # -# Allow for architecture optimized implementations +# Common Board Options # -# The architecture can provide optimized versions of the -# following to improve sysem performance +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y + +# +# Board-Specific Options # -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=200 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2012 +CONFIG_START_MONTH=11 +CONFIG_START_DAY=29 +CONFIG_DEV_CONSOLE=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="ostest_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +CONFIG_DISABLE_POLL=y # # Sizes of configurable things (0 disables) @@ -155,8 +179,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 @@ -164,62 +186,307 @@ CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 # -# TCP/IP and UDP support via uIP +# Stack and heap information +# +# CONFIG_CUSTOM_STACK is not set +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=4096 + # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_LOWLEVEL_CONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set # -# UIP Network Utilities +# UART0 Configuration # -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=57600 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 # -# Settings for examples/nsh -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_CMD_SIZE=40 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=57600 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set # -# Stack and heap information +# System Logging Device Options # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=4096 -CONFIG_USERMAIN_STACKSIZE=4096 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=4096 -CONFIG_HEAP_SIZE= -CONFIG_HEAP_BASE= # -# Maintain legacy build behavior (revisit) +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_HAVE_HEAP2=y +CONFIG_HEAP2_BASE=0x00000000 +CONFIG_HEAP2_SIZE=0 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +CONFIG_NOPRINTF_FIELDWIDTH=y +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +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_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Named Applications +# +# CONFIG_NAMEDAPP is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +CONFIG_EXAMPLES_OSTEST=y +# CONFIG_EXAMPLES_OSTEST_BUILTIN is not set +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=8 +CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 +CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters # -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# 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 +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/z16f2800100zcog/pashello/defconfig b/nuttx/configs/z16f2800100zcog/pashello/defconfig index eec7b1575..c9f0d9673 100644 --- a/nuttx/configs/z16f2800100zcog/pashello/defconfig +++ b/nuttx/configs/z16f2800100zcog/pashello/defconfig @@ -1,225 +1,486 @@ -############################################################################ -# configs/z16f2800100zcog/pashello/defconfig -# -# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ -# -# Architecture selection # -CONFIG_ARCH="z16" +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +CONFIG_DEBUG=y +# CONFIG_DEBUG_VERBOSE is not set +# CONFIG_DEBUG_ENABLE is not set + +# +# Subsystem Debug Options +# +# CONFIG_DEBUG_MM is not set +# CONFIG_DEBUG_SCHED is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_DEBUG_LIB is not set +# CONFIG_DEBUG_BINFMT is not set +# CONFIG_DEBUG_GRAPHICS is not set + +# +# Driver Debug Options +# +# CONFIG_DEBUG_ANALOG is not set +# CONFIG_DEBUG_DMA is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set CONFIG_ARCH_Z16=y +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="z16" CONFIG_ARCH_CHIP="z16f" -CONFIG_ARCH_CHIP_Z16F=y -CONFIG_ARCH_CHIP_Z16F2810=n +CONFIG_BOARD_LOOPSPERMSEC=1250 + +# +# Z16 Configuration Options +# +# CONFIG_ARCH_CHIP_Z16F2810 is not set CONFIG_ARCH_CHIP_Z16F2811=y -CONFIG_ARCH_CHIP_Z16F3211=n -CONFIG_ARCH_CHIP_Z16F6411=n -CONFIG_ARCH_BOARD="z16f2800100zcog" -CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y -CONFIG_ARCH_NOINTC=n +# CONFIG_ARCH_CHIP_Z16F3211 is not set +# CONFIG_ARCH_CHIP_Z16F6411 is not set +CONFIG_ARCH_CHIP_Z16F=y + +# +# Common Configuration Options +# + +# +# Z16F Configuration Options +# +CONFIG_Z16F_UART0=y +CONFIG_Z16F_UART1=y + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set CONFIG_ARCH_IRQPRIO=y -CONFIG_BOARD_LOOPSPERMSEC=1250 +# CONFIG_ARCH_STACKDUMP is not set CONFIG_ENDIAN_BIG=y + +# +# Board Settings +# +CONFIG_DRAM_START= CONFIG_DRAM_SIZE=65536 -CONFIG_ARCH_LEDS=y + # -# Z16F specific device driver settings +# Boot options # -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART0_BAUD=57600 -CONFIG_UART1_BAUD=57600 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set # -# General build options +# Board Selection # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_RAW_BINARY=n +CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="z16f2800100zcog" # -# General OS setup +# Common Board Options # -CONFIG_USER_ENTRYPOINT="pashello_main" -CONFIG_DEBUG=y -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2008 CONFIG_START_MONTH=1 CONFIG_START_DAY=28 -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y CONFIG_DEV_LOWCONSOLE=y -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="pashello_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +CONFIG_DISABLE_POLL=y # -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. +# Sizes of configurable things (0 disables) # -# There are certain dependency relationships in these -# features. +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + # -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. +# Stack and heap information # -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n -CONFIG_DISABLE_POLL=y +# CONFIG_CUSTOM_STACK is not set +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=4096 # -# Misc libc settings +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_LOWLEVEL_CONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + # -CONFIG_NOPRINTF_FIELDWIDTH=y +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=57600 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 # -# Allow for architecture optimized implementations +# UART1 Configuration # -# The architecture can provide optimized versions of the -# following to improve sysem performance +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=57600 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options # -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n # -# Sizes of configurable things (0 disables) +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_HAVE_HEAP2=y +CONFIG_HEAP2_BASE=0x00000000 +CONFIG_HEAP2_SIZE=0 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines # -CONFIG_MAX_TASKS=16 -CONFIG_MAX_TASK_ARGS=4 -CONFIG_NPTHREAD_KEYS=4 -CONFIG_NFILE_DESCRIPTORS=8 -CONFIG_NFILE_STREAMS=8 -CONFIG_NAME_MAX=32 CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 -CONFIG_PREALLOC_MQ_MSGS=4 -CONFIG_MQ_MAXMSGSIZE=32 -CONFIG_MAX_WDOGPARMS=2 -CONFIG_PREALLOC_WDOGS=4 -CONFIG_PREALLOC_TIMERS=4 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +CONFIG_NOPRINTF_FIELDWIDTH=y +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +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_HAVE_CXX is not set # -# TCP/IP and UDP support via uIP +# Application Configuration # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n # -# UIP Network Utilities +# Named Applications # -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 +# CONFIG_NAMEDAPP is not set # -# Settings for examples/nsh -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_CMD_SIZE=40 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +CONFIG_EXAMPLES_PASHELLO=y +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set # -# Stack and heap information +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +CONFIG_INTERPRETERS_PCODE=y + +# +# Network Utilities +# + +# +# 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 +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=4096 -CONFIG_USERMAIN_STACKSIZE=4096 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=4096 -CONFIG_HEAP_SIZE= -CONFIG_HEAP_BASE= # -# Maintain legacy build behavior (revisit) +# System NSH Add-Ons # -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/z8encore000zco/README.txt b/nuttx/configs/z8encore000zco/README.txt index 9ec1b80af..7ca50db8c 100644 --- a/nuttx/configs/z8encore000zco/README.txt +++ b/nuttx/configs/z8encore000zco/README.txt @@ -101,8 +101,8 @@ available: b. You can't use setenv.sh in the native Windows environment. Try scripts/setenv.bat instead. c. At present, the native Windows build fails at the final link stages. - The failure is due to problems in arch/z80/src/nuttx/linkcmd that - is autogenerated by arch/z80/src/Makefile.zdsii. The basic program + The failure is due to problems in arch/z80/src/nuttx.linkcmd that + is autogenerated by arch/z80/src/Makefile.zdsii. The basic problem is the spurious spaces and and carrirage returns are generated at the end of the lines after a line continuation (\ ^M). If these trailing bad characters are manually eliminated, then the build diff --git a/nuttx/configs/z8encore000zco/ostest/defconfig b/nuttx/configs/z8encore000zco/ostest/defconfig index a79355b71..7ff44faae 100644 --- a/nuttx/configs/z8encore000zco/ostest/defconfig +++ b/nuttx/configs/z8encore000zco/ostest/defconfig @@ -397,8 +397,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/configs/z8f64200100kit/README.txt b/nuttx/configs/z8f64200100kit/README.txt index 7356c8e87..b0f224ad8 100644 --- a/nuttx/configs/z8f64200100kit/README.txt +++ b/nuttx/configs/z8f64200100kit/README.txt @@ -101,8 +101,8 @@ available: b. You can't use setenv.sh in the native Windows environment. Try scripts/setenv.bat instead. c. At present, the native Windows build fails at the final link stages. - The failure is due to problems in arch/z80/src/nuttx/linkcmd that - is autogenerated by arch/z80/src/Makefile.zdsii. The basic program + The failure is due to problems in arch/z80/src/nuttx.linkcmd that + is autogenerated by arch/z80/src/Makefile.zdsii. The basic problem is the spurious spaces and and carrirage returns are generated at the end of the lines after a line continuation (\ ^M). If these trailing bad characters are manually eliminated, then the build diff --git a/nuttx/configs/z8f64200100kit/ostest/defconfig b/nuttx/configs/z8f64200100kit/ostest/defconfig index 2389a0d34..1650600cd 100644 --- a/nuttx/configs/z8f64200100kit/ostest/defconfig +++ b/nuttx/configs/z8f64200100kit/ostest/defconfig @@ -397,8 +397,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # Interpreters # -# CONFIG_FICL is not set -# CONFIG_PCODE is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # # Network Utilities diff --git a/nuttx/tools/incdir.sh b/nuttx/tools/incdir.sh index af83f8517..145bfe9bb 100755 --- a/nuttx/tools/incdir.sh +++ b/nuttx/tools/incdir.sh @@ -215,7 +215,7 @@ for dir in $dirlist; do if [ -z "$response" ]; then response="${cmdarg}'"${path} else - response=${response}":${path}" + response=${response}";${path}" fi else # Treat the first directory differently -- cgit v1.2.3 From 7f7356cdc914dacae1cec0de2671e026f4f8dd01 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 1 Dec 2012 15:43:51 +0000 Subject: standard keypad inteface and apps/examples/keypadtest from Denis Carikli git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5403 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/Kconfig | 1 + apps/examples/Make.defs | 4 + apps/examples/Makefile | 4 +- apps/examples/README.txt | 13 +++ apps/examples/keypadtest/Kconfig | 21 ++++ apps/examples/keypadtest/Makefile | 108 +++++++++++++++++++ apps/examples/keypadtest/keypadtest_main.c | 138 +++++++++++++++++++++++++ nuttx/ChangeLog | 3 + nuttx/arch/arm/src/calypso/calypso_keypad.c | 8 ++ nuttx/configs/compal_e99/nsh_highram/appconfig | 3 +- nuttx/configs/compal_e99/nsh_highram/defconfig | 1 + nuttx/graphics/nxglib/nxglib_splitline.c | 3 +- nuttx/include/nuttx/input/keypad.h | 54 ++++++++++ 14 files changed, 358 insertions(+), 5 deletions(-) create mode 100644 apps/examples/keypadtest/Kconfig create mode 100644 apps/examples/keypadtest/Makefile create mode 100644 apps/examples/keypadtest/keypadtest_main.c create mode 100644 nuttx/include/nuttx/input/keypad.h (limited to 'apps/examples') diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 673838067..d6e5de3c1 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -428,3 +428,5 @@ From Freddie Chopin. * Rename CONFIG_PCODE and CONFIG_FICL as CONFIG_INTERPRETERS_PCODE and CONFIG_INTERPRETERS_FICL for consistency with other configuration naming. + * apps/examples/keypadtest: A keypad test example contributed by Denis + Carikli \ No newline at end of file diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index c0d126ad4..ae5f0a61a 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -17,6 +17,7 @@ source "$APPSDIR/examples/hello/Kconfig" source "$APPSDIR/examples/helloxx/Kconfig" source "$APPSDIR/examples/json/Kconfig" source "$APPSDIR/examples/hidkbd/Kconfig" +source "$APPSDIR/examples/keypadtest/Kconfig" source "$APPSDIR/examples/igmp/Kconfig" source "$APPSDIR/examples/lcdrw/Kconfig" source "$APPSDIR/examples/mm/Kconfig" diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index 3d95ccb16..91f1331df 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -98,6 +98,10 @@ ifeq ($(CONFIG_EXAMPLES_JSON),y) CONFIGURED_APPS += examples/json endif +ifeq ($(CONFIG_EXAMPLES_KEYPADTEST),y) +CONFIGURED_APPS += examples/keypadtest +endif + ifeq ($(CONFIG_EXAMPLES_LCDRW),y) CONFIGURED_APPS += examples/lcdrw endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 9d20e9312..bdbfd4de8 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -38,7 +38,7 @@ # Sub-directories SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc -SUBDIRS += ftpd hello helloxx hidkbd igmp json 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 += nxlines nxtext ostest pashello pipe poll pwm qencoder relays SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip @@ -57,7 +57,7 @@ SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CNTXTDIRS += adc can cdcacm composite cxxtestdhcpd discover ftpd json +CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd json keypadtest CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson endif diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 1463b0253..e40a63be9 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -580,6 +580,19 @@ examples/json on 2011-10-10 so I presume that the code is stable and there is no risk of maintaining duplicate logic in the NuttX repository. +examples/keypadtest +^^^^^^^^^^^^^^^^^^^ + + This is a generic keypad test example. It is similar to the USB hidkbd + example, but makes no assumptions about the underlying keyboard interface. + It uses the interfaces of include/nuttx/input/keypad.h. + + CONFIG_EXAMPLES_KEYPADTEST - Selects the keypadtest example (only need + if the mconf/Kconfig tool is used. + + CONFIG_EXAMPLES_KEYPAD_DEVNAME - The name of the keypad device that will + be opened in order to perform the keypad test. Default: "/dev/keypad" + examples/lcdrw ^^^^^^^^^^^^^^ diff --git a/apps/examples/keypadtest/Kconfig b/apps/examples/keypadtest/Kconfig new file mode 100644 index 000000000..9dee80633 --- /dev/null +++ b/apps/examples/keypadtest/Kconfig @@ -0,0 +1,21 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +config EXAMPLES_KEYPADTEST + bool "Keypad test example program" + default n + ---help--- + Enable the Keypad test example programe + +if EXAMPLES_KEYPADTEST + + config EXAMPLES_KEYPAD_DEVNAME + string "Keypad Device Name" + default "/dev/keypad" + ---help--- + The name of the keypad device that will be opened in order to perform + the keypad test. Default: "/dev/keypad" + +endif diff --git a/apps/examples/keypadtest/Makefile b/apps/examples/keypadtest/Makefile new file mode 100644 index 000000000..3de0556a2 --- /dev/null +++ b/apps/examples/keypadtest/Makefile @@ -0,0 +1,108 @@ +############################################################################ +# apps/examples/keypadtest/Makefile +# +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Keypad Test Example + +ASRCS = +CSRCS = keypadtest_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else +ifeq ($(WINTOOL),y) + BIN = ..\\..\\libapps$(LIBEXT) +else + BIN = ../../libapps$(LIBEXT) +endif +endif + +# helloxx built-in application info + +APPNAME = keypadtest +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + $(call DELFILE, .built) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/apps/examples/keypadtest/keypadtest_main.c b/apps/examples/keypadtest/keypadtest_main.c new file mode 100644 index 000000000..afdc3e08a --- /dev/null +++ b/apps/examples/keypadtest/keypadtest_main.c @@ -0,0 +1,138 @@ +/**************************************************************************** + * examples/keypadtest/keypadtest_main.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 Gregory Nutt 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 + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Sanity checking */ + +/* Provide some default values for other configuration settings */ + +#ifndef CONFIG_EXAMPLES_KEYPAD_DEVNAME +# define CONFIG_EXAMPLES_KEYPAD_DEVNAME "/dev/keypad" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: keypadtest_main + ****************************************************************************/ + +int keypadtest_main(int argc, char *argv[]) +{ + char buffer[256]; + ssize_t nbytes; + int fd; + int ret; + + /* First, register the keyboard device(s) */ + + printf("keypadtest_main: Register keyboard device\n"); + ret = keypad_kbdinit(); + if (ret != OK) + { + printf("keypadtest_main: Failed to register the KBD class\n"); + fflush(stdout); + return 1; + } + + /* Open the configured keyboard device. */ + + printf("keypadtest_main: Opening device %s\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME); + fd = open(CONFIG_EXAMPLES_KEYPAD_DEVNAME, O_RDONLY); + if (fd < 0) + { + printf("keypadtest_main: open() failed: %d\n", errno); + fflush(stdout); + return 1; + } + + printf("keypadtest_main: Device %s opened\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME); + fflush(stdout); + + /* Loop until there is a read failure */ + + do + { + /* Read a buffer of data */ + + nbytes = read(fd, buffer, 256); + if (nbytes > 0) + { + /* On success, echo the buffer to stdout */ + + (void)write(1, buffer, nbytes); + } + } + while (nbytes >= 0); + + printf("keypadtest_main: Closing device %s: %d\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME, (int)nbytes); + fflush(stdout); + close(fd); + return 0; +} diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 73c873f01..61a5a26d6 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3719,3 +3719,6 @@ * configs/z16f2800100zcog/ostest - Now supports a native Windows build (other ZNEO configs may also support the native build, but this has not been verfiied). + * include/nuttx/input/keypad.h, arch/arm/src/calypso/calypso_keypad.c, and + configs/compal_e99/nsh_highram: First cut at a standard keypad interface + definition. Contributed by Denis Carikli. diff --git a/nuttx/arch/arm/src/calypso/calypso_keypad.c b/nuttx/arch/arm/src/calypso/calypso_keypad.c index d7f8ec780..cdc22b286 100644 --- a/nuttx/arch/arm/src/calypso/calypso_keypad.c +++ b/nuttx/arch/arm/src/calypso/calypso_keypad.c @@ -369,3 +369,11 @@ void up_keypad(void) (void)register_driver("/dev/keypad", &keypad_ops, 0444, NULL); } + +int keypad_kbdinit(void) +{ + calypso_armio(); + up_keypad(); + + return OK; +} diff --git a/nuttx/configs/compal_e99/nsh_highram/appconfig b/nuttx/configs/compal_e99/nsh_highram/appconfig index db5e61236..dfe0be587 100644 --- a/nuttx/configs/compal_e99/nsh_highram/appconfig +++ b/nuttx/configs/compal_e99/nsh_highram/appconfig @@ -40,9 +40,8 @@ CONFIGURED_APPS += nshlib # Path to example in apps/examples -#CONFIGURED_APPS += examples/hello #fails not finding hello_main despite of good config CONFIGURED_APPS += system/poweroff -CONFIGURED_APPS += examples/ostest +CONFIGURED_APPS += examples/keypadtest CONFIGURED_APPS += examples/nxtext CONFIGURED_APPS += examples/nxhello CONFIGURED_APPS += examples/nxlines diff --git a/nuttx/configs/compal_e99/nsh_highram/defconfig b/nuttx/configs/compal_e99/nsh_highram/defconfig index 1f4d54a1c..1d405874e 100644 --- a/nuttx/configs/compal_e99/nsh_highram/defconfig +++ b/nuttx/configs/compal_e99/nsh_highram/defconfig @@ -245,6 +245,7 @@ CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 # Settings for examples/nsh CONFIG_NSH_CONSOLE=y CONFIG_NSH_TELNET=n +CONFIG_NSH_DISABLE_HEXDUMP=n CONFIG_NSH_IOBUFFER_SIZE=512 CONFIG_NSH_CMD_SIZE=40 CONFIG_NSH_STACKSIZE=4096 diff --git a/nuttx/graphics/nxglib/nxglib_splitline.c b/nuttx/graphics/nxglib/nxglib_splitline.c index cbf2d5ff3..11658e149 100644 --- a/nuttx/graphics/nxglib/nxglib_splitline.c +++ b/nuttx/graphics/nxglib/nxglib_splitline.c @@ -197,7 +197,8 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector, abs(line.pt2.x - line.pt1.x) < (line.pt2.y - line.pt1.y)) { /* A close to vertical line of width 1 is basically - * a single parallelogram of width 1 */ + * a single parallelogram of width 1. + */ traps[1].top.x1 = itob16(line.pt1.x); traps[1].top.x2 = traps[1].top.x1; diff --git a/nuttx/include/nuttx/input/keypad.h b/nuttx/include/nuttx/input/keypad.h new file mode 100644 index 000000000..574b421c1 --- /dev/null +++ b/nuttx/include/nuttx/input/keypad.h @@ -0,0 +1,54 @@ +/************************************************************************************ + * include/nuttx/input/keypad.h + * + * Copyright (C) 2012 Denis Carikli. + * Author: Denis Carikli + * + * 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. + * + ************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_INPUT_KEYPAD_H +#define __INCLUDE_NUTTX_INPUT_KEYPAD_H + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +int keypad_kbdinit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_INPUT_KEYPAD_H */ + -- cgit v1.2.3 From 56a650461894d8ab541277010e93fd5ca75f9f0d Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 19 Dec 2012 17:54:26 +0000 Subject: Incorporate address environment interfaces in binfmt/ logic git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5443 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/nxflat/Makefile | 2 +- nuttx/ChangeLog | 7 + nuttx/Documentation/NuttxPortingGuide.html | 8 +- nuttx/arch/arm/src/lm3s/lm3s_ssi.c | 5 + nuttx/binfmt/binfmt_dumpmodule.c | 3 + nuttx/binfmt/binfmt_execmodule.c | 45 +++++- nuttx/binfmt/binfmt_unloadmodule.c | 39 ++++- nuttx/binfmt/elf.c | 23 ++- nuttx/binfmt/libelf/Make.defs | 6 +- nuttx/binfmt/libelf/libelf.h | 85 ++++++++++- nuttx/binfmt/libelf/libelf_addrenv.c | 176 ++++++++++++++++++++++ nuttx/binfmt/libelf/libelf_bind.c | 36 ++++- nuttx/binfmt/libelf/libelf_load.c | 35 ++++- nuttx/binfmt/libelf/libelf_read.c | 6 +- nuttx/binfmt/libelf/libelf_unload.c | 13 +- nuttx/binfmt/libnxflat/Make.defs | 6 +- nuttx/binfmt/libnxflat/libnxflat.h | 136 +++++++++++++++++ nuttx/binfmt/libnxflat/libnxflat_addrenv.c | 234 +++++++++++++++++++++++++++++ nuttx/binfmt/libnxflat/libnxflat_bind.c | 128 +++++++++++++++- nuttx/binfmt/libnxflat/libnxflat_load.c | 56 +++++-- nuttx/binfmt/libnxflat/libnxflat_unload.c | 19 +-- nuttx/binfmt/nxflat.c | 23 ++- nuttx/configs/eagle100/httpd/setenv.sh | 26 +++- nuttx/configs/eagle100/nettest/setenv.sh | 26 +++- nuttx/configs/eagle100/nsh/setenv.sh | 26 +++- nuttx/configs/eagle100/nxflat/setenv.sh | 26 +++- nuttx/include/nuttx/binfmt/binfmt.h | 17 +++ nuttx/include/nuttx/binfmt/elf.h | 46 +++++- nuttx/include/nuttx/binfmt/nxflat.h | 39 ++++- nuttx/include/nuttx/sched.h | 32 +++- 30 files changed, 1225 insertions(+), 104 deletions(-) create mode 100644 nuttx/binfmt/libelf/libelf_addrenv.c create mode 100644 nuttx/binfmt/libnxflat/libnxflat.h create mode 100644 nuttx/binfmt/libnxflat/libnxflat_addrenv.c (limited to 'apps/examples') diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile index 344ee9c6d..94092bd39 100644 --- a/apps/examples/nxflat/Makefile +++ b/apps/examples/nxflat/Makefile @@ -76,7 +76,7 @@ $(COBJS): %$(OBJEXT): %.c headers: @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) -.built: $(OBJS) +.built: headers $(OBJS) $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c932a1f2d..1296076b6 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3792,3 +3792,10 @@ logic on initial check-in * binfmt/binfmt_loadmodule.c: load_module() will now traverse the PATH variable to locate files from their relative path. + * include/nuttx/arch.h and arch/z80/src/z180/z180_mmu.c: Restructure the + address environment interfaces so that they will better integrate with + binfmt/. + * binfmt/libelf/*, binfmt/libnxflat/* and other files: Integrate the + 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). diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 526892d3e..0408f82ac 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -2130,7 +2130,7 @@ else

Binary Loader Support. These are low-level interfaces used in binfmt/ to instantiate tasks with address environments. - These interfaces all operate on type task_addrenv_t which is an abstract representation of a asks's address environment and must be defined in arch/arch.h if CONFIG_ADDRENVM is defined. + These interfaces all operate on type task_addrenv_t which is an abstract representation of a asks's address environment and must be defined in arch/arch.h if CONFIG_ADDRENV is defined. These low-level interfaces include:

    @@ -2174,7 +2174,7 @@ else
  • 4.1.21.8 up_addrenv_release(): - ARelease the TCBs reference to an address environment when a task/thread exits. + Release the TCB's reference to an address environment when a task/thread exits.
@@ -3930,7 +3930,9 @@ void (*notify)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate); up_prioritize_irq() API.
  • CONFIG_ADDRENV: The CPU supports an MMU and CPU port supports provision of address - environments for tasks (making the, perhaps, processes).
  • + environments for tasks (making the, perhaps, processes). + In this case, the CPU-specific logic must provide a set of address environment interfaces as defined in the Address Environments paragraph. +

    diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c index c756e2b6a..8d1987992 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c @@ -209,8 +209,11 @@ static inline void ssi_putreg(struct lm3s_ssidev_s *priv, unsigned int offset, static uint32_t ssi_disable(struct lm3s_ssidev_s *priv); static void ssi_enable(struct lm3s_ssidev_s *priv, uint32_t enable); + +#ifndef CONFIG_SSI_POLLWAIT static void ssi_semtake(sem_t *sem); #define ssi_semgive(s) sem_post(s); +#endif /* SSI data transfer */ @@ -446,6 +449,7 @@ static void ssi_enable(struct lm3s_ssidev_s *priv, uint32_t enable) * ****************************************************************************/ +#ifndef CONFIG_SSI_POLLWAIT static void ssi_semtake(sem_t *sem) { int ret; @@ -456,6 +460,7 @@ static void ssi_semtake(sem_t *sem) while (ret < 0 && errno == EINTR); DEBUGASSERT(ret == 0); } +#endif /**************************************************************************** * Name: ssi_txnull, ssi_txuint16, and ssi_txuint8 diff --git a/nuttx/binfmt/binfmt_dumpmodule.c b/nuttx/binfmt/binfmt_dumpmodule.c index cd52136b0..d320bc830 100644 --- a/nuttx/binfmt/binfmt_dumpmodule.c +++ b/nuttx/binfmt/binfmt_dumpmodule.c @@ -95,6 +95,9 @@ int dump_module(FAR const struct binary_s *bin) #ifdef CONFIG_BINFMT_CONSTRUCTORS bdbg(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors); bdbg(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors); +#endif +#ifdef CONFIG_ADDRENV + bdbg(" addrenv: %p\n", bin->addrenv); #endif bdbg(" stacksize: %d\n", bin->stacksize); } diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index 37f445966..400451c40 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -86,11 +86,26 @@ ****************************************************************************/ #ifdef CONFIG_BINFMT_CONSTRUCTORS -static inline void exec_ctors(FAR const struct binary_s *binp) +static inline int exec_ctors(FAR const struct binary_s *binp) { binfmt_ctor_t *ctor = binp->ctors; +#ifdef CONFIG_ADDRENV + hw_addrenv_t oldenv; + int ret; +#endif int i; + /* Instantiate the address enviroment containing the constructors */ + +#ifdef CONFIG_ADDRENV + ret = up_addrenv_select(binp->addrenv, &oldenv); + if (ret < 0) + { + bdbg("up_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Execute each constructor */ for (i = 0; i < binp->nctors; i++) @@ -100,6 +115,14 @@ static inline void exec_ctors(FAR const struct binary_s *binp) (*ctor)(); ctor++; } + + /* Restore the address enviroment */ + +#ifdef CONFIG_ADDRENV + return up_addrenv_restore(oldenv); +#else + return OK; +#endif } #endif @@ -190,6 +213,18 @@ int exec_module(FAR const struct binary_s *binp, int priority) up_initial_state(tcb); #endif + /* Assign the address environment to the task */ + +#ifdef CONFIG_ADDRENV + ret = up_addrenv_assign(binp->addrenv, tcb); + if (ret < 0) + { + err = -ret; + bdbg("up_addrenv_assign() failed: %d\n", ret); + goto errout_with_stack; + } +#endif + /* Get the assigned pid before we start the task */ pid = tcb->pid; @@ -197,7 +232,13 @@ int exec_module(FAR const struct binary_s *binp, int priority) /* Execute all of the C++ static constructors */ #ifdef CONFIG_BINFMT_CONSTRUCTORS - exec_ctors(binp); + ret = exec_ctors(binp); + if (ret < 0) + { + err = -ret; + bdbg("exec_ctors() failed: %d\n", ret); + goto errout_with_stack; + } #endif /* Then activate the task at the provided priority */ diff --git a/nuttx/binfmt/binfmt_unloadmodule.c b/nuttx/binfmt/binfmt_unloadmodule.c index 52243fcf7..a0050481c 100644 --- a/nuttx/binfmt/binfmt_unloadmodule.c +++ b/nuttx/binfmt/binfmt_unloadmodule.c @@ -86,8 +86,23 @@ static inline void exec_dtors(FAR const struct binary_s *binp) { binfmt_dtor_t *dtor = binp->dtors; +#ifdef CONFIG_ADDRENV + hw_addrenv_t oldenv; + int ret; +#endif int i; + /* Instantiate the address enviroment containing the destructors */ + +#ifdef CONFIG_ADDRENV + ret = up_addrenv_select(binp->addrenv, &oldenv); + if (ret < 0) + { + bdbg("up_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Execute each destructor */ for (i = 0; i < binp->ndtors; i++) @@ -97,6 +112,14 @@ static inline void exec_dtors(FAR const struct binary_s *binp) (*dtor)(); dtor++; } + + /* Restore the address enviroment */ + +#ifdef CONFIG_ADDRENV + return up_addrenv_restore(oldenv); +#else + return OK; +#endif } #endif @@ -125,15 +148,23 @@ static inline void exec_dtors(FAR const struct binary_s *binp) int unload_module(FAR const struct binary_s *binp) { +#ifdef CONFIG_BINFMT_CONSTRUCTORS + int ret; +#endif int i; if (binp) { - /* Execute C++ desctructors */ #ifdef CONFIG_BINFMT_CONSTRUCTORS - exec_dtors(binp); + ret = exec_dtors(binp); + if (ret < 0) + { + bdbg("exec_ctors() failed: %d\n", ret); + set_errno(-ret); + return ERROR; + } #endif /* Unmap mapped address spaces */ @@ -155,6 +186,10 @@ int unload_module(FAR const struct binary_s *binp) free(binp->alloc[i]); } } + + /* Notice that the address environment is not destroyed. This should + * happen automatically when the task exits. + */ } return OK; diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c index ea1e7b0ca..bcebf13ca 100644 --- a/nuttx/binfmt/elf.c +++ b/nuttx/binfmt/elf.c @@ -215,9 +215,22 @@ static int elf_loadbinary(struct binary_s *binp) /* Return the load information */ binp->entrypt = (main_t)(loadinfo.elfalloc + loadinfo.ehdr.e_entry); - binp->alloc[0] = (FAR void *)loadinfo.elfalloc; binp->stacksize = CONFIG_ELF_STACKSIZE; + /* Add the ELF allocation to the alloc[] only if there is no address + * enironment. If there is an address environment, it will automatically + * be freed when the function exits + * + * REVISIT: If the module is loaded then unloaded, wouldn't this cause + * a memory leak? + */ + +#ifdef CONFIG_ADDRENV +# warning "REVISIT" +#else + binp->alloc[0] = (FAR void *)loadinfo.elfalloc; +#endif + #ifdef CONFIG_BINFMT_CONSTRUCTORS /* Save information about constructors. NOTE: desctructors are not * yet supported. @@ -232,6 +245,14 @@ static int elf_loadbinary(struct binary_s *binp) binp->ndtors = loadinfo.ndtors; #endif +#ifdef CONFIG_ADDRENV + /* Save the address environment. This will be needed when the module is + * executed for the up_addrenv_assign() call. + */ + + binp->addrenv = loadinfo.addrenv; +#endif + elf_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt, MIN(loadinfo.allocsize - loadinfo.ehdr.e_entry, 512)); diff --git a/nuttx/binfmt/libelf/Make.defs b/nuttx/binfmt/libelf/Make.defs index c8857c3f7..93d95a23c 100644 --- a/nuttx/binfmt/libelf/Make.defs +++ b/nuttx/binfmt/libelf/Make.defs @@ -41,9 +41,9 @@ BINFMT_CSRCS += elf.c # ELF library -BINFMT_CSRCS += libelf_bind.c libelf_init.c libelf_iobuffer.c libelf_load.c \ - libelf_read.c libelf_sections.c libelf_symbols.c libelf_uninit.c \ - libelf_unload.c libelf_verify.c +BINFMT_CSRCS += libelf_bind.c libelf_init.c libelf_addrenv.c libelf_iobuffer.c +BINFMT_CSRCS += libelf_load.c libelf_read.c libelf_sections.c libelf_symbols.c +BINFMT_CSRCS += libelf_uninit.c libelf_unload.c libelf_verify.c ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) BINFMT_CSRCS += libelf_ctors.c libelf_dtors.c diff --git a/nuttx/binfmt/libelf/libelf.h b/nuttx/binfmt/libelf/libelf.h index 5b0be9ab0..04c9144f6 100644 --- a/nuttx/binfmt/libelf/libelf.h +++ b/nuttx/binfmt/libelf/libelf.h @@ -45,6 +45,7 @@ #include #include +#include #include /**************************************************************************** @@ -74,7 +75,11 @@ int elf_verifyheader(FAR const Elf32_Ehdr *header); * Name: elf_read * * Description: - * Read 'readsize' bytes from the object file at 'offset' + * Read 'readsize' bytes from the object file at 'offset'. The data is + * read into 'buffer.' If 'buffer' is part of the ELF address environment, + * then the caller is responsibile for assuring that that address + * environment is in place before calling this function (i.e., that + * elf_addrenv_select() has been called if CONFIG_ADDRENV=y). * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on @@ -255,4 +260,82 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo); int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo); #endif +/**************************************************************************** + * Name: elf_addrenv_alloc + * + * Description: + * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, + * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using up_addrenv_create(). In either case, + * there will be a unique instance of elfalloc (and stack) for each + * instance of a process. + * + * Input Parameters: + * loadinfo - Load state information + * envsize - The size (in bytes) of the address environment needed for the + * ELF image. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize); + +/**************************************************************************** + * Name: elf_addrenv_select + * + * Description: + * Temporarity select the task's address environemnt. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ADDRENV +# define elf_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv) +#endif + +/**************************************************************************** + * Name: elf_addrenv_restore + * + * Description: + * Restore the address environment before elf_addrenv_select() was called.. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ADDRENV +# define elf_addrenv_restore(l) up_addrenv_restore((l)->oldenv) +#endif + +/**************************************************************************** + * Name: elf_addrenv_free + * + * Description: + * Release the address environment previously created by + * elf_addrenv_alloc(). This function is called only under certain error + * conditions after the the module has been loaded but not yet started. + * After the module has been started, the address environment will + * automatically be freed when the module exits. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo); + #endif /* __BINFMT_LIBELF_LIBELF_H */ diff --git a/nuttx/binfmt/libelf/libelf_addrenv.c b/nuttx/binfmt/libelf/libelf_addrenv.c new file mode 100644 index 000000000..28cc0e108 --- /dev/null +++ b/nuttx/binfmt/libelf/libelf_addrenv.c @@ -0,0 +1,176 @@ +/**************************************************************************** + * binfmt/libelf/libelf_addrenv.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include + +#include +#include + +#include "libelf.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Constant Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: elf_addrenv_create + * + * Description: + * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, + * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using up_addrenv_create(). In either case, + * there will be a unique instance of elfalloc (and stack) for each + * instance of a process. + * + * Input Parameters: + * loadinfo - Load state information + * envsize - The size (in bytes) of the address environment needed for the + * ELF image. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int elf_addrenv_create(FAR struct elf_loadinfo_s *loadinfo, size_t envsize) +{ +#ifdef CONFIG_ADDRENV + FAR void *vaddr; + int ret; + + /* Create an address environment for the new ELF task */ + + ret = up_addrenv_create(envsize, &loadinfo->addrenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_create failed: %d\n", ret); + return ret; + } + + /* Get the virtual address associated with the start of the address + * environment. This is the base address that we will need to use to + * access the ELF image (but only if the address environment has been + * selected. + */ + + ret = up_addrenv_vaddr(loadinfo->addrenv, &vaddr); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_vaddr failed: %d\n", ret); + return ret; + } + + loadinfo->elfalloc = (uintptr_t)vaddr; + return OK; +#else + /* Allocate memory to hold the ELF image */ + + loadinfo->elfalloc = (uintptr_t)kzalloc(envsize); + if (!loadinfo->elfalloc) + { + return -ENOMEM; + } + + return OK; +#endif +} + +/**************************************************************************** + * Name: elf_addrenv_free + * + * Description: + * Release the address environment previously created by + * elf_addrenv_create(). This function is called only under certain error + * conditions after the the module has been loaded but not yet started. + * After the module has been started, the address environment will + * automatically be freed when the module exits. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo) +{ +#ifdef CONFIG_ADDRENV + int ret; + + /* Free the address environemnt */ + + ret = up_addrenv_destroy(loadinfo->addrenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_destroy failed: %d\n", ret); + } + + /* Clear out all indications of the allocated address environment */ + + loadinfo->elfalloc = 0; + loadinfo->elfsize = 0; + loadinfo->addrenv = 0; +#else + /* If there is an allocation for the ELF image, free it */ + + if (loadinfo->elfalloc != 0) + { + kfree((FAR void *)loadinfo->elfalloc); + loadinfo->elfalloc = 0; + } + + loadinfo->elfsize = 0; +#endif +} diff --git a/nuttx/binfmt/libelf/libelf_bind.c b/nuttx/binfmt/libelf/libelf_bind.c index e35087b1d..ccdb5108e 100644 --- a/nuttx/binfmt/libelf/libelf_bind.c +++ b/nuttx/binfmt/libelf/libelf_bind.c @@ -86,10 +86,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: elf_readsym + * Name: elf_readrel * * Description: - * Read the ELFT symbol structure at the specfied index into memory. + * Read the ELF32_Rel structure into memory. * ****************************************************************************/ @@ -184,7 +184,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx, return ret; } - /* Calculate the relocation address */ + /* Calculate the relocation address. */ if (rel.r_offset < 0 || rel.r_offset > dstsec->sh_size - sizeof(uint32_t)) { @@ -195,14 +195,42 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx, addr = dstsec->sh_addr + rel.r_offset; + /* If CONFIG_ADDRENV=y, then 'addr' lies in a virtual address space that + * may not be in place now. elf_addrenv_select() will temporarily + * instantiate that address space. + */ + +#ifdef CONFIG_ADDRENV + ret = elf_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: elf_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Now perform the architecture-specific relocation */ ret = arch_relocate(&rel, &sym, addr); if (ret < 0) { - bdbg("Section %d reloc %d: Relocation failed: %d\n", ret); +#ifdef CONFIG_ADDRENV + (void)elf_addrenv_restore(loadinfo); +#endif + bdbg("ERROR: Section %d reloc %d: Relocation failed: %d\n", ret); + return ret; + } + + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = elf_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: elf_addrenv_restore() failed: %d\n", ret); return ret; } +#endif } return OK; diff --git a/nuttx/binfmt/libelf/libelf_load.c b/nuttx/binfmt/libelf/libelf_load.c index b1ac44e21..0e4ad9798 100644 --- a/nuttx/binfmt/libelf/libelf_load.c +++ b/nuttx/binfmt/libelf/libelf_load.c @@ -49,7 +49,6 @@ #include #include -#include #include #include "libelf.h" @@ -135,11 +134,12 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo) int i; /* Allocate (and zero) memory for the ELF file. */ - - loadinfo->elfalloc = (uintptr_t)kzalloc(loadinfo->elfsize); - if (!loadinfo->elfalloc) + + ret = elf_addrenv_alloc(loadinfo, loadinfo->elfsize); + if (ret < 0) { - return -ENOMEM; + bdbg("ERROR: elf_addrenv_alloc() failed: %d\n", ret); + return ret; } /* Read each section into memory that is marked SHF_ALLOC + SHT_NOBITS */ @@ -165,6 +165,20 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo) if (shdr->sh_type != SHT_NOBITS) { + /* If CONFIG_ADDRENV=y, then 'dest' lies in a virtual address space + * that may not be in place now. elf_addrenv_select() will + * temporarily instantiate that address space. + */ + +#ifdef CONFIG_ADDRENV + ret = elf_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: elf_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Read the section data from sh_offset to dest */ ret = elf_read(loadinfo, dest, shdr->sh_size, shdr->sh_offset); @@ -173,6 +187,17 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo) bdbg("Failed to read section %d: %d\n", i, ret); return ret; } + + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = elf_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: elf_addrenv_restore() failed: %d\n", ret); + return ret; + } +#endif } /* Update sh_addr to point to copy in memory */ diff --git a/nuttx/binfmt/libelf/libelf_read.c b/nuttx/binfmt/libelf/libelf_read.c index da41212f2..f4b725183 100644 --- a/nuttx/binfmt/libelf/libelf_read.c +++ b/nuttx/binfmt/libelf/libelf_read.c @@ -98,7 +98,11 @@ static inline void elf_dumpreaddata(char *buffer, int buflen) * Name: elf_read * * Description: - * Read 'readsize' bytes from the object file at 'offset' + * Read 'readsize' bytes from the object file at 'offset'. The data is + * read into 'buffer.' If 'buffer' is part of the ELF address environment, + * then the caller is responsibile for assuring that that address + * environment is in place before calling this function (i.e., that + * elf_addrenv_select() has been called if CONFIG_ADDRENV=y). * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on diff --git a/nuttx/binfmt/libelf/libelf_unload.c b/nuttx/binfmt/libelf/libelf_unload.c index 532fc606f..539e5faf7 100644 --- a/nuttx/binfmt/libelf/libelf_unload.c +++ b/nuttx/binfmt/libelf/libelf_unload.c @@ -67,8 +67,9 @@ * Name: elf_unload * * Description: - * This function unloads the object from memory. This essentially - * undoes the actions of elf_load. + * This function unloads the object from memory. This essentially undoes + * the actions of elf_load. It is called only under certain error + * conditions after the the module has been loaded but not yet started. * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on @@ -84,13 +85,7 @@ int elf_unload(struct elf_loadinfo_s *loadinfo) /* Release memory holding the relocated ELF image */ - if (loadinfo->elfalloc != 0) - { - kfree((FAR void *)loadinfo->elfalloc); - loadinfo->elfalloc = 0; - } - - loadinfo->elfsize = 0; + elf_addrenv_free(loadinfo); /* Release memory used to hold static constructors and destructors */ diff --git a/nuttx/binfmt/libnxflat/Make.defs b/nuttx/binfmt/libnxflat/Make.defs index 4f522e52b..6a0bf1873 100644 --- a/nuttx/binfmt/libnxflat/Make.defs +++ b/nuttx/binfmt/libnxflat/Make.defs @@ -41,9 +41,9 @@ BINFMT_CSRCS += nxflat.c # NXFLAT library -BINFMT_CSRCS += libnxflat_init.c libnxflat_uninit.c libnxflat_load.c \ - libnxflat_unload.c libnxflat_verify.c libnxflat_read.c \ - libnxflat_bind.c +BINFMT_CSRCS += libnxflat_init.c libnxflat_uninit.c libnxflat_addrenv.c +BINFMT_CSRCS += libnxflat_load.c libnxflat_unload.c libnxflat_verify.c +BINFMT_CSRCS += libnxflat_read.c libnxflat_bind.c # Hook the libnxflat subdirectory into the build diff --git a/nuttx/binfmt/libnxflat/libnxflat.h b/nuttx/binfmt/libnxflat/libnxflat.h new file mode 100644 index 000000000..cb1cb7057 --- /dev/null +++ b/nuttx/binfmt/libnxflat/libnxflat.h @@ -0,0 +1,136 @@ +/**************************************************************************** + * binfmt/libnxflat/libnxflat.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __BINFMT_LIBNXFLAT_LIBNXFLAT_H +#define __BINFMT_LIBNXFLAT_LIBNXFLAT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Name: nxflat_addrenv_alloc + * + * Description: + * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, + * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using up_addrenv_create(). In either case, + * there will be a unique instance of elfalloc (and stack) for each + * instance of a process. + * + * Input Parameters: + * loadinfo - Load state information + * envsize - The size (in bytes) of the address environment needed for the + * ELF image. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize); + +/**************************************************************************** + * Name: nxflat_addrenv_select + * + * Description: + * Temporarity select the task's address environemnt. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ADDRENV +# define nxflat_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv) +#endif + +/**************************************************************************** + * Name: nxflat_addrenv_restore + * + * Description: + * Restore the address environment before nxflat_addrenv_select() was called.. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ADDRENV +# define nxflat_addrenv_restore(l) up_addrenv_restore((l)->oldenv) +#endif + +/**************************************************************************** + * Name: nxflat_addrenv_free + * + * Description: + * Release the address environment previously created by + * nxflat_addrenv_create(). This function is called only under certain + * error conditions after the the module has been loaded but not yet + * started. After the module has been started, the address environment + * will automatically be freed when the module exits. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo); + +#endif /* __BINFMT_LIBNXFLAT_LIBNXFLAT_H */ diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c new file mode 100644 index 000000000..c6b3fce34 --- /dev/null +++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c @@ -0,0 +1,234 @@ +/**************************************************************************** + * binfmt/libnxflat/libnxflat_addrenv.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include + +#include +#include + +#include "libnxflat.h" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Constant Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nxflat_addrenv_create + * + * Description: + * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, + * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using up_addrenv_create(). In either case, + * there will be a unique instance of elfalloc (and stack) for each + * instance of a process. + * + * Input Parameters: + * loadinfo - Load state information + * envsize - The size (in bytes) of the address environment needed for the + * ELF image. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int nxflat_addrenv_create(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize) +{ + FAR struct dspace_s *dspace; +#ifdef CONFIG_ADDRENV + FAR void *vaddr; + hw_addrenv_t oldenv; + int ret; +#endif + + DEBUGASSERT(!loadinfo->dspace); + + /* Allocate the struct dspace_s container for the D-Space allocation */ + + dspace = (FAR struct dspace_s *)kmalloc(sizeof(struct dspace_s)); + if (dspace == 0) + { + bdbg("ERROR: Failed to allocate DSpace\n"); + return -ENOMEM; + } + +#ifdef CONFIG_ADDRENV + /* Create a D-Space address environment for the new NXFLAT task */ + + ret = up_addrenv_create(envsize, &loadinfo->addrenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_create failed: %d\n", ret); + goto errout_with_dspace; + } + + /* Get the virtual address associated with the start of the address + * environment. This is the base address that we will need to use to + * access the D-Space region (but only if the address environment has been + * selected. + */ + + ret = up_addrenv_vaddr(loadinfo->addrenv, &vaddr); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_vaddr failed: %d\n", ret); + goto errout_with_addrenv; + } + + /* Clear all of the allocated D-Space memory. We have to temporarily + * selected the D-Space address environment to do this. + */ + + ret = up_addrenv_select(loadinfo->addrenv, &oldenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_select failed: %d\n", ret); + goto errout_with_addrenv; + } + + memset(vaddr, 0, envsize); + + ret = up_addrenv_restore(oldenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_restore failed: %d\n", ret); + goto errout_with_addrenv; + } + + /* Success... save the fruits of our labor */ + + loadinfo->dspace = dspace; + dspace->crefs = 1; + dspace->region = (FAR uint8_t *)vaddr; + return OK; + +errout_with_addrenv: + (void)up_addrenv_destroy(loadinfo->addrenv); + loadinfo->addrenv = 0; + +errout_with_dspace: + kfree(dspace); + return ret; +#else + /* Allocate (and zero) memory to hold the ELF image */ + + dspace->region = (FAR uint8_t *)kzalloc(envsize); + if (!dspace->region) + { + kfree(dspace); + return -ENOMEM; + } + + loadinfo->dspace = dspace; + dspace->crefs = 1; + return OK; +#endif +} + +/**************************************************************************** + * Name: nxflat_addrenv_free + * + * Description: + * Release the address environment previously created by + * nxflat_addrenv_create(). This function is called only under certain + * error conditions after the the module has been loaded but not yet + * started. After the module has been started, the address environment + * will automatically be freed when the module exits. + * + * Input Parameters: + * loadinfo - Load state information + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo) +{ + FAR struct dspace_s *dspace; +#ifdef CONFIG_ADDRENV + int ret; +#endif + + DEBUGASSERT(loadinfo); + dspace = loadinfo->dspace; + + if (dspace) + { +#ifdef CONFIG_ADDRENV + /* Destroy the address environment */ + + ret = up_addrenv_destroy(loadinfo->addrenv); + if (ret < 0) + { + bdbg("ERROR: up_addrenv_destroy failed: %d\n", ret); + } + + loadinfo->addrenv = 0; +#else + /* Free the allocated D-Space region */ + + if (dspace->region) + { + kfree(dspace->region); + } +#endif + + /* Now destroy the D-Space container */ + + DEBUGASSERT(dspace->crefs == 1); + kfree(dspace); + loadinfo->dspace = NULL; + } +} diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c index 2b9f64715..3a86d5355 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_bind.c +++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c @@ -47,9 +47,12 @@ #include #include + #include #include +#include "libnxflat.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -229,8 +232,6 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) hdr = (FAR struct nxflat_hdr_s*)loadinfo->ispace; - /* From this, we can get the list of relocation entries. */ - /* From this, we can get the offset to the list of relocation entries */ offset = ntohl(hdr->h_relocstart); @@ -252,6 +253,22 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) bvdbg("isize: %08lx dpsace: %p relocs: %p\n", (long)loadinfo->isize, loadinfo->dspace->region, relocs); + /* All relocations are performed within the D-Space allocation. If + * CONFIG_ADDRENV=y, then that D-Space allocation lies in an address + * environment that may not be in place. So, in that case, we must call + * nxflat_addrenv_select to temporarily instantiate that address space + * before the relocations can be performed. + */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Now, traverse the relocation list of and bind each GOT relocation. */ ret = OK; /* Assume success */ @@ -329,6 +346,16 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) } #endif + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret); + } +#endif + return ret; } @@ -346,16 +373,19 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) ****************************************************************************/ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo, - FAR const struct symtab_s *exports, - int nexports) + FAR const struct symtab_s *exports, + int nexports) { FAR struct nxflat_import_s *imports; FAR struct nxflat_hdr_s *hdr; - FAR const struct symtab_s *symbol; + FAR const struct symtab_s *symbol; char *symname; uint32_t offset; uint16_t nimports; +#ifdef CONFIG_ADDRENV + int ret; +#endif int i; /* The NXFLAT header is the first thing at the beginning of the ISpace. */ @@ -370,6 +400,22 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo, nimports = ntohs(hdr->h_importcount); bvdbg("Imports offset: %08x nimports: %d\n", offset, nimports); + /* The import[] table resides within the D-Space allocation. If + * CONFIG_ADDRENV=y, then that D-Space allocation lies in an address + * environment that may not be in place. So, in that case, we must call + * nxflat_addrenv_select to temporarily instantiate that address space + * before the import[] table can be modified. + */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + /* Verify that this module requires imported symbols */ if (offset != 0 && nimports > 0) @@ -421,6 +467,9 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo, if (!symbol) { bdbg("Exported symbol \"%s\" not found\n", symname); +#ifdef CONFIG_ADDRENV + (void)nxflat_addrenv_restore(loadinfo); +#endif return -ENOENT; } @@ -442,7 +491,73 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo, } #endif + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret); + } + + return ret; +#else return OK; +#endif +} + +/**************************************************************************** + * Name: nxflat_clearbss + * + * Description: + * Clear uninitialized .bss memory + * + * Returned Value: + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + ****************************************************************************/ + +static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo) +{ +#ifdef CONFIG_ADDRENV + int ret; +#endif + + /* .bss resides within the D-Space allocation. If CONFIG_ADDRENV=y, then + * that D-Space allocation lies in an address environment that may not be + * in place. So, in that case, we must call nxflat_addrenv_select to + * temporarily instantiate that address space before the .bss can be + * accessed. + */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + + /* Zero the BSS area */ + + memset((void*)(loadinfo->dspace->region + loadinfo->datasize), 0, + loadinfo->bsssize); + + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret); + } + + return ret; +#else + return OK; +#endif } /**************************************************************************** @@ -484,8 +599,7 @@ int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo, * space in the loaded file. */ - memset((void*)(loadinfo->dspace->region + loadinfo->datasize), - 0, loadinfo->bsssize); + ret = nxflat_clearbss(loadinfo); } } diff --git a/nuttx/binfmt/libnxflat/libnxflat_load.c b/nuttx/binfmt/libnxflat/libnxflat_load.c index b6693ea36..5f13b577a 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_load.c +++ b/nuttx/binfmt/libnxflat/libnxflat_load.c @@ -41,6 +41,7 @@ #include #include + #include #include #include @@ -48,8 +49,11 @@ #include #include + #include +#include "libnxflat.h" + /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -143,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); @@ -152,23 +156,37 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo) bvdbg("Mapped ISpace (%d bytes) at %08x\n", loadinfo->isize, loadinfo->ispace); - /* The following call will give a pointer to the allocated but - * uninitialized ISpace memory. + /* The following call allocate D-Space memory and will provide a pointer + * to the allocated (but still uninitialized) D-Space memory. */ - loadinfo->dspace = (struct dspace_s *)malloc(SIZEOF_DSPACE_S(loadinfo->dsize)); - if (loadinfo->dspace == 0) + ret = nxflat_addrenv_alloc(loadinfo, loadinfo->dsize); + if (ret < 0) { - bdbg("Failed to allocate DSpace\n"); - ret = -ENOMEM; - goto errout; + bdbg("ERROR: nxflat_addrenv_alloc() failed: %d\n", ret); + return ret; } - loadinfo->dspace->crefs = 1; - bvdbg("Allocated DSpace (%d bytes) at %p\n", loadinfo->dsize, loadinfo->dspace->region); + bvdbg("Allocated DSpace (%d bytes) at %p\n", + loadinfo->dsize, loadinfo->dspace->region); - /* Now, read the data into allocated DSpace at doffset into the - * allocated DSpace memory. + /* If CONFIG_ADDRENV=y, then the D-Space allocation lies in an address + * environment that may not be in place. So, in that case, we must call + * nxflat_addrenv_select to temporarily instantiate that address space + * it can be initialized. + */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_select(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret); + return ret; + } +#endif + + /* Now, read the data into allocated DSpace at doffset into the allocated + * DSpace memory. */ ret = nxflat_read(loadinfo, (char*)loadinfo->dspace->region, dreadsize, doffset); @@ -181,9 +199,23 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo) bvdbg("TEXT: %08x Entry point offset: %08x Data offset: %08x\n", loadinfo->ispace, loadinfo->entryoffs, doffset); + /* Restore the original address environment */ + +#ifdef CONFIG_ADDRENV + ret = nxflat_addrenv_restore(loadinfo); + if (ret < 0) + { + bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret); + return ret; + } +#endif + return OK; errout: +#ifdef CONFIG_ADDRENV + (void)nxflat_addrenv_restore(loadinfo); +#endif (void)nxflat_unload(loadinfo); return ret; } diff --git a/nuttx/binfmt/libnxflat/libnxflat_unload.c b/nuttx/binfmt/libnxflat/libnxflat_unload.c index 47c30bd55..71d0c8499 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_unload.c +++ b/nuttx/binfmt/libnxflat/libnxflat_unload.c @@ -40,11 +40,15 @@ #include #include + #include #include +#include #include +#include "libnxflat.h" + /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -65,8 +69,9 @@ * Name: nxflat_unload * * Description: - * This function unloads the object from memory. This essentially - * undoes the actions of nxflat_load. + * This function unloads the object from memory. This essentially undoes + * the actions of nxflat_load. It is called only under certain error + * conditions after the the module has been loaded but not yet started. * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on @@ -76,9 +81,8 @@ int nxflat_unload(struct nxflat_loadinfo_s *loadinfo) { - /* Reset the contents of the info structure. */ - /* Release the memory segments */ + /* Release the I-Space mmap'ed file */ if (loadinfo->ispace) { @@ -86,12 +90,9 @@ int nxflat_unload(struct nxflat_loadinfo_s *loadinfo) loadinfo->ispace = 0; } - if (loadinfo->dspace) - { - free((void*)loadinfo->dspace); - loadinfo->dspace = 0; - } + /* Release the D-Space address environment */ + nxflat_addrenv_free(loadinfo); return OK; } diff --git a/nuttx/binfmt/nxflat.c b/nuttx/binfmt/nxflat.c index 5973a96a9..db29941ca 100644 --- a/nuttx/binfmt/nxflat.c +++ b/nuttx/binfmt/nxflat.c @@ -187,10 +187,31 @@ static int nxflat_loadbinary(struct binary_s *binp) binp->entrypt = (main_t)(loadinfo.ispace + loadinfo.entryoffs); binp->mapped = (void*)loadinfo.ispace; - binp->alloc[0] = (void*)loadinfo.dspace; binp->mapsize = loadinfo.isize; binp->stacksize = loadinfo.stacksize; + /* Add the ELF allocation to the alloc[] only if there is no address + * enironment. If there is an address environment, it will automatically + * be freed when the function exits + * + * REVISIT: If the module is loaded then unloaded, wouldn't this cause + * a memory leak? + */ + +#ifdef CONFIG_ADDRENV +# warning "REVISIT" +#else + binp->alloc[0] = (void*)loadinfo.dspace; +#endif + +#ifdef CONFIG_ADDRENV + /* Save the address environment. This will be needed when the module is + * executed for the up_addrenv_assign() call. + */ + + binp->addrenv = loadinfo.addrenv; +#endif + nxflat_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt, MIN(loadinfo.isize - loadinfo.entryoffs, 512)); diff --git a/nuttx/configs/eagle100/httpd/setenv.sh b/nuttx/configs/eagle100/httpd/setenv.sh index 9022695a4..d22bf6f91 100755 --- a/nuttx/configs/eagle100/httpd/setenv.sh +++ b/nuttx/configs/eagle100/httpd/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/eagle100/nettest/setenv.sh b/nuttx/configs/eagle100/nettest/setenv.sh index f03beff85..37cc7735c 100755 --- a/nuttx/configs/eagle100/nettest/setenv.sh +++ b/nuttx/configs/eagle100/nettest/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/eagle100/nsh/setenv.sh b/nuttx/configs/eagle100/nsh/setenv.sh index c64bfed54..cd8710503 100755 --- a/nuttx/configs/eagle100/nsh/setenv.sh +++ b/nuttx/configs/eagle100/nsh/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/eagle100/nxflat/setenv.sh b/nuttx/configs/eagle100/nxflat/setenv.sh index 2335de190..771be4ec6 100755 --- a/nuttx/configs/eagle100/nxflat/setenv.sh +++ b/nuttx/configs/eagle100/nxflat/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index 2e2c6dda8..6df5190d2 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -41,8 +41,11 @@ ****************************************************************************/ #include + #include #include + +#include #include /**************************************************************************** @@ -93,12 +96,26 @@ struct binary_s main_t entrypt; /* Entry point into a program module */ FAR void *mapped; /* Memory-mapped, address space */ FAR void *alloc[BINFMT_NALLOC]; /* Allocated address spaces */ + + /* Constructors/destructors */ + #ifdef CONFIG_BINFMT_CONSTRUCTORS FAR binfmt_ctor_t *ctors; /* Pointer to a list of constructors */ FAR binfmt_dtor_t *dtors; /* Pointer to a list of destructors */ uint16_t nctors; /* Number of constructors in the list */ uint16_t ndtors; /* Number of destructors in the list */ #endif + + /* Address environment. + * + * addrenv - This is the handle created by up_addrenv_create() that can be + * used to manage the tasks address space. + */ + +#ifdef CONFIG_ADDRENV + task_addrenv_t addrenv; /* Task address environment */ +#endif + size_t mapsize; /* Size of the mapped address region (needed for munmap) */ size_t stacksize; /* Size of the stack in bytes (unallocated) */ }; diff --git a/nuttx/include/nuttx/binfmt/elf.h b/nuttx/include/nuttx/binfmt/elf.h index 432e57f0f..6b6851934 100644 --- a/nuttx/include/nuttx/binfmt/elf.h +++ b/nuttx/include/nuttx/binfmt/elf.h @@ -59,6 +59,18 @@ # define CONFIG_ELF_ALIGN_LOG2 2 #endif +#ifndef CONFIG_ELF_STACKSIZE +# define CONFIG_ELF_STACKSIZE 2048 +#endif + +#ifndef CONFIG_ELF_BUFFERSIZE +# define CONFIG_ELF_BUFFERSIZE 128 +#endif + +#ifndef CONFIG_ELF_BUFFERINCR +# define CONFIG_ELF_BUFFERINCR 32 +#endif + /* Allocation array size and indices */ #define LIBELF_ELF_ALLOC 0 @@ -80,8 +92,16 @@ struct elf_loadinfo_s { - /* The alloc[] array holds memory that persists after the ELF module has - * been loaded. + /* elfalloc is the base address of the memory that is allocated to hold the + * ELF program image. + * + * If CONFIG_ADDRENV=n, elfalloc will be allocated using kmalloc() (or + * kzalloc()). If CONFIG_ADDRENV-y, then elfalloc will be allocated using + * up_addrenv_create(). In either case, there will be a unique instance + * of elfalloc (and stack) for each instance of a process. + * + * The alloc[] array in struct binary_s will hold memory that persists after + * the ELF module has been loaded. */ uintptr_t elfalloc; /* Memory allocated when ELF file was loaded */ @@ -90,6 +110,9 @@ struct elf_loadinfo_s Elf32_Ehdr ehdr; /* Buffered ELF file header */ FAR Elf32_Shdr *shdr; /* Buffered ELF section headers */ uint8_t *iobuffer; /* File I/O buffer */ + + /* Constructors and destructors */ + #ifdef CONFIG_BINFMT_CONSTRUCTORS FAR void *ctoralloc; /* Memory allocated for ctors */ FAR void *dtoralloc; /* Memory allocated dtors */ @@ -98,6 +121,20 @@ struct elf_loadinfo_s uint16_t nctors; /* Number of constructors */ uint16_t ndtors; /* Number of destructors */ #endif + + /* Address environment. + * + * addrenv - This is the handle created by up_addrenv_create() that can be + * used to manage the tasks address space. + * oldenv - This is a value returned by up_addrenv_select() that must be + * used to restore the current hardware address environment. + */ + +#ifdef CONFIG_ADDRENV + task_addrenv_t addrenv; /* Task address environment */ + hw_addrenv_t oldenv; /* Saved hardware address environment */ +#endif + uint16_t symtabidx; /* Symbol table section index */ uint16_t strtabidx; /* String table section index */ uint16_t buflen; /* size of iobuffer[] */ @@ -187,8 +224,9 @@ EXTERN int elf_bind(FAR struct elf_loadinfo_s *loadinfo, * Name: elf_unload * * Description: - * This function unloads the object from memory. This essentially - * undoes the actions of elf_load. + * This function unloads the object from memory. This essentially undoes + * the actions of elf_load. It is called only under certain error + * conditions after the the module has been loaded but not yet started. * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on diff --git a/nuttx/include/nuttx/binfmt/nxflat.h b/nuttx/include/nuttx/binfmt/nxflat.h index 89e28fbcc..db396771b 100644 --- a/nuttx/include/nuttx/binfmt/nxflat.h +++ b/nuttx/include/nuttx/binfmt/nxflat.h @@ -44,7 +44,9 @@ #include #include + #include +#include /**************************************************************************** * Pre-processor Definitions @@ -61,17 +63,24 @@ struct nxflat_loadinfo_s { /* Instruction Space (ISpace): This region contains the nxflat file header - * plus everything from the text section. Ideally, will have only one mmap'ed - * text section instance in the system for each module. + * plus everything from the text section. + * + * The ISpace region is allocated using mmap() and, thus, can be shared by + * multiple tasks. Ideally, will have only one mmap'ed text section + * instance in the system for each module. */ - uint32_t ispace; /* Address where hdr/text is loaded */ + uintptr_t ispace; /* Address where hdr/text is loaded */ uint32_t entryoffs; /* Offset from ispace to entry point */ uint32_t isize; /* Size of ispace. */ - /* Data Space (DSpace): This region contains all information that in referenced - * as data (other than the stack which is separately allocated). There will be - * a unique instance of DSpace (and stack) for each instance of a process. + /* Data Space (DSpace): This region contains all information that is + * referenced as data (other than the stack which is separately allocated). + * + * If CONFIG_ADDRENV=n, DSpace will be allocated using kmalloc() (or + * kzalloc()). If CONFIG_ADDRENV-y, then DSpace will be allocated using + * up_addrenv_create(). In either case, there will be a unique instance + * of DSpace (and stack) for each instance of a process. */ struct dspace_s *dspace; /* Allocated D-Space (data/bss/etc) */ @@ -85,6 +94,19 @@ struct nxflat_loadinfo_s uint32_t relocstart; /* Start of array of struct flat_reloc */ uint16_t reloccount; /* Number of elements in reloc array */ + /* Address environment. + * + * addrenv - This is the handle created by up_addrenv_create() that can be + * used to manage the tasks address space. + * oldenv - This is a value returned by up_addrenv_select() that must be + * used to restore the current hardware address environment. + */ + +#ifdef CONFIG_ADDRENV + task_addrenv_t addrenv; /* Task address environment */ + hw_addrenv_t oldenv; /* Saved hardware address environment */ +#endif + /* File descriptors */ int filfd; /* Descriptor for the file being loaded */ @@ -212,8 +234,9 @@ EXTERN int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo, * Name: nxflat_unload * * Description: - * This function unloads the object from memory. This essentially - * undoes the actions of nxflat_load. + * This function unloads the object from memory. This essentially undoes + * the actions of nxflat_load. It is called only under certain error + * conditions after the the module has been loaded but not yet started. * * Returned Value: * 0 (OK) is returned on success and a negated errno is returned on diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 172f46901..6eaba6e9c 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -163,24 +163,40 @@ typedef struct environ_s environ_t; # define SIZEOF_ENVIRON_T(alloc) (sizeof(environ_t) + alloc - 1) #endif -/* This structure describes a reference counted D-Space region */ +/* This structure describes a reference counted D-Space region. This must be a + * separately allocated "break-away" structure that can be owned by a task and + * any pthreads created by the task. + */ +#ifdef CONFIG_PIC struct dspace_s { - uint32_t crefs; /* This is the number of pthreads that shared the - * the same D-Space */ - uint8_t region[1]; /* Beginning of the allocated region */ -}; + /* The life of the structure allocation is determined by this reference + * count. This count is number of threads that shared the the same D-Space. + * This includes the parent task as well as any pthreads created by the + * parent task or any of its child threads. + */ + + uint16_t crefs; -#define SIZEOF_DSPACE_S(n) (sizeof(struct dspace_s) - 1 + (n)) + /* This is the allocated D-Space memory region. This may be a physical + * address allocated with kmalloc(), or it may be virtual address associated + * with an address environment (if CONFIG_ADDRENV=y). + */ -/* This is the task control block (TCB) */ + FAR uint8_t *region; +}; +#endif + +/* This is the task control block (TCB). Each task or thread is represented by + * a TCB. The TCB is the heart of the NuttX task-control logic. + */ struct _TCB { /* Fields used to support list management *************************************/ - FAR struct _TCB *flink; /* link in DQ of TCBs */ + FAR struct _TCB *flink; /* Doubly linked list */ FAR struct _TCB *blink; /* Task Management Fields *****************************************************/ -- cgit v1.2.3 From 272fc3b5233e6d3c9e4d9c32a67511868f2c1a9a Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 19 Dec 2012 21:16:03 +0000 Subject: Some minor fixes for CONFIG_ADDRENV=y git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5444 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 5 +++- apps/examples/elf/elf_main.c | 41 +++++++++++++++++++++++++++--- apps/examples/nxflat/nxflat_main.c | 41 +++++++++++++++++++++++++++--- nuttx/binfmt/binfmt_unloadmodule.c | 2 +- nuttx/binfmt/libnxflat/libnxflat_addrenv.c | 1 + nuttx/binfmt/libnxflat/libnxflat_bind.c | 9 ++++++- nuttx/binfmt/libnxflat/libnxflat_unload.c | 1 - 7 files changed, 90 insertions(+), 10 deletions(-) (limited to 'apps/examples') diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index d6e5de3c1..e9eaf0a83 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -429,4 +429,7 @@ * Rename CONFIG_PCODE and CONFIG_FICL as CONFIG_INTERPRETERS_PCODE and CONFIG_INTERPRETERS_FICL for consistency with other configuration naming. * apps/examples/keypadtest: A keypad test example contributed by Denis - Carikli \ No newline at end of file + Carikli. + * apps/examples/elf and nxflat: If CONFIG_BINFMT_EXEPATH is defined, these + tests will now use a relative path to the program and expect the binfmt/ + logic to find the absolute path to the program using the PATH variable. diff --git a/apps/examples/elf/elf_main.c b/apps/examples/elf/elf_main.c index 669de430d..66a47592c 100644 --- a/apps/examples/elf/elf_main.c +++ b/apps/examples/elf/elf_main.c @@ -70,6 +70,10 @@ # error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" #endif +#ifdef CONFIG_BINFMT_DISABLE +# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" +#endif + #ifndef CONFIG_ELF # error "You must select CONFIG_ELF in your configuration file" #endif @@ -136,7 +140,9 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ static const char delimiter[] = "****************************************************************************"; -static char path[128]; +#ifndef CONFIG_BINFMT_EXEPATH +static char fullpath[128]; +#endif /**************************************************************************** * Symbols from Auto-Generated Code @@ -264,19 +270,46 @@ int elf_main(int argc, char *argv[]) mm_update(&g_mmstep, "after mount"); + /* Does the system support the PATH variable? Has the PATH variable + * already been set? If YES and NO, then set the PATH variable to + * the ROMFS mountpoint. + */ + +#if defined(CONFIG_BINFMT_EXEPATH) && !defined(CONFIG_PATH_INITIAL) + (void)setenv("PATH", MOUNTPT, 1); +#endif + /* Now excercise every program in the ROMFS file system */ for (i = 0; dirlist[i]; i++) { + /* Output a seperated so that we can clearly discrinmate the output of + * this program from the others. + */ + testheader(dirlist[i]); + /* Initialize the binary_s structure */ + memset(&bin, 0, sizeof(struct binary_s)); - snprintf(path, 128, "%s/%s", MOUNTPT, dirlist[i]); - bin.filename = path; + /* If the binary loader does not support the PATH variable, then + * create the full path to the executable program. Otherwise, + * use the relative path so that the binary loader will have to + * search the PATH variable to find the executable. + */ + +#ifdef CONFIG_BINFMT_EXEPATH + bin.filename = dirlist[i]; +#else + snprintf(fullpath, 128, "%s/%s", MOUNTPT, dirlist[i]); + bin.filename = fullpath; +#endif bin.exports = exports; bin.nexports = nexports; + /* Load the ELF module */ + ret = load_module(&bin); if (ret < 0) { @@ -286,6 +319,8 @@ int elf_main(int argc, char *argv[]) mm_update(&g_mmstep, "after load_module"); + /* Execute the ELF module */ + ret = exec_module(&bin, 50); mm_update(&g_mmstep, "after exec_module"); diff --git a/apps/examples/nxflat/nxflat_main.c b/apps/examples/nxflat/nxflat_main.c index 638e960a0..536bc1dd8 100644 --- a/apps/examples/nxflat/nxflat_main.c +++ b/apps/examples/nxflat/nxflat_main.c @@ -69,6 +69,10 @@ # error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" #endif +#ifdef CONFIG_BINFMT_DISABLE +# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" +#endif + #ifndef CONFIG_NXFLAT # error "You must select CONFIG_NXFLAT in your configuration file" #endif @@ -125,7 +129,9 @@ static const char delimiter[] = "****************************************************************************"; -static char path[128]; +#ifndef CONFIG_BINFMT_EXEPATH +static char fullpath[128]; +#endif /**************************************************************************** * Private Functions @@ -188,19 +194,46 @@ int nxflat_main(int argc, char *argv[]) nxflat_uninitialize(); } + /* Does the system support the PATH variable? Has the PATH variable + * already been set? If YES and NO, then set the PATH variable to + * the ROMFS mountpoint. + */ + +#if defined(CONFIG_BINFMT_EXEPATH) && !defined(CONFIG_PATH_INITIAL) + (void)setenv("PATH", MOUNTPT, 1); +#endif + /* Now excercise every progrm in the ROMFS file system */ for (i = 0; dirlist[i]; i++) { + /* Output a seperated so that we can clearly discrinmate the output of + * this program from the others. + */ + testheader(dirlist[i]); + /* Initialize the binary_s structure */ + memset(&bin, 0, sizeof(struct binary_s)); - snprintf(path, 128, "%s/%s", MOUNTPT, dirlist[i]); - bin.filename = path; + /* If the binary loader does not support the PATH variable, then + * create the full path to the executable program. Otherwise, + * use the relative path so that the binary loader will have to + * search the PATH variable to find the executable. + */ + +#ifdef CONFIG_BINFMT_EXEPATH + bin.filename = dirlist[i]; +#else + snprintf(fullpath, 128, "%s/%s", MOUNTPT, dirlist[i]); + bin.filename = fullpath; +#endif bin.exports = exports; bin.nexports = NEXPORTS; + /* Load the NXFLAT module */ + ret = load_module(&bin); if (ret < 0) { @@ -208,6 +241,8 @@ int nxflat_main(int argc, char *argv[]) exit(1); } + /* Execute the ELF module */ + ret = exec_module(&bin, 50); if (ret < 0) { diff --git a/nuttx/binfmt/binfmt_unloadmodule.c b/nuttx/binfmt/binfmt_unloadmodule.c index a0050481c..a03b98d6c 100644 --- a/nuttx/binfmt/binfmt_unloadmodule.c +++ b/nuttx/binfmt/binfmt_unloadmodule.c @@ -183,7 +183,7 @@ int unload_module(FAR const struct binary_s *binp) if (binp->alloc[i]) { bvdbg("Freeing alloc[%d]: %p\n", i, binp->alloc[i]); - free(binp->alloc[i]); + free((FAR void *)binp->alloc[i]); } } diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c index c6b3fce34..233713ccd 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c +++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c @@ -39,6 +39,7 @@ #include +#include #include #include diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c index 3a86d5355..816810a46 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_bind.c +++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c @@ -38,6 +38,7 @@ ****************************************************************************/ #include +#include #include #include @@ -248,7 +249,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) DEBUGASSERT(offset + nrelocs * sizeof(struct nxflat_reloc_s) <= (loadinfo->isize + loadinfo->dsize)); - relocs = (FAR struct nxflat_reloc_s*) + relocs = (FAR struct nxflat_reloc_s *) (offset - loadinfo->isize + loadinfo->dspace->region); bvdbg("isize: %08lx dpsace: %p relocs: %p\n", (long)loadinfo->isize, loadinfo->dspace->region, relocs); @@ -276,7 +277,13 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) { /* Handle the relocation by the relocation type */ +#ifdef CONFIG_CAN_PASS_STRUCTS reloc = *relocs++; +#else + memcpy(&reloc, relocs, sizeof(struct nxflat_reloc_s)); + relocs++; +#endif + result = OK; switch (NXFLAT_RELOC_TYPE(reloc.r_info)) { diff --git a/nuttx/binfmt/libnxflat/libnxflat_unload.c b/nuttx/binfmt/libnxflat/libnxflat_unload.c index 71d0c8499..eb1aa0343 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_unload.c +++ b/nuttx/binfmt/libnxflat/libnxflat_unload.c @@ -95,4 +95,3 @@ int nxflat_unload(struct nxflat_loadinfo_s *loadinfo) nxflat_addrenv_free(loadinfo); return OK; } - -- cgit v1.2.3 From 0267782782f083c53bcf49b28e4ba2ed8c28105a Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 11 Jan 2013 02:32:05 -0800 Subject: Recover changes lost to bad merging. --- apps/Makefile | 71 ++++++++++++----- apps/examples/adc/Makefile | 21 ++--- apps/examples/adc/adc_main.c | 7 +- apps/examples/buttons/Makefile | 21 ++--- apps/examples/can/Makefile | 21 ++--- apps/examples/cdcacm/Makefile | 19 +++-- apps/examples/hello/Makefile | 19 +++-- apps/examples/helloxx/Makefile | 23 +++--- apps/examples/mm/Makefile | 21 ++--- apps/examples/mount/Makefile | 21 ++--- apps/examples/nsh/Makefile | 21 ++--- apps/examples/null/Makefile | 21 ++--- apps/examples/ostest/Kconfig | 27 +++++++ apps/examples/ostest/Makefile | 19 +++-- apps/examples/ostest/roundrobin.c | 156 ++++++++++++++++---------------------- apps/examples/pipe/Makefile | 21 ++--- apps/examples/poll/Makefile | 22 +++--- apps/examples/pwm/Makefile | 21 ++--- apps/examples/pwm/pwm_main.c | 1 + apps/examples/qencoder/Makefile | 19 +++-- apps/examples/romfs/Makefile | 24 +++--- apps/examples/serloop/Makefile | 21 ++--- apps/examples/watchdog/Makefile | 19 +++-- apps/interpreters/Makefile | 32 ++++---- apps/interpreters/ficl/Makefile | 29 +++---- apps/namedapp/Makefile | 32 ++++---- apps/nshlib/Kconfig | 100 +++++++++++++++++++++++- apps/nshlib/Makefile | 61 ++++++++------- apps/nshlib/nsh_dbgcmds.c | 61 ++++++++++++++- apps/nshlib/nsh_netinit.c | 12 ++- apps/system/Makefile | 33 ++++---- apps/system/free/Makefile | 28 ++++--- apps/system/i2c/Makefile | 27 ++++--- apps/system/install/Makefile | 27 ++++--- apps/system/readline/Makefile | 24 +++--- 35 files changed, 701 insertions(+), 401 deletions(-) (limited to 'apps/examples') diff --git a/apps/Makefile b/apps/Makefile index 11d95bc19..f0de58e25 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -107,7 +107,7 @@ endif # Create the list of available applications (INSTALLED_APPS) define ADD_BUILTIN -INSTALLED_APPS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} + INSTALLED_APPS += $(if $(wildcard $1$(DELIM)Makefile),$1,) endef $(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN)))) @@ -120,8 +120,10 @@ INSTALLED_APPS += $(EXTERNAL_APPS) # provided by the user (possibly as a symbolic link) to add libraries and # applications to the standard build from the repository. -INSTALLED_APPS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} -SUBDIRS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} +EXTERNAL_DIR := $(dir $(wildcard external$(DELIM)Makefile)) + +INSTALLED_APPS += $(EXTERNAL_DIR) +SUBDIRS += $(EXTERNAL_DIR) # The final build target @@ -133,48 +135,81 @@ all: $(BIN) .PHONY: $(INSTALLED_APPS) context depend clean distclean $(INSTALLED_APPS): - @$(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; + $(Q) $(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(BIN): $(INSTALLED_APPS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $@, $${obj}); \ - done ; ) .context: - @for dir in $(INSTALLED_APPS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(INSTALLED_APPS)) do ( \ + if exist %%G\.context del /f /q %%G\.context \ + $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context \ + ) +else + $(Q) for dir in $(INSTALLED_APPS) ; do \ rm -f $$dir/.context ; \ - $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ done - @touch $@ +endif + $(Q) touch $@ context: .context .depend: context Makefile $(SRCS) - @for dir in $(INSTALLED_APPS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(INSTALLED_APPS)) do ( \ + if exist %%G\.depend del /f /q %%G\.depend \ + $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend \ + ) +else + $(Q) for dir in $(INSTALLED_APPS) ; do \ rm -f $$dir/.depend ; \ - $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \ done - @touch $@ +endif + $(Q) touch $@ depend: .depend clean: - @for dir in $(SUBDIRS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(SUBDIRS)) do ( \ + $(MAKE) -C %%G clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ + ) +else + $(Q) for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ done - @rm -f $(BIN) *~ .*.swp *.o +endif + $(call DELFILE, $(BIN)) $(call CLEAN) distclean: # clean - @for dir in $(SUBDIRS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(SUBDIRS)) do ( \ + $(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ + ) + $(call DELFILE, .config) + $(call DELFILE, .context) + $(call DELFILE, .depend) + $(Q) ( if exist external ( \ + echo ********************************************************" \ + echo * The external directory/link must be removed manually *" \ + echo ********************************************************" \ + ) +else + $(Q) for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ done - @rm -f .config .context .depend - @( if [ -e external ]; then \ + $(call DELFILE, .config) + $(call DELFILE, .context) + $(call DELFILE, .depend) + $(Q) ( if [ -e external ]; then \ echo "********************************************************"; \ echo "* The external directory/link must be removed manually *"; \ echo "********************************************************"; \ fi; \ ) +endif diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile index 6357dfc3d..69862b383 100644 --- a/apps/examples/adc/Makefile +++ b/apps/examples/adc/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/adc/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -90,16 +92,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c index 404fba8c1..553658fee 100644 --- a/apps/examples/adc/adc_main.c +++ b/apps/examples/adc/adc_main.c @@ -289,7 +289,7 @@ int adc_main(int argc, char *argv[]) { message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno); errval = 2; - goto errout_with_dev; + goto errout; } /* Now loop the appropriate number of times, displaying the collected @@ -357,6 +357,11 @@ int adc_main(int argc, char *argv[]) } } + close(fd); + return OK; + + /* Error exits */ + errout_with_dev: close(fd); diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile index 25d1ef2c2..77c1cd67d 100644 --- a/apps/examples/buttons/Makefile +++ b/apps/examples/buttons/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/buttons/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -90,16 +92,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile index c6dc5af84..8924797e3 100644 --- a/apps/examples/can/Makefile +++ b/apps/examples/can/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/can/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -90,16 +92,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile index 3fa886d56..e8d03807d 100644 --- a/apps/examples/cdcacm/Makefile +++ b/apps/examples/cdcacm/Makefile @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -80,9 +84,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -93,17 +95,18 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 1d78d723e..560b0da35 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -90,16 +92,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index 8e85eab23..062da7d58 100644 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/helloxx/Makefile # -# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -50,10 +50,14 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -69,7 +73,7 @@ STACKSIZE = 2048 VPATH = all: .built -.PHONY: clean depend disclean chkcxx +.PHONY: clean depend distclean chkcxx chkcxx: ifneq ($(CONFIG_HAVE_CXX),y) @@ -93,9 +97,7 @@ $(CXXOBJS): %$(OBJEXT): %.cxx $(call COMPILEXX, $<, $@) .built: chkcxx $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -107,16 +109,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile index 24ed4926f..5ba7f4eec 100644 --- a/apps/examples/mm/Makefile +++ b/apps/examples/mm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/mm/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile index 69cf970cf..133bdfa1f 100644 --- a/apps/examples/mount/Makefile +++ b/apps/examples/mount/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/Makefile # -# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index bad40fb2e..c7d212fc2 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/nsh/Makefile # -# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile index 634120600..47ec4cdaf 100644 --- a/apps/examples/null/Makefile +++ b/apps/examples/null/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/null/Makefile # -# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/ostest/Kconfig b/apps/examples/ostest/Kconfig index 0da7e4ce3..c3fe8f21d 100644 --- a/apps/examples/ostest/Kconfig +++ b/apps/examples/ostest/Kconfig @@ -39,4 +39,31 @@ config EXAMPLES_OSTEST_NBARRIER_THREADS is 8 but a smaller number may be needed on systems without sufficient memory to start so many threads. +config EXAMPLES_OSTEST_RR_RANGE + int "Round-robin test - end of search range" + default 10000 + range 1 32767 + ---help--- + During round-robin scheduling test two threads are created. Each of the threads + searches for prime numbers in the configurable range, doing that configurable + number of times. + + This value specifies the end of search range and together with number of runs + allows to configure the length of this test - it should last at least a few + tens of seconds. Allowed values [1; 32767], default 10000 + +config EXAMPLES_OSTEST_RR_RUNS + int "Round-robin test - number of runs" + default 10 + range 1 32767 + ---help--- + During round-robin scheduling test two threads are created. Each of the threads + searches for prime numbers in the configurable range, doing that configurable + number of times. + + This value specifies the number of times the thread searches the range for + prime numbers and together with end of search range allows to configure the + length of this test - it should last at least a few tens of seconds. Allowed + values [1; 32767], default 10 + endif diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 374964b39..3e78c64e8 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -98,10 +98,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -120,9 +124,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -134,16 +136,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/ostest/roundrobin.c b/apps/examples/ostest/roundrobin.c index 5167a857e..bfd344df3 100644 --- a/apps/examples/ostest/roundrobin.c +++ b/apps/examples/ostest/roundrobin.c @@ -1,7 +1,7 @@ /******************************************************************************** * examples/ostest/roundrobin.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include #include +#include #include "ostest.h" #if CONFIG_RR_INTERVAL > 0 @@ -47,115 +48,87 @@ * Definitions ********************************************************************************/ -/* This number may need to be tuned for different processor speeds. Since these - * arrays must be large to very correct SCHED_RR behavior, this test may require - * too much memory on many targets. - */ +/* This numbers should be tuned for different processor speeds via .config file. + * With default values the test takes about 30s on Cortex-M3 @ 24MHz. With 32767 + * range and 10 runs it takes ~320s. */ -/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */ - -#define CONFIG_NINTEGERS 2048 - -/******************************************************************************** - * Private Data - ********************************************************************************/ +#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE +# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 +# warning "CONFIG_EXAMPLES_OSTEST_RR_RANGE undefined, using default value = 10000" +#elif (CONFIG_EXAMPLES_OSTEST_RR_RANGE < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RANGE > 32767) +# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 +# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RANGE, using default value = 10000" +#endif -static int prime1[CONFIG_NINTEGERS]; -static int prime2[CONFIG_NINTEGERS]; +#ifndef CONFIG_EXAMPLES_OSTEST_RR_RUNS +# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 +# warning "CONFIG_EXAMPLES_OSTEST_RR_RUNS undefined, using default value = 10" +#elif (CONFIG_EXAMPLES_OSTEST_RR_RUNS < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RUNS > 32767) +# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 +# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RUNS, using default value = 10" +#endif /******************************************************************************** * Private Functions ********************************************************************************/ /******************************************************************************** - * Name: dosieve + * Name: get_primes * * Description - * This implements a "sieve of aristophanes" algorithm for finding prime number. - * Credit for this belongs to someone, but I am not sure who anymore. Anyway, - * the only purpose here is that we need some algorithm that takes a long period - * of time to execute. - * + * This function searches for prime numbers in the most primitive way possible. ********************************************************************************/ -static void dosieve(int *prime) +static void get_primes(int *count, int *last) { - int a,d; - int i; - int j; - - a = 2; - d = a; - - for (i = 0; i < CONFIG_NINTEGERS; i++) - { - prime[i] = i+2; - } - - for (i = 1; i < 10; i++) + int number; + int local_count = 0; + *last = 0; // to make compiler happy + + for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++) + { + int div; + bool is_prime = true; + + for (div = 2; div <= number / 2; div++) + if (number % div == 0) + { + is_prime = false; + break; + } + + if (is_prime) { - for (j = 0; j < CONFIG_NINTEGERS; j++) - { - d = a + d; - if (d < CONFIG_NINTEGERS) - { - prime[d]=0; - } - } - a++; - d = a; - i++; - } - + local_count++; + *last = number; #if 0 /* We don't really care what the numbers are */ - for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++) - { - if (prime[i] != 0) - { - printf(" Prime %d: %d\n", j, prime[i]); - j++; - } - } + printf(" Prime %d: %d\n", local_count, number); #endif -} - -/******************************************************************************** - * Name: sieve1 - ********************************************************************************/ - -static void *sieve1(void *parameter) -{ - int i; - - printf("sieve1 started\n"); - - for (i = 0; i < 1000; i++) - { - dosieve(prime1); } + } - printf("sieve1 finished\n"); - - pthread_exit(NULL); - return NULL; /* To keep some compilers happy */ + *count = local_count; } /******************************************************************************** - * Name: sieve2 + * Name: get_primes_thread ********************************************************************************/ -static void *sieve2(void *parameter) +static void *get_primes_thread(void *parameter) { - int i; + int id = (int)parameter; + int i, count, last; - printf("sieve2 started\n"); + printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n", + id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS); - for (i = 0; i < 1000; i++) + for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++) { - dosieve(prime2); + get_primes(&count, &last); } - printf("sieve2 finished\n"); + printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n", + id, count, last); pthread_exit(NULL); return NULL; /* To keep some compilers happy */ @@ -171,14 +144,13 @@ static void *sieve2(void *parameter) void rr_test(void) { - pthread_t sieve1_thread; - pthread_t sieve2_thread; + pthread_t get_primes1_thread; + pthread_t get_primes2_thread; struct sched_param sparam; pthread_attr_t attr; pthread_addr_t result; int status; - printf("rr_test: Starting sieve1 thread \n"); status = pthread_attr_init(&attr); if (status != OK) { @@ -203,29 +175,31 @@ void rr_test(void) } else { - printf("rr_test: Set thread policty to SCHED_RR\n"); + printf("rr_test: Set thread policy to SCHED_RR\n"); } - status = pthread_create(&sieve1_thread, &attr, sieve1, NULL); + printf("rr_test: Starting first get_primes_thread\n"); + + status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1); if (status != 0) { printf("rr_test: Error in thread 1 creation, status=%d\n", status); } - printf("rr_test: Starting sieve1 thread \n"); + printf("rr_test: Starting second get_primes_thread\n"); - status = pthread_create(&sieve2_thread, &attr, sieve2, NULL); + status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2); if (status != 0) { printf("rr_test: Error in thread 2 creation, status=%d\n", status); } - printf("rr_test: Waiting for sieves to complete -- this should take awhile\n"); + printf("rr_test: Waiting for threads to complete -- this should take awhile\n"); printf("rr_test: If RR scheduling is working, they should start and complete at\n"); printf("rr_test: about the same time\n"); - pthread_join(sieve2_thread, &result); - pthread_join(sieve1_thread, &result); + pthread_join(get_primes2_thread, &result); + pthread_join(get_primes1_thread, &result); printf("rr_test: Done\n"); } diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile index 956c911b3..bed319085 100644 --- a/apps/examples/pipe/Makefile +++ b/apps/examples/pipe/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pipe/Makefile # -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,24 +74,23 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index aef61d199..13173f125 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/poll/Makefile # -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,25 +74,25 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend host + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + $(call DELFILE, host$(HOSTEXEEXT)) -include Make.dep diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile index efbdb048e..3a6f2520a 100644 --- a/apps/examples/pwm/Makefile +++ b/apps/examples/pwm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pwm/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -88,16 +90,17 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c index 775bdba6b..a46c10f55 100644 --- a/apps/examples/pwm/pwm_main.c +++ b/apps/examples/pwm/pwm_main.c @@ -48,6 +48,7 @@ #include #include #include +#include #include diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile index 3f3fc9def..7d2427c6b 100644 --- a/apps/examples/qencoder/Makefile +++ b/apps/examples/qencoder/Makefile @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -90,16 +92,17 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile index ba930b77d..2b02952ed 100644 --- a/apps/examples/romfs/Makefile +++ b/apps/examples/romfs/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/romfs/Makefile # -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -61,7 +65,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: checkgenromfs clean depend disclean +.PHONY: checkgenromfs clean depend distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -86,26 +90,26 @@ romfs_testdir.h : testdir.img @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } .built: romfs_testdir.h $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend testdir.img + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + $(call DELFILE, testdir.img) -include Make.dep diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile index e1c415cdd..4a262884b 100644 --- a/apps/examples/serloop/Makefile +++ b/apps/examples/serloop/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/serloop/Makefile # -# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -70,26 +74,25 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile index d2739dbb0..9890959fb 100644 --- a/apps/examples/watchdog/Makefile +++ b/apps/examples/watchdog/Makefile @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -76,9 +80,7 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built .context: @@ -88,16 +90,17 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/interpreters/Makefile b/apps/interpreters/Makefile index 5901fc830..867d45f99 100644 --- a/apps/interpreters/Makefile +++ b/apps/interpreters/Makefile @@ -33,7 +33,7 @@ # ############################################################################ --include $(TOPDIR)/.config # Current configuration +-include $(TOPDIR)/.config # Sub-directories containing interpreter runtime @@ -41,30 +41,36 @@ SUBDIRS = pcode ficl # Create the list of installed runtime modules (INSTALLED_DIRS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) +define ADD_DIRECTORY +INSTALLED_DIRS += ${shell if exist $1\Makefile (echo $1)} +endef +else define ADD_DIRECTORY INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} endef +endif $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) all: nothing .PHONY: nothing context depend clean distclean +define SDIR_template +$(1)_$(2): + $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" +endef + +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend))) +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean))) +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) + nothing: context: -depend: - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done +depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) -clean: - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done +clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) -distclean: clean - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done +distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) diff --git a/apps/interpreters/ficl/Makefile b/apps/interpreters/ficl/Makefile index fb953964e..990630fb8 100644 --- a/apps/interpreters/ficl/Makefile +++ b/apps/interpreters/ficl/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/interpreters/ficl/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,14 +35,11 @@ BUILDDIR := ${shell pwd | sed -e 's/ /\\ /g'} --include $(TOPDIR)/.config -include $(TOPDIR)/Make.defs include $(APPDIR)/Make.defs # Tools -INCDIR = $(TOPDIR)/tools/incdir.sh - ifeq ($(WINTOOL),y) INCDIROPT = -w endif @@ -69,10 +66,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOT_DEPPATH = --dep-path . @@ -95,24 +96,24 @@ debug: @#echo "CFLAGS: $(CFLAGS)" .built: debug $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built context: .depend: debug Makefile $(SRCS) - @$(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOT_DEPPATH) $(SRC_DEPPATH) $(FICL_DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .context) + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/namedapp/Makefile b/apps/namedapp/Makefile index 6b0fd6a05..a88c73567 100644 --- a/apps/namedapp/Makefile +++ b/apps/namedapp/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/nshlib/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -54,10 +54,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -75,32 +79,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built .context: @echo "/* List of application requirements, generated during make context. */" > namedapp_list.h @echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h - @touch $@ + $(Q) touch $@ context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f .context Make.dep .depend - @rm -f namedapp_list.h - @rm -f namedapp_proto.h + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + $(call DELFILE, namedapp_list.h) + $(call DELFILE, namedapp_proto.h) -include Make.dep diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index d12a32973..17b107b8f 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -23,122 +23,194 @@ config NSH_BUILTIN_APPS (NAMEDAPP). menu "Disable Individual commands" + +config NSH_DISABLE_BASE64DEC + bool "Disable base64dec" + default n + depends on NETUTILS_CODECS && CODECS_BASE64 + +config NSH_DISABLE_BASE64ENC + bool "Disable base64enc" + default n + depends on NETUTILS_CODECS && CODECS_BASE64 + config NSH_DISABLE_CAT bool "Disable cat" default n + config NSH_DISABLE_CD bool "Disable cd" default n + config NSH_DISABLE_CP bool "Disable cp" default n + config NSH_DISABLE_DD bool "Disable dd" default n + config NSH_DISABLE_ECHO bool "Disable echo" default n + config NSH_DISABLE_EXEC bool "Disable exec" default n + config NSH_DISABLE_EXIT bool "Disable exit" default n + config NSH_DISABLE_FREE bool "Disable free" default n + config NSH_DISABLE_GET bool "Disable get" default n + config NSH_DISABLE_HELP bool "Disable help" default n + +config NSH_DISABLE_HEXDUMP + bool "Disable hexdump" + default n + config NSH_DISABLE_IFCONFIG bool "Disable ifconfig" default n + config NSH_DISABLE_KILL bool "Disable kill" default n + config NSH_DISABLE_LOSETUP bool "Disable losetup" default n + config NSH_DISABLE_LS bool "Disable ls" default n + config NSH_DISABLE_MB bool "Disable mb" default n + +config NSH_DISABLE_MD5 + bool "Disable md5" + default n + depends on NETUTILS_CODECS && CODECS_HASH_MD5 + config NSH_DISABLE_MKDIR bool "Disable mkdir" default n + config NSH_DISABLE_MKFATFS bool "Disable mkfatfs" default n + config NSH_DISABLE_MKFIFO bool "Disable mkfifo" default n + config NSH_DISABLE_MKRD bool "Disable mkrd" default n + config NSH_DISABLE_MH bool "Disable mh" default n + config NSH_DISABLE_MOUNT bool "Disable mount" default n + config NSH_DISABLE_MW bool "Disable mw" default n + config NSH_DISABLE_NSFMOUNT bool "Disable nfsmount" default n + config NSH_DISABLE_PS bool "Disable ps" default n + config NSH_DISABLE_PING bool "Disable ping" default n + config NSH_DISABLE_PUT bool "Disable put" default n + config NSH_DISABLE_PWD bool "Disable pwd" default n + config NSH_DISABLE_RM bool "Disable rm" default n + config NSH_DISABLE_RMDIR bool "Disable rmdir" default n + config NSH_DISABLE_SET bool "Disable set" default n + config NSH_DISABLE_SH bool "Disable sh" default n + config NSH_DISABLE_SLEEP bool "Disable sleep" default n + config NSH_DISABLE_TEST bool "Disable test" default n + config NSH_DISABLE_UMOUNT bool "Disable umount" default n + config NSH_DISABLE_UNSET bool "Disable unset" default n + +config NSH_DISABLE_URLDECODE + bool "Disable urldecode" + default n + depends on NETUTILS_CODECS && CODECS_URLCODE + +config NSH_DISABLE_URLENCODE + bool "Disable urlencode" + default n + depends on NETUTILS_CODECS && CODECS_URLCODE + config NSH_DISABLE_USLEEP bool "Disable usleep" default n + config NSH_DISABLE_WGET bool "Disable wget" default n + config NSH_DISABLE_XD bool "Disable xd" default n + endmenu +config NSH_CODECS_BUFSIZE + int "File buffer size used by CODEC commands" + default 128 + config NSH_FILEIOSIZE int "NSH I/O buffer size" default 1024 @@ -490,7 +562,7 @@ config NSH_DHCPC config NSH_IPADDR hex "Target IP address" - default 0x10000002 + default 0xa0000002 depends on NSH_LIBRARY && NET && !NSH_DHCPC ---help--- If NSH_DHCPC is NOT set, then the static IP address must be provided. @@ -499,7 +571,7 @@ config NSH_IPADDR config NSH_DRIPADDR hex "Router IP address" - default 0x10000001 + default 0xa0000001 depends on NSH_LIBRARY && NET && !NSH_DHCPC ---help--- Default router IP address (aka, Gateway). This is a 32-bit integer @@ -513,6 +585,21 @@ config NSH_NETMASK Network mask. This is a 32-bit integer value in host order. So, as an example, 0xffffff00 would be 255.255.255.0. +config NSH_DNS + bool "Use DNS" + default n + depends on NSH_LIBRARY && NET && NET_UDP && NET_BROADCAST + ---help--- + Configure to use a DNS. + +config NSH_DNSIPADDR + hex "DNS IP address" + default 0xa0000001 + depends on NSH_DNS + ---help--- + Configure the DNS address. This is a 32-bit integer value in host + order. So, as an example, 0xa0000001 would be 10.0.0.1. + config NSH_NOMAC bool "Hardware has no MAC address" default n @@ -520,3 +607,12 @@ config NSH_NOMAC ---help--- Set if your ethernet hardware has no built-in MAC address. If set, a bogus MAC will be assigned. + +config NSH_MAX_ROUNDTRIP + int "Max Ping Round-Trip (DSEC)" + default 20 + depends on NSH_LIBRARY && NET && !NSH_DISABLE_PING + ---help--- + This is the maximum round trip for a response to a ICMP ECHO request. + It is in units of deciseconds. The default is 20 (2 seconds). + diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index f616374bf..73325e899 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -39,64 +39,72 @@ include $(APPDIR)/Make.defs # NSH Library -ASRCS = -CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \ +ASRCS = +CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \ nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CSRCS += nsh_apps.c +CSRCS += nsh_apps.c endif ifeq ($(CONFIG_NSH_ROMFSETC),y) -CSRCS += nsh_romfsetc.c +CSRCS += nsh_romfsetc.c endif ifeq ($(CONFIG_NET),y) -CSRCS += nsh_netinit.c nsh_netcmds.c +CSRCS += nsh_netinit.c nsh_netcmds.c endif ifeq ($(CONFIG_RTC),y) -CSRCS += nsh_timcmds.c +CSRCS += nsh_timcmds.c endif ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) -CSRCS += nsh_mntcmds.c +CSRCS += nsh_mntcmds.c endif ifeq ($(CONFIG_NSH_CONSOLE),y) -CSRCS += nsh_consolemain.c +CSRCS += nsh_consolemain.c endif ifeq ($(CONFIG_NSH_TELNET),y) -CSRCS += nsh_telnetd.c +CSRCS += nsh_telnetd.c endif ifneq ($(CONFIG_NSH_DISABLESCRIPT),y) -CSRCS += nsh_test.c +CSRCS += nsh_test.c endif ifeq ($(CONFIG_USBDEV),y) -CSRCS += nsh_usbdev.c +CSRCS += nsh_usbdev.c endif -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) +ifeq ($(CONFIG_NETUTILS_CODECS),y) +CSRCS += nsh_codeccmd.c +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../libapps$(LIBEXT) +endif endif -ROOTDEPPATH = --dep-path . -VPATH = +ROOTDEPPATH = --dep-path . +VPATH = # Build targets -all: .built +all: .built .PHONY: context .depend depend clean distclean $(AOBJS): %$(OBJEXT): %.S @@ -106,26 +114,25 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) + $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) \ - $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/nshlib/nsh_dbgcmds.c b/apps/nshlib/nsh_dbgcmds.c index eb081fe9f..85a4ccb9c 100644 --- a/apps/nshlib/nsh_dbgcmds.c +++ b/apps/nshlib/nsh_dbgcmds.c @@ -46,6 +46,10 @@ #include #include +#if CONFIG_NFILE_DESCRIPTORS > 0 +# include +#endif + #include "nsh.h" #include "nsh_console.h" @@ -328,7 +332,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg, } /**************************************************************************** - * Name: cmd_xd + * Name: cmd_xd, hex dump of memory ****************************************************************************/ #ifndef CONFIG_NSH_DISABLE_XD @@ -354,3 +358,58 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return OK; } #endif + +/**************************************************************************** + * Name: cmd_hexdump, hex dump of files + ****************************************************************************/ + +#if CONFIG_NFILE_DESCRIPTORS > 0 +#ifndef CONFIG_NSH_DISABLE_HEXDUMP +int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + uint8_t buffer[IOBUFFERSIZE]; + char msg[32]; + int position; + int fd; + int ret = OK; + + /* Open the file for reading */ + + fd = open(argv[1], O_RDONLY); + if (fd < 0) + { + nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "open", NSH_ERRNO); + return ERROR; + } + + position = 0; + for (;;) + { + int nbytesread = read(fd, buffer, IOBUFFERSIZE); + + /* Check for read errors */ + + if (nbytesread < 0) + { + int errval = errno; + nsh_output(vtbl, g_fmtcmdfailed, "hexdump", "read", NSH_ERRNO_OF(errval)); + ret = ERROR; + break; + } + else if (nbytesread > 0) + { + snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position); + nsh_dumpbuffer(vtbl, msg, buffer, nbytesread); + position += nbytesread; + } + else + { + break; // EOF + } + } + + (void)close(fd); + return ret; +} +#endif +#endif diff --git a/apps/nshlib/nsh_netinit.c b/apps/nshlib/nsh_netinit.c index c95bf4c40..58d238312 100644 --- a/apps/nshlib/nsh_netinit.c +++ b/apps/nshlib/nsh_netinit.c @@ -47,7 +47,7 @@ #include #include -#if defined(CONFIG_NSH_DHCPC) +#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) # include # include #endif @@ -60,6 +60,10 @@ * Definitions ****************************************************************************/ +#if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR) +# define CONFIG_NSH_DNSIPADDR CONFIG_NSH_DRIPADDR +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -125,10 +129,14 @@ int nsh_netinit(void) addr.s_addr = HTONL(CONFIG_NSH_NETMASK); uip_setnetmask("eth0", &addr); -#if defined(CONFIG_NSH_DHCPC) +#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) /* Set up the resolver */ resolv_init(); +#if defined(CONFIG_NSH_DNS) + addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR); + resolv_conf(&addr); +#endif #endif #if defined(CONFIG_NSH_DHCPC) diff --git a/apps/system/Makefile b/apps/system/Makefile index d64bb54c6..9955a6b2c 100644 --- a/apps/system/Makefile +++ b/apps/system/Makefile @@ -41,31 +41,36 @@ SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo # Create the list of installed runtime modules (INSTALLED_DIRS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) define ADD_DIRECTORY -INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} + INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,) endef +else +define ADD_DIRECTORY + INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,) +endef +endif $(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) all: nothing .PHONY: nothing context depend clean distclean +define SDIR_template +$(1)_$(2): + $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" +endef + +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend))) +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean))) +$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) + nothing: context: -depend: - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done - -clean: - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done +depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) -distclean: clean - @for dir in $(INSTALLED_DIRS) ; do \ - $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ - done +clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) +distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile index 7f911d81c..dada00d99 100644 --- a/apps/system/free/Makefile +++ b/apps/system/free/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/system/free/Makefile # -# Copyright (C) 2011 Uros Platise. All rights reserved. +# Copyright (C) 2011-2012 Uros Platise. All rights reserved. # Author: Uros Platise # Gregory Nutt # @@ -61,10 +61,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -83,32 +87,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built # Register application .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ + $(Q) touch $@ context: .context # Create dependencies .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f .context Make.dep .depend + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index 00db91bb7..029d2b6fe 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -73,30 +77,29 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ + $(Q) touch $@ context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) \ - $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f Make.dep .depend + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile index 71d82f34c..6a02d859f 100644 --- a/apps/system/install/Makefile +++ b/apps/system/install/Makefile @@ -2,6 +2,7 @@ # apps/system/install/Makefile # # Copyright (C) 2011 Uros Platise. All rights reserved. +# Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Uros Platise # Gregory Nutt # @@ -61,10 +62,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -83,32 +88,32 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built # Register application .context: $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ + $(Q) touch $@ context: .context # Create dependencies .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f .context Make.dep .depend + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep diff --git a/apps/system/readline/Makefile b/apps/system/readline/Makefile index 34fab7e81..3a48d324e 100644 --- a/apps/system/readline/Makefile +++ b/apps/system/readline/Makefile @@ -52,10 +52,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else ifeq ($(WINTOOL),y) - BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" + BIN = ..\\..\\libapps$(LIBEXT) else - BIN = "$(APPDIR)/libapps$(LIBEXT)" + BIN = ../../libapps$(LIBEXT) +endif endif ROOTDEPPATH = --dep-path . @@ -74,10 +78,8 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $(BIN), $${obj}); \ - done ; ) - @touch .built + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built # Context build phase target @@ -86,18 +88,20 @@ context: # Dependency build phase target .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ + $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ depend: .depend # Housekeeping targets clean: - @rm -f *.o *~ .*.swp .built + $(call DELFILE, .built) $(call CLEAN) distclean: clean - @rm -f .context Make.dep .depend + $(call DELFILE, .context) + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) -include Make.dep -- cgit v1.2.3