Skip to content

Commit

Permalink
Update NuttX target to releases/10.2 (jerryscript-project#4822)
Browse files Browse the repository at this point in the history
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
  • Loading branch information
rtakacs authored Nov 23, 2021
1 parent 2899582 commit 3737a28
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 118 deletions.
24 changes: 7 additions & 17 deletions targets/nuttx-stm32f4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#

config JERRYSCRIPT
bool "Jerryscript"
config INTERPRETERS_JERRYSCRIPT
bool "Jerryscript JavaScript engine"
default n
---help---
Enable Jerryscript ECMAScript 5.1 interpreter

if JERRYSCRIPT
if INTERPRETERS_JERRYSCRIPT

config JERRYSCRIPT_PROGNAME
string "Program name"
default "jerry"
depends on BUILD_KERNEL
---help---
This is the name of the program that will be
use when the NSH ELF program is installed.

config JERRYSCRIPT_PRIORITY
int "Jerryscript task priority"
config INTERPRETERS_JERRYSCRIPT_PRIORITY
int "Jerryscript priority"
default 100

config JERRYSCRIPT_STACKSIZE
config INTERPRETERS_JERRYSCRIPT_STACKSIZE
int "Jerryscript stack size"
default 16384

endif # JERRYSCRIPT
endif # INTERPRETERS_JERRYSCRIPT
4 changes: 2 additions & 2 deletions targets/nuttx-stm32f4/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ifeq ($(CONFIG_JERRYSCRIPT),y)
CONFIGURED_APPS += interpreters/jerryscript
ifeq ($(CONFIG_INTERPRETERS_JERRYSCRIPT),y)
CONFIGURED_APPS += $(APPDIR)/interpreters/jerryscript
endif
33 changes: 21 additions & 12 deletions targets/nuttx-stm32f4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs

# Jerryscript built-in application information.
CONFIG_JERRYSCRIPT_PRIORITY ?= SCHED_PRIORITY_DEFAULT
CONFIG_JERRYSCRIPT_PROGNAME ?= jerry$(EXEEXT)
CONFIG_JERRYSCRIPT_STACKSIZE ?= 16384
PROGNAME = jerry
PRIORITY = $(CONFIG_INTERPRETERS_JERRYSCRIPT_PRIORITY)
STACKSIZE = $(CONFIG_INTERPRETERS_JERRYSCRIPT_STACKSIZE)

PROGNAME = $(CONFIG_JERRYSCRIPT_PROGNAME)
PRIORITY = $(CONFIG_JERRYSCRIPT_PRIORITY)
STACKSIZE = $(CONFIG_JERRYSCRIPT_STACKSIZE)

# Path to the JerryScript project. If not specified, it is supposed
# that JerryScript is located next to the nuttx-apps folder.
# Path to the JerryScript and NuttX projects. If not specified, it is
# supposed that JerryScript is located next to the nuttx folder.
JERRYSCRIPT_ROOT_DIR ?= ../../../jerryscript
NUTTX_ROOT_DIR ?= $(JERRYSCRIPT_ROOT_DIR)/../nuttx

CFLAGS += -std=c99
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-core/include
Expand All @@ -35,7 +32,6 @@ CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-math/include
# These libs should be copied from the JerryScript project.
LIBS = libjerry-core.a libjerry-ext.a libjerry-math.a

APPNAME = jerry
ASRCS = setjmp.S
CSRCS = jerry_port.c jerry_module.c
MAINSRC = jerry_main.c
Expand All @@ -55,8 +51,21 @@ updateobjs:
cleanlibs: updateobjs
rm -f $(OBJS)

.PHONY: libjerry
libjerry:
$(JERRYSCRIPT_ROOT_DIR)/tools/build.py \
--clean \
--lto=OFF \
--jerry-cmdline=OFF \
--jerry-math=ON \
--amalgam=ON \
--mem-heap=70 \
--profile=es.next \
--compile-flag="--sysroot=${NUTTX_ROOT_DIR}" \
--toolchain=$(abspath $(JERRYSCRIPT_ROOT_DIR)/cmake/toolchain_mcu_stm32f4.cmake)

clean:: cleanlibs

.built: $(LIBS) updateobjs
archive: libjerry $(LIBS) updateobjs

include $(APPDIR)/Application.mk
15 changes: 5 additions & 10 deletions targets/nuttx-stm32f4/Makefile.travis
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ install-kconfig:

# Fetch nuttx/{apps,nuttx} repositories.
install-clone-nuttx:
git clone https://github.com/apache/incubator-nuttx-apps.git ../apps -b releases/9.0
git clone https://github.com/apache/incubator-nuttx.git ../nuttx -b releases/9.0
git clone https://github.com/apache/incubator-nuttx-apps.git ../apps -b releases/10.2
git clone https://github.com/apache/incubator-nuttx.git ../nuttx -b releases/10.2

# Perform all the necessary (JerryScript-independent) installation steps.
install-noapt: install-kconfig install-clone-nuttx
Expand All @@ -49,22 +49,17 @@ install: install-apt-get-deps install-noapt

## Targets for building NuttX with JerryScript.

# Build JerryScript.
script-build-jerryscript:
tools/build.py --clean --toolchain cmake/toolchain_mcu_stm32f4.cmake --profile=es.next --jerry-cmdline OFF --lto OFF --jerry-math ON --amalgam ON --jerry-port-default OFF --mem-heap 70 --compile-flag='--sysroot=../nuttx'

# Link in the NuttX JerryScript target directory under the NuttX apps tree.
script-add-jerryscript-app:
ln -s ../../jerryscript/targets/nuttx-stm32f4 ../apps/interpreters/jerryscript

# Configure USB shell.
script-configure-usbnsh:
cd ../nuttx/tools && PATH=$(LOCAL_INSTALL)/bin:$$PATH ./configure.sh stm32f4discovery/usbnsh
cd ../nuttx/tools && PATH=$(LOCAL_INSTALL)/bin:$$PATH ./configure.sh stm32f4discovery:usbnsh

# Configure and build the firmware (NuttX with JerryScript).
script: script-build-jerryscript script-add-jerryscript-app script-configure-usbnsh
echo 'CONFIG_HOST_LINUX=y' >> ../nuttx/.config
script: script-add-jerryscript-app script-configure-usbnsh
echo 'CONFIG_ARCH_FPU=y' >> ../nuttx/.config
echo 'CONFIG_JERRYSCRIPT=y'>> ../nuttx/.config
echo 'CONFIG_INTERPRETERS_JERRYSCRIPT=y'>> ../nuttx/.config
PATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx olddefconfig
PATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx
Loading

0 comments on commit 3737a28

Please sign in to comment.