Skip to content

Change tizenrt-artik05x port reference board to artik053 #1904

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
Jul 19, 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
11 changes: 8 additions & 3 deletions targets/tizenrt-artik05x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jerry-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/
$ cp -r jerryscript/targets/tizenrt-artik05x/configs/jerryscript/ tizenrt/build/configs/artik053/
```

Apply following diff in jerry-tizenrt/tizenrt/os/FlatLibs.mk.
Expand All @@ -55,6 +55,7 @@ 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-ext$(LIBEXT)
+TINYARALIBS += $(LIBRARIES_DIR)$(DELIM)libjerry-libm$(LIBEXT)
+endif
+
Expand All @@ -65,7 +66,7 @@ TINYARALIBS += $(LIBRARIES_DIR)$(DELIM)libframework$(LIBEXT)

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

#### 4. Build JerryScript for TizenRT
Expand All @@ -87,7 +88,11 @@ 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).
```
make download ALL
```

For more information, see [How to program a binary](https://github.com/Samsung/TizenRT/blob/master/build/configs/artik053/README.md).


#### 7. Run JerryScript
Expand Down
40 changes: 8 additions & 32 deletions targets/tizenrt-artik05x/apps/jerryscript/jerry_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,6 @@ jerry_value_is_syntax_error (jerry_value_t error_value) /**< error value */
return false;
} /* jerry_value_is_syntax_error */

/**
* Convert string into unsigned integer
*
* @return converted number
*/
static uint32_t
str_to_uint (const char *num_str_p) /**< string to convert */
{
assert (jerry_is_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES));

uint32_t result = 0;

while (*num_str_p != '\0')
{
assert (*num_str_p >= '0' && *num_str_p <= '9');

result *= 10;
result += (uint32_t) (*num_str_p - '0');
num_str_p++;
}

return result;
} /* str_to_uint */

/**
* Print error value
*/
Expand Down Expand Up @@ -218,18 +194,18 @@ print_unhandled_exception (jerry_value_t error_value, /**< error value */

if (jerry_is_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES) && jerry_value_is_syntax_error (error_value))
{
uint32_t err_line = 0;
uint32_t err_col = 0;
unsigned int err_line = 0;
unsigned int err_col = 0;

/* 1. parse column and line information */
for (uint32_t i = 0; i < sz; i++)
for (jerry_size_t i = 0; i < sz; i++)
{
if (!strncmp ((char *) (err_str_buf + i), "[line: ", 7))
{
i += 7;

char num_str[8];
uint32_t j = 0;
unsigned int j = 0;

while (i < sz && err_str_buf[i] != ',')
{
Expand All @@ -239,7 +215,7 @@ print_unhandled_exception (jerry_value_t error_value, /**< error value */
}
num_str[j] = '\0';

err_line = str_to_uint (num_str);
err_line = (unsigned int) strtol (num_str, NULL, 10);

if (strncmp ((char *) (err_str_buf + i), ", column: ", 10))
{
Expand All @@ -257,17 +233,17 @@ print_unhandled_exception (jerry_value_t error_value, /**< error value */
}
num_str[j] = '\0';

err_col = str_to_uint (num_str);
err_col = (unsigned int) strtol (num_str, NULL, 10);
break;
}
} /* for */

if (err_line != 0 && err_col != 0)
{
uint32_t curr_line = 1;
unsigned int curr_line = 1;

bool is_printing_context = false;
uint32_t pos = 0;
unsigned int pos = 0;

/* 2. seek and print */
while (source_p[pos] != '\0')
Expand Down
78 changes: 45 additions & 33 deletions targets/tizenrt-artik05x/configs/jerryscript/Make.defs
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
############################################################################
# configs/stm32_tiny/nsh/Make.defs
# 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.
#
# This file is based on work under the following copyright and permission
# notice:
#
############################################################################
# Copyright 2017 Samsung Electronics All Rights Reserved.
#
# 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strange copyright/license block. Don't we add all code under the "JS Foundation and other contributors" copyright only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosthekiss At first, I added the JS foundation license since I thought all new/modified code in jerryscript project must have JS foundation license. Is it right? If not, could you give me the license rule? Anyway, for this case, I found that I did not modified Make.defs. (I modified defconfig only.) So I can remove the JS foundation license. Thank you for review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosthekiss I've updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glistening It seems that now the "JS Foundation and other contributors" copyright clause is gone and got replaced by company copyright notice. This should happen the other way around.

When the project was transferred to the Foundation, all "top-level" individual and company copyright notices were replaced by the catch-all "Copyright JS Foundation and other contributors" notice. (There are some files that have been imported into the project from external sources with non-Apache2 but compatible licenses. There, there appropriate notices are preserved below the Apache2 license block, see jerry-libm/*.c or jerry-core/ecma/base/ecma-helpers-errol.c. Thus the reference to "top-level" notices.) This has been documented in the Contribution Guidelines as well: https://github.com/jerryscript-project/jerryscript/blob/master/CONTRIBUTING.md#2-ensure-all-files-have-a-proper-license-header-and-copyright-notice

Any code that you want to contribute to the project must be licensed under the Apache License 2.0. Contributions under a different license can not be accepted.
Adding copyright notices other than the project-wide notice ("Copyright JS Foundation and other contributors, http://js.foundation") is not permitted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosthekiss I got it. You don't want to keep NuttX license in jerryscript project since the project only permits Apache2 license. Then, I have another question. What is the difference between this case and https://github.com/jerryscript-project/jerryscript/tree/master/third-party/valgrind/memcheck.h (or valgrind.h)? If these are Apache2 compatible licenses, NuttX seems to be also compatible when I take a close look into each clauses.

Copy link
Member

@akosthekiss akosthekiss Jul 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glistening Well, that's not exactly what I was trying to say. This commit tries to add an Apache 2.0 license header with a Copyright 2017 Samsung Electronics All Rights Reserved. notice. But that's explicitly prohibited by the contribution guidelines (as linked and quoted in my above comment). The Apache 2.0 license header must be accompanied by the Copyright JS Foundation and other contributors, http://js.foundation project-wide notice:

Adding copyright notices other than the project-wide notice ("Copyright JS Foundation and other contributors, http://js.foundation") is not permitted.

As for BSD or BSD-like licenses (e.g., the NuttX license): I did not want to suggest its removal (I think that would explicitly go against the provisions of BSD3.) Such a compatible license block (together with its copyright notice) can be kept below the Apache 2.0 license block (that's why I referred to jerry-libm and ecma-helpers-errol.c, which also contain an additional - although not BSD but other Apache 2.0 compatible - license block). Fortunately, this is permitted by our guidelines:

The only exception is adding third-party code which requires copyright notices to be preserved.

As for the third-party/valgrind library: I don't exactly know the history of that part. It's been there for a while and has not been touched since it's addition in 2014. I don't really know why it was not touched when the project was transferred to JS Foundation. However, I do think that any new code/contribution should follow the current guidelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosthekiss First, thank you again for explanation. By the way, I did not add the header with a Copyright 2017 Samsung Electronics All Rights Reserved. The header came from the base file in TizenRT. I just added JS Foundation license only. The result was my first commit like following:

JS Foundation license (Apache2 : for conforming jerryscript license rule)
Samsung license (Apache2 : from TizenRT)
NuttX license (BSD-like : from NuttX)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosthekiss I've updated this PR like the above. Please give me comment if this PR needs further correction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glistening Ah, so. It was not evident to me from the original PR comment(s). Your explanation clarifies things, thanks.

#
############################################################################
############################################################################
# configs/artik053/tash/Make.defs
#
# Copyright (C) 2011, 2012-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <[email protected]>
Expand Down Expand Up @@ -37,14 +71,8 @@ include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-r/Toolchain.defs

ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
ifeq ($(CONFIG_BOARD_FOTA_SUPPORT),y)
LDSCRIPT_OTA1 = ld_s5jt200_flash_ota1.script
endif
LDSCRIPT = ld_s5jt200_flash.script
else
LDSCRIPT = ld_s5jt200.script
endif
LDSCRIPT = flash.ld

ifeq ($(CONFIG_UCLIBCXX_HAVE_LIBSUPCXX),y)
LIBSUPXX = ${shell $(CC) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
Expand All @@ -65,9 +93,6 @@ else
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/../framework/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(TOPDIR)/include/uClibc++
ARCHSCRIPT = -T$(TOPDIR)/../build/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
ifeq ($(CONFIG_BOARD_FOTA_SUPPORT),y)
ARCHSCRIPT_FOTA = -T$(TOPDIR)/../build/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT_OTA1)
endif

endif

Expand Down Expand Up @@ -96,41 +121,32 @@ ifeq ($(CONFIG_FRAME_POINTER),y)
ARCHOPTIMIZATION += -fno-omit-frame-pointer -mapcs -mno-sched-prolog
endif

ifeq ($(CONFIG_ARM_UNWIND),y)
ARCHOPTIMIZATION += -fasynchronous-unwind-tables
endif


ARCHCFLAGS = -fno-builtin -mcpu=cortex-r4 -mfpu=vfpv3
ARCHCXXFLAGS = -fno-builtin -fexceptions -mcpu=cortex-r4 -mfpu=vfpv3
ifeq ($(QUICKBUILD),y)
ARCHWARNINGS = -Wall -Werror -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
ARCHWARNINGSXX = -Wall -Werror -Wshadow -Wundef
else
#ARCHWARNINGS = -Wall -Werror -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
#ARCHWARNINGSXX = -Wall -Werror -Wshadow -Wundef
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHWARNINGS = -Wall -Werror -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
ARCHWARNINGSXX = -Wall -Werror -Wshadow -Wundef
# only version 4.9 supports color diagnostics
ifeq "$(ARCHMAJOR)" "4"
ifeq "$(ARCHMINOR)" "9"
ARCHWARNINGS += -fdiagnostics-color=auto
ARCHWARNINGSCC += -fdiagnostics-color=auto
ARCHWARNINGS += -fdiagnostics-color=auto
ARCHWARNINGSCC += -fdiagnostics-color=auto
endif
endif

endif
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -ffunction-sections -fdata-sections
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
MAXOPTIMIZATION = -O2


NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
Expand All @@ -148,18 +164,14 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

LDFLAAGS += --gc-sections

HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =

#################### SIDK_S5JT200 DOWNLOAD LOGIC ###################################
# function : DOWNLOAD
# prototype : DOWNLOAD <arguments>
# arguments : [ALL | RESOURCE ]
# example : DOWNLOAD ALL; DOWNLOAD RESOURCE;
define DOWNLOAD
@$(TOPDIR)/../build/configs/$(CONFIG_ARCH_BOARD)/$(CONFIG_ARCH_BOARD)_download.sh $(1)
@$(TOPDIR)/../build/configs/artik053/artik053_download.sh $(1)
endef
#################### END #######################################################

Loading