Modify the build method of TizenRT target
Introduced a cmake/toolchain_mcu_artik053.cmake file that defines all the target specific compiler options. Modified the Makefile.tizenrt to do not copy the created static libraries to the TizenRT folder. Instead, the application builder Makefile (tizenrt-artik053/apps/jerryscript/Makefile) copies the required static libraries to TizenRT. JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
This commit is contained in:
@@ -13,15 +13,8 @@
|
||||
# limitations under the License.
|
||||
|
||||
JERRYHEAP ?= 16
|
||||
BUILD_DIR ?= build/tizenrt-artik053
|
||||
LIBTARGET_DIR ?= $(abspath $(PWD)/../TizenRT/build/output/libraries)
|
||||
BUILD_DIR ?= build
|
||||
|
||||
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
|
||||
@@ -29,25 +22,17 @@ EXT_CFLAGS += -I. -isystem ../TizenRT/os/include
|
||||
all: libjerry
|
||||
|
||||
libjerry:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
mkdir -p $(LIBTARGET_DIR)
|
||||
cmake -B$(BUILD_DIR) -H./ \
|
||||
-DCMAKE_SYSTEM_NAME=TizenRT \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=armv7l \
|
||||
-DCMAKE_C_COMPILER=arm-none-eabi-gcc \
|
||||
-DCMAKE_C_COMPILER_WORKS=TRUE \
|
||||
-DENABLE_LTO=OFF \
|
||||
-DENABLE_ALL_IN_ONE=OFF \
|
||||
-DJERRY_LIBC=OFF \
|
||||
-DJERRY_CMDLINE=OFF \
|
||||
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
|
||||
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP) \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_mcu_artik053.cmake
|
||||
|
||||
make -C$(BUILD_DIR) jerry-core jerry-libm jerry-ext
|
||||
cp $(BUILD_DIR)/lib/libjerry-core.a $(LIBTARGET_DIR)
|
||||
cp $(BUILD_DIR)/lib/libjerry-libm.a $(LIBTARGET_DIR)
|
||||
cp $(BUILD_DIR)/lib/libjerry-ext.a $(LIBTARGET_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
@@ -81,6 +81,22 @@ $ mkdir res
|
||||
|
||||
#### 5. Build JerryScript for TizenRT
|
||||
|
||||
```
|
||||
# assuming you are in jerry-tizenrt folder
|
||||
jerryscript/tools/build.py \
|
||||
--clean \
|
||||
--lto=OFF \
|
||||
--jerry-cmdline=OFF \
|
||||
--jerry-libc=OFF \
|
||||
--all-in-one=OFF \
|
||||
--mem-heap=70 \
|
||||
--profile=es2015-subset \
|
||||
--compile-flag="--sysroot=${PWD}/TizenRT/os" \
|
||||
--toolchain=${PWD}/jerryscript/cmake/toolchain_mcu_artik053.cmake
|
||||
```
|
||||
|
||||
**Note**: there is a Makefile in the `targets/tizenrt-artik053/` folder that also helps to build JerryScript for TizenRT.
|
||||
|
||||
```
|
||||
# assuming you are in jerry-tizenrt folder
|
||||
$ cd jerryscript
|
||||
|
||||
@@ -27,23 +27,4 @@ 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
|
||||
endif
|
||||
endif # JERRYSCRIPT
|
||||
|
||||
@@ -67,40 +67,28 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# Jerryscript built-in application info
|
||||
|
||||
# JerryScript built-in application information.
|
||||
CONFIG_JERRYSCRIPT_PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
||||
CONFIG_JERRYSCRIPT_PROGNAME ?= jerry$(EXEEXT)
|
||||
CONFIG_JERRYSCRIPT_STACKSIZE ?= 32768
|
||||
CONFIG_JERRYSCRIPT_HEAPSIZE ?= 64000
|
||||
|
||||
APPNAME = jerry
|
||||
# path to the project dir, "tizenrt-artik053" by default
|
||||
ROOT_DIR = ../../../..
|
||||
PRIORITY = $(CONFIG_JERRYSCRIPT_PRIORITY)
|
||||
PROGNAME = $(CONFIG_JERRYSCRIPT_PROGNAME)
|
||||
STACKSIZE = $(CONFIG_JERRYSCRIPT_STACKSIZE)
|
||||
CFLAGS += -std=c99 -DJERRY_NDEBUG '-DCONFIG_MEM_HEAP_AREA_SIZE=$(CONFIG_JERRYSCRIPT_HEAPSIZE)'
|
||||
CFLAGS += -I$(ROOT_DIR)/ $(shell find $(ROOT_DIR)/jerryscript/jerry-core -type d | sed -r -e 's/^/-I/g')
|
||||
CFLAGS += -I$(ROOT_DIR)/jerryscript/jerry-ext/include
|
||||
|
||||
ifeq ($(CONFIG_JERRYSCRIPT_MEM_STATS),y)
|
||||
CFLAGS += -DJMEM_STATS
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_JERRYSCRIPT_SHOW_OPCODES),y)
|
||||
CFLAGS += -DPARSER_DUMP_BYTE_CODE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_JERRYSCRIPT_DEBUGGER),y)
|
||||
CFLAGS += -DJERRY_DEBUGGER
|
||||
endif
|
||||
# Path to the JerryScript project. If not specified, it is supposed
|
||||
# that JerryScript is located next to the TizenRT folder.
|
||||
JERRYSCRIPT_ROOT_DIR ?= ../../../../jerryscript
|
||||
|
||||
CFLAGS += -std=c99
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-core/include
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-ext/include
|
||||
|
||||
EXTRA_LIBS += libjerry-core.a libjerry-libm.a
|
||||
LINKLIBS=$(EXTRA_LIBS)
|
||||
|
||||
|
||||
APPNAME = jerry
|
||||
ASRCS = setjmp.S
|
||||
CSRCS =
|
||||
MAINSRC = jerry_main.c
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
@@ -130,8 +118,6 @@ else
|
||||
INSTALL_DIR = $(BIN_DIR)
|
||||
endif
|
||||
|
||||
CONFIG_JERRYSCRIPT_PROGNAME ?= jerry$(EXEEXT)
|
||||
PROGNAME = $(CONFIG_JERRYSCRIPT_PROGNAME)
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
||||
@@ -139,8 +125,9 @@ ROOTDEPPATH = --dep-path .
|
||||
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
||||
all: copylibs .built
|
||||
.PHONY: copylibs context depend clean distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
@@ -152,6 +139,9 @@ $(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
copylibs:
|
||||
cp $(JERRYSCRIPT_ROOT_DIR)/build/lib/lib*.a $(TOPDIR)/../build/output/libraries/
|
||||
|
||||
install:
|
||||
|
||||
context:
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "jerryscript.h"
|
||||
#include "jerryscript-ext/handler.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jmem.h"
|
||||
#include "setjmp.h"
|
||||
|
||||
#include <apps/shell/tash.h> // To register tash command
|
||||
@@ -63,7 +62,7 @@ print_help (char *name)
|
||||
/**
|
||||
* Read source code into buffer.
|
||||
*
|
||||
* Returned value must be freed with jmem_heap_free_block if it's not NULL.
|
||||
* Returned value must be freed if it's not NULL.
|
||||
* @return NULL, if read or allocation has failed
|
||||
* pointer to the allocated memory block, otherwise
|
||||
*/
|
||||
@@ -96,7 +95,7 @@ read_file (const char *file_name, /**< source code */
|
||||
|
||||
rewind (file);
|
||||
|
||||
uint8_t *buffer = jmem_heap_alloc_block_null_on_error (script_len);
|
||||
uint8_t *buffer = (uint8_t *) malloc (script_len);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
@@ -110,7 +109,7 @@ read_file (const char *file_name, /**< source code */
|
||||
if (!bytes_read || bytes_read != script_len)
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Error: failed to read file: %s\n", file_name);
|
||||
jmem_heap_free_block ((void*) buffer, script_len);
|
||||
free ((void*) buffer);
|
||||
|
||||
fclose (file);
|
||||
return NULL;
|
||||
@@ -458,12 +457,12 @@ jerry_cmd_main (int argc, char *argv[])
|
||||
if (jerry_value_has_error_flag (ret_value))
|
||||
{
|
||||
print_unhandled_exception (ret_value, source_p);
|
||||
jmem_heap_free_block ((void*) source_p, source_size);
|
||||
free ((void*) source_p);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
jmem_heap_free_block ((void*) source_p, source_size);
|
||||
free ((void*) source_p);
|
||||
|
||||
jerry_release_value (ret_value);
|
||||
ret_value = jerry_create_undefined ();
|
||||
|
||||
Reference in New Issue
Block a user