Skip to content

target: tizenrt-artik05x: Initial porting #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions targets/tizenrt-artik05x/Makefile.tizenrt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

CURDIR = `pwd`
JERRYHEAP ?= 16
BUILD_DIR ?= build/tizenrt-artik05x/
LIBTARGET_DIR ?= ../tizenrt/build/output/libraries

EXT_CFLAGS += -mcpu=cortex-r4 -mfpu=vfpv3
EXT_CFLAGS += -fno-builtin -fno-strict-aliasing
EXT_CFLAGS += -fomit-frame-pointer
EXT_CFLAGS += -fno-strength-reduce
EXT_CFLAGS += -Wall -Werror -Wshadow
EXT_CFLAGS += -Wno-error=conversion
EXT_CFLAGS += -I. -isystem ../tizenrt/os/include

.PHONY: libjerry clean

all: libjerry

libjerry:
mkdir -p $(BUILD_DIR)
mkdir -p $(LIBTARGET_DIR)
cmake -B$(BUILD_DIR) -H./ \
-DENABLE_LTO=OFF \
-DFEATURE_VALGRIND=OFF \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_external.cmake \
-DJERRY_LIBC=OFF \
-DJERRY_CMDLINE=OFF \
-DENABLE_ALL_IN_ONE=OFF \
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=armv7l \
-DEXTERNAL_CMAKE_C_COMPILER=arm-none-eabi-gcc \
-DEXTERNAL_CMAKE_C_COMPILER_ID=GNU \
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP) \
-DCMAKE_BUILD_TYPE=Release

make -C$(BUILD_DIR) jerry-core
make -C$(BUILD_DIR) jerry-libm
cp $(BUILD_DIR)/lib/libjerry-core.a $(LIBTARGET_DIR)
cp $(BUILD_DIR)/lib/libjerry-libm.a $(LIBTARGET_DIR)

clean:
rm -rf $(BUILD_DIR)
102 changes: 102 additions & 0 deletions targets/tizenrt-artik05x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
### About

This folder contains files to build and run JerryScript on [TizenRT](https://github.com/Samsung/TizenRT) with Artik05x board.

### How to build

#### 1. Set up build environment

* Install toolchain

Get the build in binaries and libraries, [gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar](https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update).


Untar the gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar and export the path like

```
$ tar xvf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar
$ export PATH=<Your Toolchain PATH>:$PATH
```

* Get the jerryscript and TizenRT sources

```
$ mkdir jerry-tizenrt
$ cd jerry-tizenrt
$ git clone https://github.com/jerryscript-project/jerryscript.git
$ git clone https://github.com/Samsung/TizenRT.git tizenrt
```

The following directory structure is created after these commands

```
jerry-tizenrt
├── jerryscript
└── tizenrt
```

#### 2. Add jerryscript configuration for TizenRT

```
$ cp -r jerryscript/targets/tizenrt-artik05x/apps/jerryscript/ tizenrt/apps/system/
$ cp -r jerryscript/targets/tizenrt-artik05x/configs/jerryscript/ tizenrt/build/configs/sidk_s5jt200/
```

Apply following diff in jerry-tizenrt/tizenrt/os/FlatLibs.mk.
(The line number may differ since tizenrt is under developing.)

```diff
--- a/os/FlatLibs.mk
+++ b/os/FlatLibs.mk
@@ -142,6 +142,12 @@ endif
# Add library for Framework
TINYARALIBS += $(LIBRARIES_DIR)$(DELIM)libframework$(LIBEXT)

+# Add library for Jerryscript
+ifeq ($(CONFIG_JERRYSCRIPT),y)
+TINYARALIBS += $(LIBRARIES_DIR)$(DELIM)libjerry-core$(LIBEXT)
+TINYARALIBS += $(LIBRARIES_DIR)$(DELIM)libjerry-libm$(LIBEXT)
+endif
+
# Export all libraries
```

#### 3. Configure TizenRT

```
$ cd tizenrt/os/tools
$ ./configure.sh sidk_s5jt200/jerryscript
```

#### 4. Build JerryScript for TizenRT

```
# assuming you are in jerry-tizenrt folder
$ cd jerryscript
$ make -f targets/tizenrt-artik05x/Makefile.tizenrt
```

#### 5. Build TizenRT binary

```
# assuming you are in jerry-tizenrt folder
$ cd tizenrt/os
$ make
```
Binaries are available in tizenrt/build/output/bin

#### 6. Flash binary

The official guide will be announced on [TizenRT page](https://github.com/Samsung/TizenRT).


#### 7. Run JerryScript

You can use `minicom` for terminal program, or any other you may like, but set
baud rate to `115200`.

(Note: Device path may differ like /dev/ttyUSB1.)

```
sudo minicom --device=/dev/ttyUSB0 --baud=115200
```
56 changes: 56 additions & 0 deletions targets/tizenrt-artik05x/apps/jerryscript/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

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

if 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"
default 100

config JERRYSCRIPT_STACKSIZE
int "Jerryscript stack size"
default 16384

config JERRYSCRIPT_HEAPSIZE
int "Jerryscript heap size"
default 107520

config JERRYSCRIPT_ERROR_MESSAGES
bool "Enable error messages for builtin error objects"
default n

config JERRYSCRIPT_MEM_STATS
bool "Enable memory statistics"
default n

config JERRYSCRIPT_SHOW_OPCODES
bool "Enable parser byte-code dumps"
default n

config JERRYSCRIPT_DEBUGGER
bool "Jerryscript debugger"
default n

if JERRYSCRIPT_DEBUGGER
config JERRYSCRIPT_DEBUGGER_PORT
int "Jerryscript debugger port"
default 5001
endif

endif
17 changes: 17 additions & 0 deletions targets/tizenrt-artik05x/apps/jerryscript/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ifeq ($(CONFIG_JERRYSCRIPT),y)
CONFIGURED_APPS += system/jerryscript
endif
Loading