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:
Roland Takacs
2018-01-09 11:27:51 +01:00
committed by yichoi
parent ded0d5a846
commit 680bafdc8c
6 changed files with 63 additions and 70 deletions
@@ -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 ();