From db7257ad4894df88a59100a8849b156029fbcf21 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 9 May 2014 11:09:43 -0600 Subject: [PATCH] Move P-Code execution logic from interpreters/prun to system/prun --- apps/include/{interpreters => }/prun.h | 8 ++++---- apps/interpreters/Kconfig | 2 -- apps/interpreters/Make.defs | 4 ---- apps/system/Kconfig | 4 ++++ apps/system/Make.defs | 4 ++++ apps/{interpreters => system}/prun/.gitignore | 0 apps/{interpreters => system}/prun/Kconfig | 12 ++++++++++-- apps/{interpreters => system}/prun/Makefile | 2 +- apps/{interpreters => system}/prun/README.txt | 0 apps/{interpreters => system}/prun/prun.c | 2 +- apps/{interpreters => system}/prun/prun.h | 0 nuttx/binfmt/Kconfig | 2 +- nuttx/binfmt/libpcode/README.txt | 4 ++++ nuttx/binfmt/pcode.c | 2 +- 14 files changed, 30 insertions(+), 16 deletions(-) rename apps/include/{interpreters => }/prun.h (95%) rename apps/{interpreters => system}/prun/.gitignore (100%) rename apps/{interpreters => system}/prun/Kconfig (55%) rename apps/{interpreters => system}/prun/Makefile (98%) rename apps/{interpreters => system}/prun/README.txt (100%) rename apps/{interpreters => system}/prun/prun.c (99%) rename apps/{interpreters => system}/prun/prun.h (100%) diff --git a/apps/include/interpreters/prun.h b/apps/include/prun.h similarity index 95% rename from apps/include/interpreters/prun.h rename to apps/include/prun.h index e895e9902..d440fb3d6 100644 --- a/apps/include/interpreters/prun.h +++ b/apps/include/prun.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/include/interpreters/prun.h + * apps/include/prun.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_INTERPRETERS_PRUN_H -#define __APPS_INCLUDE_INTERPRETERS_PRUN_H +#ifndef __APPS_INCLUDE_PRUN_H +#define __APPS_INCLUDE_PRUN_H /**************************************************************************** * Included Files @@ -87,4 +87,4 @@ int prun(FAR char *exepath, size_t varsize, size_t strsize); } #endif -#endif /* __APPS_INCLUDE_INTERPRETERS_PRUN_H */ +#endif /* __APPS_INCLUDE_PRUN_H */ diff --git a/apps/interpreters/Kconfig b/apps/interpreters/Kconfig index 0464b6c77..e95215517 100644 --- a/apps/interpreters/Kconfig +++ b/apps/interpreters/Kconfig @@ -15,6 +15,4 @@ config INTERPRETERS_PCODE Pascal run-time code. if INTERPRETERS_PCODE -source "$APPSDIR/interpreters/prun/Kconfig" endif - diff --git a/apps/interpreters/Make.defs b/apps/interpreters/Make.defs index 17364be39..5d808d5d6 100644 --- a/apps/interpreters/Make.defs +++ b/apps/interpreters/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_INTERPRETERS_PCODE),y) CONFIGURED_APPS += interpreters/pcode endif -ifeq ($(CONFIG_INTERPRETERS_PRUN),y) -CONFIGURED_APPS += interpreters/prun -endif - ifeq ($(CONFIG_INTERPRETERS_FICL),y) CONFIGURED_APPS += interpreters/ficl endif diff --git a/apps/system/Kconfig b/apps/system/Kconfig index 0de5807d3..5b6c4102b 100644 --- a/apps/system/Kconfig +++ b/apps/system/Kconfig @@ -39,6 +39,10 @@ menu "readline()" source "$APPSDIR/system/readline/Kconfig" endmenu +menu "P-Code Support" +source "$APPSDIR/system/prun/Kconfig" +endmenu + menu "Power Off" source "$APPSDIR/system/poweroff/Kconfig" endmenu diff --git a/apps/system/Make.defs b/apps/system/Make.defs index 33a40c0aa..af20390a5 100644 --- a/apps/system/Make.defs +++ b/apps/system/Make.defs @@ -66,6 +66,10 @@ ifeq ($(CONFIG_SYSTEM_NXPLAYER),y) CONFIGURED_APPS += system/nxplayer endif +ifeq ($(CONFIG_SYSTEM_PRUN),y) +CONFIGURED_APPS += sysem/prun +endif + ifeq ($(CONFIG_SYSTEM_RAMTEST),y) CONFIGURED_APPS += system/ramtest endif diff --git a/apps/interpreters/prun/.gitignore b/apps/system/prun/.gitignore similarity index 100% rename from apps/interpreters/prun/.gitignore rename to apps/system/prun/.gitignore diff --git a/apps/interpreters/prun/Kconfig b/apps/system/prun/Kconfig similarity index 55% rename from apps/interpreters/prun/Kconfig rename to apps/system/prun/Kconfig index 1f8ba4695..131a7b2aa 100644 --- a/apps/interpreters/prun/Kconfig +++ b/apps/system/prun/Kconfig @@ -3,12 +3,20 @@ # see misc/tools/kconfig-language.txt. # -config INTERPRETERS_PRUN +config SYSTEM_PRUN bool "Pascal P-Code interpreter" default n depends on INTERPRETERS_PCODE ---help--- Build the Pascal P-Code interpreter / Virtual machine -if INTERPRETERS_PRUN +if SYSTEM_PRUN + +config SYSTEM_PEXEC + bool "Pascal P-Code command" + default n + ---help--- + Generates an NSH built-in task that may be used to execute P-Code + from the NSH command line. + endif diff --git a/apps/interpreters/prun/Makefile b/apps/system/prun/Makefile similarity index 98% rename from apps/interpreters/prun/Makefile rename to apps/system/prun/Makefile index 941284fae..63fc1ad74 100644 --- a/apps/interpreters/prun/Makefile +++ b/apps/system/prun/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/interpreters/prun/Makefile +# apps/system/prun/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/apps/interpreters/prun/README.txt b/apps/system/prun/README.txt similarity index 100% rename from apps/interpreters/prun/README.txt rename to apps/system/prun/README.txt diff --git a/apps/interpreters/prun/prun.c b/apps/system/prun/prun.c similarity index 99% rename from apps/interpreters/prun/prun.c rename to apps/system/prun/prun.c index 23235074e..d1af40bfb 100644 --- a/apps/interpreters/prun/prun.c +++ b/apps/system/prun/prun.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include "pexec.h" #include "pedefs.h" diff --git a/apps/interpreters/prun/prun.h b/apps/system/prun/prun.h similarity index 100% rename from apps/interpreters/prun/prun.h rename to apps/system/prun/prun.h diff --git a/nuttx/binfmt/Kconfig b/nuttx/binfmt/Kconfig index aaf296c5b..0575cd369 100644 --- a/nuttx/binfmt/Kconfig +++ b/nuttx/binfmt/Kconfig @@ -72,7 +72,7 @@ endif config PCODE bool "Support P-Code Applications" default n - depends on INTERPRETERS_PCODE && INTERPRETERS_PRUN && (!NUTTX_KERNEL || EXPERIMENTAL) + depends on INTERPRETERS_PCODE && SYSTEM_PRUN && (!NUTTX_KERNEL || EXPERIMENTAL) ---help--- Enable support for interpreted P-Code binaries. P-Code binaries are generated by the NuttX Pascal compiler. diff --git a/nuttx/binfmt/libpcode/README.txt b/nuttx/binfmt/libpcode/README.txt index 7c6ae8ff2..f42a4f54f 100644 --- a/nuttx/binfmt/libpcode/README.txt +++ b/nuttx/binfmt/libpcode/README.txt @@ -74,6 +74,10 @@ Here is a simple test configuration using the NuttX simulator: CONFIG_INTERPRETERS_PCODE=y + And the P-Code runtime support: + + CONFIG_SYSTEM_PRUN=y + This enables building the PCODE binary format CONFIG_PCODE=y diff --git a/nuttx/binfmt/pcode.c b/nuttx/binfmt/pcode.c index 261042c8d..bd476b4f2 100644 --- a/nuttx/binfmt/pcode.c +++ b/nuttx/binfmt/pcode.c @@ -47,7 +47,7 @@ #include #include -#include +#include #include #include