Remove all support for the ancient Pascal compiler and pcode interpreter.
This commit is contained in:
parent
c084cd820c
commit
3ebf71095e
@ -1199,17 +1199,6 @@ examples/oneshot
|
|||||||
|
|
||||||
Simple test of a oneshot driver.
|
Simple test of a oneshot driver.
|
||||||
|
|
||||||
examples/pashello
|
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This is "Hello, World" implemented via the Pascal P-Code interpreter. In
|
|
||||||
order to use this example, you must first download and install the
|
|
||||||
NuttX pascal module. After unpacking the pascal module, you can find
|
|
||||||
installation instructions in pascal/nuttx/README.txt.
|
|
||||||
|
|
||||||
The correct install location for the NuttX examples and build files is
|
|
||||||
apps/interpreters.
|
|
||||||
|
|
||||||
examples/pca9635
|
examples/pca9635
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
13
examples/pashello/.gitignore
vendored
13
examples/pashello/.gitignore
vendored
@ -1,13 +0,0 @@
|
|||||||
/Make.dep
|
|
||||||
/.depend
|
|
||||||
/.built
|
|
||||||
/*.o1
|
|
||||||
/*.asm
|
|
||||||
/*.obj
|
|
||||||
/*.rel
|
|
||||||
/*.lst
|
|
||||||
/*.sym
|
|
||||||
/*.adb
|
|
||||||
/*.lib
|
|
||||||
/*.src
|
|
||||||
/*.err
|
|
@ -1,30 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
||||||
#
|
|
||||||
|
|
||||||
config EXAMPLES_PASHELLO
|
|
||||||
tristate "Pascal \"Hello, World!\" example"
|
|
||||||
default n
|
|
||||||
depends on INTERPRETERS_PCODE
|
|
||||||
select INTERPRETERS_PRUN
|
|
||||||
---help---
|
|
||||||
Enable the Pascal \"Hello, World!\" example
|
|
||||||
|
|
||||||
if EXAMPLES_PASHELLO
|
|
||||||
|
|
||||||
config EXAMPLES_PASHELLO_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 EXAMPLES_PASHELLO_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.
|
|
||||||
|
|
||||||
endif
|
|
@ -1,39 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/examples/pashello/Make.defs
|
|
||||||
# Adds selected applications to apps/ build
|
|
||||||
#
|
|
||||||
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_EXAMPLES_PASHELLO),)
|
|
||||||
CONFIGURED_APPS += $(APPDIR)/examples/pashello
|
|
||||||
endif
|
|
@ -1,53 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/examples/pashello/Makefile
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
-include $(TOPDIR)/Make.defs
|
|
||||||
|
|
||||||
# Pascal Add-On Example
|
|
||||||
|
|
||||||
PROGNAME = pashello
|
|
||||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
|
||||||
STACKSIZE = 2048
|
|
||||||
MODULE = $(CONFIG_EXAMPLES_PASHELLO)
|
|
||||||
|
|
||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \
|
|
||||||
"." \
|
|
||||||
"$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)include" \
|
|
||||||
"$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)insn$(DELIM)include"}
|
|
||||||
|
|
||||||
CSRCS = device.c
|
|
||||||
MAINSRC = pashello.c
|
|
||||||
|
|
||||||
include $(APPDIR)/Application.mk
|
|
@ -1,38 +0,0 @@
|
|||||||
README
|
|
||||||
^^^^^^
|
|
||||||
|
|
||||||
hello.pas
|
|
||||||
|
|
||||||
This is a sample "Hello, World!" Pascal Program
|
|
||||||
|
|
||||||
hello.pex
|
|
||||||
|
|
||||||
This is the compiled, linked P-Code executable that results
|
|
||||||
when hello.pas is compiled.
|
|
||||||
|
|
||||||
hello.h
|
|
||||||
|
|
||||||
This file defines an initialized C array holds a copy of
|
|
||||||
hello.pex. This file as created by:
|
|
||||||
|
|
||||||
xxd -i hello.pex >hello.h
|
|
||||||
|
|
||||||
The resulting hello.h should be editted so that both data definitions
|
|
||||||
are marked with the 'const' qualify so that the data will be stored in
|
|
||||||
FLASH.
|
|
||||||
|
|
||||||
mkhello.sh
|
|
||||||
|
|
||||||
This is a scripts that can be used to rebuild both hello.pex
|
|
||||||
and hello.h.
|
|
||||||
|
|
||||||
device.c
|
|
||||||
|
|
||||||
The hello.pex file must be provided to the interpreter as a file
|
|
||||||
in the file system. Normally this would be done using real storage
|
|
||||||
medium. In this example, we will use device.c:
|
|
||||||
|
|
||||||
device.c implements a simple device driver. Reads from this device
|
|
||||||
will access the in-memory copy of hello.pex This device driver is
|
|
||||||
registered as /dev/pashello in the pseudo filesystem.
|
|
||||||
|
|
@ -1,108 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* examples/pashello/device.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008, 2012 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Compilation Switches
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <nuttx/fs/fs.h>
|
|
||||||
|
|
||||||
#include "hello.h"
|
|
||||||
#include "pashello.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static ssize_t hello_read(struct file *, char *, size_t);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static const struct file_operations hello_fops =
|
|
||||||
{
|
|
||||||
NULL, /* open */
|
|
||||||
NULL, /* close */
|
|
||||||
hello_read, /* read */
|
|
||||||
NULL, /* write */
|
|
||||||
NULL, /* seek */
|
|
||||||
NULL, /* ioctl */
|
|
||||||
NULL /* poll */
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static ssize_t hello_read(struct file *filep, char *buffer, size_t len)
|
|
||||||
{
|
|
||||||
off_t offset = filep->f_pos; /* Start read position */
|
|
||||||
ssize_t nread = 0; /* Bytes read -- assume EOF */
|
|
||||||
|
|
||||||
/* Make sure that the offset is within the .pex file */
|
|
||||||
|
|
||||||
if (offset < hello_pex_len)
|
|
||||||
{
|
|
||||||
/* Make sure the read does not extend beyond the .pex file */
|
|
||||||
|
|
||||||
nread = len;
|
|
||||||
if (nread + offset > hello_pex_len)
|
|
||||||
{
|
|
||||||
nread = hello_pex_len - offset;
|
|
||||||
}
|
|
||||||
memcpy(buffer, &hello_pex[offset], nread);
|
|
||||||
filep->f_pos += nread;
|
|
||||||
}
|
|
||||||
return nread;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void hello_register(void)
|
|
||||||
{
|
|
||||||
(void)register_driver("/dev/hello", &hello_fops, 0444, NULL);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
unsigned char hello_pex[] =
|
|
||||||
{
|
|
||||||
0x50, 0x4f, 0x46, 0x46, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05,
|
|
||||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
|
|
||||||
0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x11, 0x01, 0x03, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d,
|
|
||||||
0x00, 0x00, 0x00, 0x0f, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x04,
|
|
||||||
0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0,
|
|
||||||
0x00, 0x00, 0x00, 0x38, 0xb1, 0x00, 0x00, 0x74, 0x0e, 0xf9, 0x00, 0x00,
|
|
||||||
0x25, 0xb5, 0xff, 0xfc, 0xf9, 0x00, 0x00, 0x20, 0x3f, 0x48, 0x65, 0x6c,
|
|
||||||
0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x21, 0x21, 0x00,
|
|
||||||
0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4c,
|
|
||||||
0x4c, 0x4f, 0x00, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x61, 0x73,
|
|
||||||
0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x00, 0x2e, 0x72, 0x6f, 0x64, 0x61,
|
|
||||||
0x74, 0x61, 0x00, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x61, 0x62, 0x00,
|
|
||||||
0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x6e, 0x6f, 0x00, 0x2e, 0x73, 0x74, 0x72,
|
|
||||||
0x74, 0x61, 0x62, 0x00
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned int hello_pex_len = 232;
|
|
@ -1,5 +0,0 @@
|
|||||||
program hello(output);
|
|
||||||
begin
|
|
||||||
writeln('Hello world!!!');
|
|
||||||
end.
|
|
||||||
|
|
Binary file not shown.
@ -1,141 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
############################################################################
|
|
||||||
# examples/pashello/mkhello.sh
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
#set -x
|
|
||||||
|
|
||||||
BINDIR=$1
|
|
||||||
WD=`pwd`
|
|
||||||
|
|
||||||
PASCAL=${BINDIR}/pascal
|
|
||||||
POPT=${BINDIR}/popt
|
|
||||||
PLINK=${BINDIR}/plink
|
|
||||||
PRUN=${BINDIR}/prun
|
|
||||||
|
|
||||||
PASFILENAME=hello.pas
|
|
||||||
OUFILE=hello.h
|
|
||||||
STRSTKSZ=1024
|
|
||||||
|
|
||||||
function sanity_check ()
|
|
||||||
{
|
|
||||||
if [ ! -f "${WD}/${PASFILENAME}" ]; then
|
|
||||||
echo "ERROR: Source ${PASFILENAME} does not exist in this directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ -z "${BINDIR}" ]; then
|
|
||||||
echo "ERROR: Path to the pascal bin/ directory not provided"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -d "${BINDIR}" ]; then
|
|
||||||
echo "ERROR: Tool ${BINDIR} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -x "${PASCAL}" ]; then
|
|
||||||
echo "ERROR: Executable ${PASCAL} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -x "${POPT}" ]; then
|
|
||||||
echo "ERROR: Executable ${POPT} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -x "${PLINK}" ]; then
|
|
||||||
echo "ERROR: Executable ${PLINK} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -x "${PRUN}" ]; then
|
|
||||||
echo "ERROR: Executable ${PRUN} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function compile_hello ()
|
|
||||||
{
|
|
||||||
PASOPTS=
|
|
||||||
${PASCAL} ${PASOPTS} ${PASFILENAME} 2>&1 || rm -f hello.o1
|
|
||||||
if [ -f hello.err ] ; then
|
|
||||||
cat hello.err | grep Line
|
|
||||||
fi
|
|
||||||
if [ ! -f hello.o1 ] ; then
|
|
||||||
echo "Compilation failed"
|
|
||||||
else
|
|
||||||
POPTOPTS=
|
|
||||||
${POPT} ${POPTOPTS} hello.o1 2>&1
|
|
||||||
${PLINK} hello.o hello.pex 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_program ()
|
|
||||||
{
|
|
||||||
if [ "${CONFIG_REGM}" == "y" ]; then
|
|
||||||
echo "Don't know how to run REGM programs yet"
|
|
||||||
else
|
|
||||||
echo "Using string stack size = ${STRSTKSZ}"
|
|
||||||
PRUNOPTS="-t ${STRSTKSZ}"
|
|
||||||
|
|
||||||
if [ ! -f hello.pex ]; then
|
|
||||||
echo "No p-code executable"
|
|
||||||
else
|
|
||||||
if [ -f hello.inp ] ; then
|
|
||||||
${PRUN} ${PRUNOPTS} hello.pex 2>&1 <hello.inp
|
|
||||||
else
|
|
||||||
${PRUN} ${PRUNOPTS} hello.pex 2>&1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_hello ()
|
|
||||||
{
|
|
||||||
echo "Using string stack size = ${STRSTKSZ}"
|
|
||||||
PRUNOPTS="-t ${STRSTKSZ}"
|
|
||||||
|
|
||||||
if [ ! -f hello.pex ]; then
|
|
||||||
echo "No p-code executable"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
${PRUN} ${PRUNOPTS} hello.pex
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_include ()
|
|
||||||
{
|
|
||||||
xxd -i hello.pex >hello.h
|
|
||||||
}
|
|
||||||
|
|
||||||
sanity_check
|
|
||||||
compile_hello
|
|
||||||
rm *.o *.o1 *.lst *.err
|
|
||||||
test_hello
|
|
||||||
make_include
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* examples/pashello/pashello.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "interpreters/prun.h"
|
|
||||||
|
|
||||||
#include "pashello.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_PASHELLO_VARSTACKSIZE
|
|
||||||
# define CONFIG_EXAMPLES_PASHELLO_VARSTACKSIZE 1024
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_PASHELLO_STRSTACKSIZE
|
|
||||||
# define CONFIG_EXAMPLES_PASHELLO_STRSTACKSIZE 128
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* pashello_main
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int main(int argc, FAR char *argv[])
|
|
||||||
{
|
|
||||||
int exitcode = EXIT_SUCCESS;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Register the /dev/hello driver */
|
|
||||||
|
|
||||||
hello_register();
|
|
||||||
|
|
||||||
/* Execute the POFF file */
|
|
||||||
|
|
||||||
ret = prun("/dev/hello", CONFIG_EXAMPLES_PASHELLO_VARSTACKSIZE,
|
|
||||||
CONFIG_EXAMPLES_PASHELLO_STRSTACKSIZE);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "pashello_main: ERROR: Execution failed\n");
|
|
||||||
exitcode = EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("pashello_main: Interpreter terminated");
|
|
||||||
return exitcode;
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* examples/pashello/pashello.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __EXAMPLES_PASHELLO_H
|
|
||||||
#define __EXAMPLES_PASHELLO_H
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Defined in device.c */
|
|
||||||
|
|
||||||
void hello_register(void);
|
|
||||||
|
|
||||||
#endif /* __EXAMPLES_PASHELLO_H */
|
|
1
include/.gitignore
vendored
1
include/.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
/pcode
|
|
||||||
/netutils/cJSON.h
|
/netutils/cJSON.h
|
||||||
/netutils/cJSON_Utils.h
|
/netutils/cJSON_Utils.h
|
||||||
|
|
||||||
|
@ -23,56 +23,3 @@ minibasic
|
|||||||
responsibility for any actions that you might take based on my
|
responsibility for any actions that you might take based on my
|
||||||
understanding. Please use your own legal judgement.
|
understanding. Please use your own legal judgement.
|
||||||
|
|
||||||
pcode
|
|
||||||
-----
|
|
||||||
|
|
||||||
At present, only the NuttX Pascal add-on is supported. This NuttX add-on
|
|
||||||
must be downloaded separately (or is available from the Nuttx Pascal GIT
|
|
||||||
repository).
|
|
||||||
|
|
||||||
This Pascal add-on must be installed into the NuttX apps/ directory. After
|
|
||||||
unpacking the Pascal add-on package, an installation script and README.txt
|
|
||||||
instructions can be found at pascal/nuttx.
|
|
||||||
|
|
||||||
INSTALL.sh -- The script that performs the operation. Usage:
|
|
||||||
|
|
||||||
./INSTALL.sh [-16|-32] <install-dir>
|
|
||||||
|
|
||||||
If you are using this standard NuttX apps/ package, the correct
|
|
||||||
location for the <install-dir> is apps/interpreters. That is
|
|
||||||
where the examples and build logic will expect to find the pcode
|
|
||||||
sub-directory.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
./INSTALL.sh -16 $PWD/../../../apps/interpreters
|
|
||||||
|
|
||||||
After installation, the NuttX apps/interpresters directory will contain
|
|
||||||
the following files
|
|
||||||
|
|
||||||
pcode
|
|
||||||
|-- Makefile
|
|
||||||
|-- include
|
|
||||||
| `-- Common header files
|
|
||||||
|-- libboff
|
|
||||||
| `-- Pascal object format (POFF) library
|
|
||||||
`--insn
|
|
||||||
|-- include
|
|
||||||
| `-- model-specific header files
|
|
||||||
`-- prun
|
|
||||||
`-- model-specific source files
|
|
||||||
|
|
||||||
pashello
|
|
||||||
|
|
||||||
There is a simple Pascal example at apps/examples/pashello. This is the
|
|
||||||
standard "Hello, World!" example written in Pascal and interpreted from
|
|
||||||
Pascal P-Code at runtime. To use this example, place the following in
|
|
||||||
your defonfig file:
|
|
||||||
|
|
||||||
CONFIG_EXAMPLES_PASHELLO=y
|
|
||||||
CONFIG_INTERPRETERS_PCODE=y
|
|
||||||
|
|
||||||
prun
|
|
||||||
|
|
||||||
This directory holds some simple, convenience functions to simplify and
|
|
||||||
standardize the interaction with the P-Code library.
|
|
||||||
|
6
interpreters/pcode/.gitignore
vendored
6
interpreters/pcode/.gitignore
vendored
@ -1,6 +0,0 @@
|
|||||||
/Makefile
|
|
||||||
/include
|
|
||||||
/insn
|
|
||||||
/libpas
|
|
||||||
/libpoff
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
config INTERPRETERS_PCODE
|
|
||||||
bool "Pascal p-code interpreter"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
Enable support for the Pascal p-code interpreter. See the README.txt
|
|
||||||
file at located in the NuttX Pascal repository and also the
|
|
||||||
README.txt file in the apps/interpreter directory. Use of this
|
|
||||||
configuration implies that you have performed the required
|
|
||||||
installation of the Pascal run-time code.
|
|
||||||
|
|
||||||
if INTERPRETERS_PCODE
|
|
||||||
endif
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
ifeq ($(CONFIG_INTERPRETERS_PCODE),y)
|
|
||||||
CONFIGURED_APPS += $(APPDIR)/interpreters/pcode
|
|
||||||
endif
|
|
||||||
|
|
13
system/prun/.gitignore
vendored
13
system/prun/.gitignore
vendored
@ -1,13 +0,0 @@
|
|||||||
/Make.dep
|
|
||||||
/.depend
|
|
||||||
/.built
|
|
||||||
/*.o1
|
|
||||||
/*.asm
|
|
||||||
/*.obj
|
|
||||||
/*.rel
|
|
||||||
/*.lst
|
|
||||||
/*.sym
|
|
||||||
/*.adb
|
|
||||||
/*.lib
|
|
||||||
/*.src
|
|
||||||
/*.err
|
|
@ -1,57 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
||||||
#
|
|
||||||
|
|
||||||
menuconfig SYSTEM_PRUN
|
|
||||||
bool "Pascal P-Code interpreter"
|
|
||||||
default n
|
|
||||||
depends on INTERPRETERS_PCODE
|
|
||||||
---help---
|
|
||||||
Build the Pascal P-Code interpreter / Virtual machine. This selection
|
|
||||||
just builds a library of P-Code-related functions as described in
|
|
||||||
include/apps/system/prun.h. This selection is also necessary to enable other
|
|
||||||
P-Code related features.
|
|
||||||
|
|
||||||
if SYSTEM_PRUN
|
|
||||||
|
|
||||||
config SYSTEM_PEXEC
|
|
||||||
tristate "Pascal P-Code command"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
Generates an NSH built-in task that may be used to execute P-Code
|
|
||||||
files from the NSH command line. For example:
|
|
||||||
|
|
||||||
nsh> pexec /bin/hello.pex
|
|
||||||
Hello, World!
|
|
||||||
|
|
||||||
if SYSTEM_PEXEC
|
|
||||||
|
|
||||||
config SYSTEM_PEXEC_STACKSIZE
|
|
||||||
int "P-code interpreter stack size"
|
|
||||||
default 2048
|
|
||||||
---help---
|
|
||||||
This is the stack size that will be used when starting P-code interpreter.
|
|
||||||
|
|
||||||
config SYSTEM_PEXEC_PRIORITY
|
|
||||||
int "P-code interpreter priority"
|
|
||||||
default 100
|
|
||||||
---help---
|
|
||||||
This is the task_priority that will be used when starting P-code interpreter.
|
|
||||||
|
|
||||||
config SYSTEM_PEXEC_VARSTACKSIZE
|
|
||||||
int "P-code variable stack size (default)"
|
|
||||||
default 1024
|
|
||||||
---help---
|
|
||||||
This default size of the P-Code variable storage area to be allocated by the
|
|
||||||
P-Code runtime.
|
|
||||||
|
|
||||||
config SYSTEM_PEXEC_STRSTACKSIZE
|
|
||||||
int "P-code string stack size (default)"
|
|
||||||
default 128
|
|
||||||
---help---
|
|
||||||
This default size of the P-Code string stack area to be allocated by the
|
|
||||||
P-Code runtime.
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
@ -1,40 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/system/prun/Make.defs
|
|
||||||
# Adds selected applications to apps/ build
|
|
||||||
#
|
|
||||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_SYSTEM_PRUN),)
|
|
||||||
CONFIGURED_APPS += $(APPDIR)/system/prun
|
|
||||||
endif
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/system/prun/Makefile
|
|
||||||
#
|
|
||||||
# Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# 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)/Make.defs
|
|
||||||
|
|
||||||
# Pascal P-Code interpreter / Virtual machine
|
|
||||||
|
|
||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \
|
|
||||||
"." \
|
|
||||||
"$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)include" \
|
|
||||||
"$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)insn$(DELIM)include"}
|
|
||||||
|
|
||||||
CSRCS = prun.c
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_SYSTEM_PEXEC),)
|
|
||||||
PROGNAME = pexec
|
|
||||||
PRIORITY = $(CONFIG_SYSTEM_PEXEC_PRIORITY)
|
|
||||||
STACKSIZE = $(CONFIG_SYSTEM_PEXEC_STACKSIZE)
|
|
||||||
MODULE = $(CONFIG_SYSTEM_PEXEC)
|
|
||||||
|
|
||||||
MAINSRC += pexec_main.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(APPDIR)/Application.mk
|
|
@ -1,38 +0,0 @@
|
|||||||
README
|
|
||||||
^^^^^^
|
|
||||||
|
|
||||||
hello.pas
|
|
||||||
|
|
||||||
This is a sample "Hello, World!" Pascal Program
|
|
||||||
|
|
||||||
hello.pex
|
|
||||||
|
|
||||||
This is the compiled, linked P-Code executable that results
|
|
||||||
when hello.pas is compiled.
|
|
||||||
|
|
||||||
hello.h
|
|
||||||
|
|
||||||
This file defines an initialized C array holds a copy of
|
|
||||||
hello.pex. This file as created by:
|
|
||||||
|
|
||||||
xxd -i hello.pex >hello.h
|
|
||||||
|
|
||||||
The resulting hello.h should be editted so that both data definitions
|
|
||||||
are marked with the 'const' qualify so that the data will be stored in
|
|
||||||
FLASH.
|
|
||||||
|
|
||||||
mkhello.sh
|
|
||||||
|
|
||||||
This is a scripts that can be used to rebuild both hello.pex
|
|
||||||
and hello.h.
|
|
||||||
|
|
||||||
device.c
|
|
||||||
|
|
||||||
The hello.pex file must be provided to the interpreter as a file
|
|
||||||
in the file system. Normally this would be done using real storage
|
|
||||||
medium. In this example, we will use device.c:
|
|
||||||
|
|
||||||
device.c implements a simple device driver. Reads from this device
|
|
||||||
will access the in-memory copy of hello.pex This device driver is
|
|
||||||
registered as /dev/prun in the pseudo filesystem.
|
|
||||||
|
|
@ -1,174 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* system/prun/pexec_main.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "system/prun.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef CONFIG_SYSTEM_PEXEC_VARSTACKSIZE
|
|
||||||
# define CONFIG_SYSTEM_PEXEC_VARSTACKSIZE 1024
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG_SYSTEM_PEXEC_STRSTACKSIZE
|
|
||||||
# define CONFIG_SYSTEM_PEXEC_STRSTACKSIZE 128
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static void show_usage(FAR const char *progname, int errcode)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "USAGE: %s [OPTIONS] <filename>\n", progname);
|
|
||||||
fprintf(stderr, "\nWhere:\n");
|
|
||||||
fprintf(stderr, "\t<filename> is the full path to the P-Code file to be executed\n");
|
|
||||||
fprintf(stderr, "\nand OPTIONS include the following:\n");
|
|
||||||
fprintf(stderr, "\t-v <varsize>: Variable memory size to use. Default: %d\n",
|
|
||||||
CONFIG_SYSTEM_PEXEC_VARSTACKSIZE);
|
|
||||||
fprintf(stderr, "\t-s <strsize>: String stack size to use. Default: %d\n",
|
|
||||||
CONFIG_SYSTEM_PEXEC_STRSTACKSIZE);
|
|
||||||
fprintf(stderr, "\t-h: Show this text and exit\n");
|
|
||||||
exit(errcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int main(int argc, FAR char *argv[])
|
|
||||||
{
|
|
||||||
FAR char *filename = NULL;
|
|
||||||
FAR char *endptr;
|
|
||||||
long varsize = CONFIG_SYSTEM_PEXEC_VARSTACKSIZE;
|
|
||||||
long strsize = CONFIG_SYSTEM_PEXEC_STRSTACKSIZE;
|
|
||||||
long tmp;
|
|
||||||
int option;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Parse input parameters */
|
|
||||||
|
|
||||||
while ((option = getopt(argc, argv, ":v:s:h")) != ERROR)
|
|
||||||
{
|
|
||||||
switch (option)
|
|
||||||
{
|
|
||||||
case 'h':
|
|
||||||
show_usage(argv[0], EXIT_SUCCESS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
tmp = strtol(optarg, &endptr, 10);
|
|
||||||
if (tmp < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Variable memory size out of range: %ld\n", tmp);
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
varsize = tmp;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case 's':
|
|
||||||
tmp = strtol(optarg, &endptr, 10);
|
|
||||||
if (tmp < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: String stack size out of range: %ld\n", tmp);
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strsize = tmp;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ':':
|
|
||||||
fprintf(stderr, "ERROR: Missing required argument\n");
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
case '?':
|
|
||||||
fprintf(stderr, "ERROR: Unrecognized option\n");
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* There should be one final parameters remaining on the command line */
|
|
||||||
|
|
||||||
if (optind >= argc)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Missing required <filename> argument\n");
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
filename = argv[optind];
|
|
||||||
optind++;
|
|
||||||
|
|
||||||
if (optind < argc)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Garbage at the end of the command line\n");
|
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Execute the P-Code file */
|
|
||||||
|
|
||||||
ret = prun(filename, varsize, strsize);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
int errval = errno;
|
|
||||||
DEBUGASSERT(errval > 0);
|
|
||||||
|
|
||||||
fprintf(stderr, "ERROR: P-Code execution failed: %d %d\n", ret, errval);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* apps/system/prun/prun.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "system/prun.h"
|
|
||||||
|
|
||||||
#include "pexec.h"
|
|
||||||
#include "pedefs.h"
|
|
||||||
#include "prun.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: prun
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Execute/interpret a P-Code file. This function does not return until
|
|
||||||
* the P-code program terminates or until a fatal error occurs.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* exepath - The full path to the P-Code binary.
|
|
||||||
* varsize - Size of the P-Code variable stack
|
|
||||||
* strsize - the size of the P-Code string stack.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* OK if the P-Code program successfully terminated; A negated errno value
|
|
||||||
* is returned on the event of any failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int prun(FAR char *exepath, size_t varsize, size_t strsize)
|
|
||||||
{
|
|
||||||
FAR struct pexec_s *st;
|
|
||||||
int errcode;
|
|
||||||
int ret = OK;
|
|
||||||
|
|
||||||
/* Load the POFF file into memory */
|
|
||||||
|
|
||||||
st = pload(exepath, varsize, varsize);
|
|
||||||
if (!st)
|
|
||||||
{
|
|
||||||
berr("ERROR: Could not load %s\n", exepath);
|
|
||||||
return -ENOEXEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
binfo("Loaded %s\n", exepath);
|
|
||||||
|
|
||||||
/* Execute the P-Code program until a stopping condition occurs */
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
/* Execute the instruction; Check for exceptional conditions */
|
|
||||||
|
|
||||||
errcode = pexec(st);
|
|
||||||
if (errcode != eNOERROR)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errcode != eEXIT)
|
|
||||||
{
|
|
||||||
/* REVISIT: Select a more appropriated return errocode */
|
|
||||||
|
|
||||||
berr("ERROR: Runtime error 0x%02x -- Execution Stopped\n", errcode);
|
|
||||||
ret = -ENOEXEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up resources used by the interpreter */
|
|
||||||
|
|
||||||
binfo("Execution terminated\n");
|
|
||||||
pexec_release(st);
|
|
||||||
return ret;
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* apps/system/prun/prun.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __APPS_SYSTEM_PRUN_H
|
|
||||||
#define __APPS_SYSTEM_PRUN_H
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Defined in device.c */
|
|
||||||
|
|
||||||
extern void hello_register(void);
|
|
||||||
|
|
||||||
#endif /* __APPS_SYSTEM_PRUN_H */
|
|
Loading…
x
Reference in New Issue
Block a user