summaryrefslogtreecommitdiff
path: root/nuttx/binfmt/libpcode
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-05-09 08:52:11 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-05-09 08:52:11 -0600
commitb373fc5405bc34fe4889a67d9a856c9228ae1240 (patch)
tree4dcde4ad339f61611ef2a291d3e52644d91ea4a8 /nuttx/binfmt/libpcode
parent56078d9f356c73497be755f6a912b7d2da6c66e8 (diff)
downloadnuttx-b373fc5405bc34fe4889a67d9a856c9228ae1240.tar.gz
nuttx-b373fc5405bc34fe4889a67d9a856c9228ae1240.tar.bz2
nuttx-b373fc5405bc34fe4889a67d9a856c9228ae1240.zip
Create P-Code execution helper in apps/interpreters/prun; The P-Code binary format is functional except that there are still some modularity and kernel build issues that need to be addressed.
Diffstat (limited to 'nuttx/binfmt/libpcode')
-rw-r--r--nuttx/binfmt/libpcode/Kconfig14
-rw-r--r--nuttx/binfmt/libpcode/README.txt67
2 files changed, 81 insertions, 0 deletions
diff --git a/nuttx/binfmt/libpcode/Kconfig b/nuttx/binfmt/libpcode/Kconfig
index 03255ffab..b09f6795e 100644
--- a/nuttx/binfmt/libpcode/Kconfig
+++ b/nuttx/binfmt/libpcode/Kconfig
@@ -15,6 +15,20 @@ config PCODE_PRIORITY
---help---
This is the task_priority that will be used when starting P-code interpreter.
+config PCODE_VARSTACKSIZE
+ int "P-code variable stack size"
+ default 1024
+ ---help---
+ This size of the P-Code variable storage area to be allocated by the
+ P-Code runtime.
+
+config PCODE_STRSTACKSIZE
+ int "P-code string stack size"
+ default 128
+ ---help---
+ This size of the P-Code string stack area to be allocated by the
+ P-Code runtime.
+
config PCODE_TEST_FS
bool "Mount a test file system"
depends on FS_ROMFS && !DISABLE_MOUNTPOINT
diff --git a/nuttx/binfmt/libpcode/README.txt b/nuttx/binfmt/libpcode/README.txt
index b7f896da0..7c6ae8ff2 100644
--- a/nuttx/binfmt/libpcode/README.txt
+++ b/nuttx/binfmt/libpcode/README.txt
@@ -49,3 +49,70 @@ Files include in this directory include:
xxd -g 1 -i romfs.img >romfs.h
then cleaned up with an editor to conform with NuttX coding standards.
+
+Test Configuration
+------------------
+Here is a simple test configuration using the NuttX simulator:
+
+1. Install the sim/nsh configuration:
+
+ cd tools
+ ./configure.sh sim/nsh
+ cd ..
+
+2. Install p-code virtual machine as described above.
+
+3. Modify the configuration using 'make menuconfig'. Change the following
+ selections:
+
+ This enables general BINFMT support:
+
+ CONFIG_DEBUG_BINFMT=y
+ CONFIG_BINFMT_EXEPATH=y
+
+ This enables building of the P-Code virtual machine:
+
+ CONFIG_INTERPRETERS_PCODE=y
+
+ This enables building the PCODE binary format
+
+ CONFIG_PCODE=y
+ CONFIG_PCODE_PRIORITY=100
+ CONFIG_PCODE_STACKSIZE=2048
+
+ This enables building and mount a test filesystem:
+
+ CONFIG_PCODE_TEST_FS=y
+ CONFIG_PCODE_TEST_DEVMINOR=3
+ CONFIG_PCODE_TEST_DEVPATH="/dev/ram3"
+ CONFIG_PCODE_TEST_MOUNTPOINT="/bin"
+
+ Debug options can also be enabled with:
+
+ CONFIG_DEBUG=y
+ CONFIG_DEBUG_BINFMT=y
+ CONFIG_DEBUG_VERBOSE=y
+
+4. In lieu of a a real test application, this Quick'n'Dirty patch can be used
+ to initialize the P-Code binary format:
+
+ @@ -115,6 +115,7 @@ const struct symtab_s CONFIG_EXECFUNCS_SYMTAB[1];
+ /****************************************************************************
+ * Name: nsh_main
+ ****************************************************************************/
+ +int pcode_initialize(void);
+
+ int nsh_main(int argc, char *argv[])
+ {
+ @@ -143,6 +144,7 @@ int nsh_main(int argc, char *argv[])
+ exitval = 1;
+ }
+ #endif
+ +(void)pcode_initialize();
+
+ /* Initialize the NSH library */
+
+5. Then after building nuttx.exe you should be able to run the P-Code hello
+ world example like:
+
+ nsh> hello.pex