mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
Merge 320bd2e73b into 69249fc9e6
This commit is contained in:
commit
3dda2eaee0
2 changed files with 106 additions and 0 deletions
58
Documentation/applications/interpreters/berry/index.rst
Normal file
58
Documentation/applications/interpreters/berry/index.rst
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
==================================
|
||||
``berry`` Berry scripting language
|
||||
==================================
|
||||
|
||||
Berry is a small embedded scripting language implemented in ANSI C99. The
|
||||
``berry`` command provides a compiler, register-based virtual machine, garbage
|
||||
collector, file I/O, bytecode loading and saving, and built-in modules for
|
||||
small on-device scripts.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Enable Berry with ``CONFIG_INTERPRETERS_BERRY``. The interpreter is built as an
|
||||
NSH built-in command with the following options:
|
||||
|
||||
``CONFIG_INTERPRETERS_BERRY_PROGNAME``
|
||||
Command name used to start Berry. The default is ``berry``.
|
||||
|
||||
``CONFIG_INTERPRETERS_BERRY_PRIORITY``
|
||||
Task priority for the interpreter. The default is ``100``.
|
||||
|
||||
``CONFIG_INTERPRETERS_BERRY_STACKSIZE``
|
||||
Stack size for the interpreter task. The default is ``12288`` bytes.
|
||||
|
||||
Berry depends on ``CONFIG_ARCH_SETJMP_H``, ``CONFIG_LIBC_FLOATINGPOINT``, and
|
||||
``CONFIG_SYSTEM_SYSTEM``. The default NuttX Berry configuration enables the
|
||||
file, JSON, math, time, OS, GC, debug, strict, introspection, and bytecode
|
||||
modules. Shared-library module loading is disabled, so Berry does not require
|
||||
``CONFIG_LIBC_DLFCN``.
|
||||
|
||||
The math module requires a math library. Use the NuttX ``LIBM`` config or a
|
||||
toolchain-provided math library.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Run a script from any mounted filesystem:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nsh> berry hello.be
|
||||
nsh> berry /scripts/blink.be
|
||||
|
||||
Run inline source:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nsh> berry -e print(40+2)
|
||||
42
|
||||
|
||||
Start the interactive prompt:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nsh> berry
|
||||
Berry 1.1.0 (build in Jun 26 2026, 09:07:01)
|
||||
[GCC 13.2.0] on NuttX (default)
|
||||
>
|
||||
48
boards/sim/sim/sim/configs/berry/defconfig
Normal file
48
boards/sim/sim/sim/configs/berry/defconfig
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="sim"
|
||||
CONFIG_ARCH_BOARD="sim"
|
||||
CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEV_LOOP=y
|
||||
CONFIG_ETC_FATDEVNO=2
|
||||
CONFIG_ETC_ROMFS=y
|
||||
CONFIG_ETC_ROMFSDEVNO=1
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FSUTILS_PASSWD=y
|
||||
CONFIG_FSUTILS_PASSWD_READONLY=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTERPRETERS_BERRY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILE_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PATH_INITIAL="/bin"
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_START_MONTH=6
|
||||
CONFIG_START_YEAR=2008
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_SYSTEM=y
|
||||
Loading…
Add table
Add a link
Reference in a new issue