56 Commits

Author SHA1 Message Date
Akos Kiss
a9c3ddff1f
Bump NuttX RTOS target to 7.27 (#2696)
Both documentation and travis makefile were referring to NuttX 7.22,
which was released in Sep 2017. This commit bumps the version to the
latest release (7.27, from Nov 2018).

Additionally, it also sets the stlink tool to a fixed (and tagged)
version.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-15 14:02:55 +01:00
Peter Marki
98aa08e33c Add subdir-level gitignore to the nuttx target directory (#2635)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-15 11:16:53 +01:00
Akos Kiss
adb80c2045 Update links in docs (#2691)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-11 18:57:30 +09:00
crazy2be
3afc4b0b85 Change jerry_port interface to allow for a correct implementation of timezones. (#2540)
The previous jerry_port interface did not allow timezones to be handled correctly,
even if the host system was up to the task. This PR changes the jerry_port interface
to allow a completely correct implementation to exist, and provides one (for Linux/BSD
systems) in default-date.c.

Fixes #1661

JerryScript-DCO-1.0-Signed-off-by: crazy2be crazy1be@gmail.com
2018-10-18 00:58:18 +02:00
Akos Kiss
3d3a8008a8 Don't use strlen for string literals (#2517)
Their length (size) is known at compile time. Therefore `sizeof`
is more efficient for them.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-17 10:07:24 +02:00
Akos Kiss
7639e613a4
Remove jerry-libc (#2332)
Rationale:
- There is no port under targets/ that would use it. All of them
  turn it off when building.
- That's no surprise, as jerry-libc supports no barebone MCUs but
  posix targets with syscalls only. Actually, that's Linux only,
  because macOS builds have turned off the use of jerry-libc a
  while ago.
- And there is no point in maintaining a highly restricted set of
  libc functions: as soon as someone wants to use JerryScript in a
  scenario that needs more functions than jerry-main, they have to
  choose a different libc (most problably the compiler's default
  one).

I think that we should not keep supporting an otherwise unused
library for the purposes of jerry-main on arm/x86/x64-linux  only.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-21 09:26:53 +02:00
Zoltan Herczeg
76ff084dc7 Move low-level debugger connection handling into jerry-ext. (#2426)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-19 10:14:43 +09:00
Istvan Miklos
ac9fce1d8d Merge jerry_get_value_without_error and jerry_value_clear_error_flag functions (#2350)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-25 11:40:35 +02:00
Akos Kiss
53bd845d9f Move (almost all) Travis CI jobs to container-based infrastructure (#2333)
Container-based VMs promise significantly faster boot times.

More or less related changes:
- Added a JOBNAME to all jobs.
- Added `install-noapt` target to several Makefile.travis files to
  avoid `sudo apt-get install ...` steps. Those installations are
  now handled by the apt addon of Travis. The `install` targets are
  kept anyway to keep the makefiles self-contained.
- Removed a legacy workaround from the Coverity Scan job as it
  isn't necessary anymore to fiddle with the cerificates of
  scan.coverity.com.
- Fixed the Mbed and the Zephyr jobs.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-16 19:15:15 +09:00
Istvan Miklos
ba2e49caaa Rename the jerry_value_has_error_flag function. (#2290)
Rename the function to represent it's real functionality.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-03 08:24:05 +02:00
Zoltan Herczeg
96b528a486
Rework jerry_parse function. (#2282)
Remove jerry_parse_named_resource, merge its arguments to jerry_parse
and change is_strict argument to an option list for possible future extensions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-17 09:51:52 +02:00
Roland Takacs
29b337d159 Eliminate early memory deallocations in case of NuttX and TizenRT (#2235)
The error value is released in the print_unhandled_exception function, however
that value is used and released later. This patch fixes this bug.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-03-06 08:22:22 +01:00
László Langó
88f7baa192 Fix build failure of NuttX tools (#2225)
The CI is broken after '164450f982',
because it cannot find 'aclocal-1.15'.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-27 10:12:05 +01:00
Péter Gál
6f339eb05c Introduce C API to query the type of an Error object (#2177)
New api function:
* jerry_get_error_type

Additionally update a few places where this new function
can be used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-06 09:41:54 +01:00
Roland Takacs
f833da2c13 Modify the build method of NuttX target. (#2154)
Modified the Makefile of the NuttX target to build only the application
file (targets/nuttx-stm32f4/jerry-main.c) and not the whole project.
It helps to build JerryScript separately and use the static libs when
building NuttX.
Also modified the README.md to describe the new build process.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-09 09:34:01 +01:00
rerobika
6c06a309c1 Fixed dynamic-stack-buffer-overflow in jerry_value_is_syntax_error (#2095)
Fixes issue #2094, which introduced an error caused by jerry_value_is_syntax_error.
The problem was that the function used strcmp instead of strncmp while checking if err_str_buf contains syntax error and it caused buffer overflow.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-17 11:39:11 +01:00
Akos Kiss
da24727824 Add Travis CI jobs for build testing several targets (#2102)
Hitherto, code under the `targets` directory was not tested and so
its maintenance was sometimes speculative. This commit adds build
testing for several targets to prevent them from bit rotting.
Targets covered by this commit are: ESP8266, Mbed, Mbed OS 5,
NuttX, RIOT, Tizen RT, and Zephyr.

Some issues were revealed and fixed:
- ESP8266: added missing include for `uint32_t` typedef.
- Tizen RT: replaced missing `str_to_uint` with `strtol`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 13:29:23 +01:00
Akos Kiss
d0143adc82 Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER (#2036)
* Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER

All feature guards of jerry-core are deciding about the inclusion
or exclusion of a feature based on the state (defined or undefined)
of a macro -- except for the JS parser guard, which requires
`JERRY_JS_PARSER` to be defined with a value of either 0 or 1. This
has some issues:
- The engine cannot be built with a "clean" compiler invocation,
  i.e., without any `-D` command line macro definitions. This is
  painful for targets that must use a different build system from
  the project's own python/cmake-based one.
- Some build systems in targets and even some code in jerry-code
  are already confused about the different semantics of
  `JERRY_JS_PARSER`, and simply define it without a value and make
  decisions based on the macro being simply defined or not.

This patch renames the guard to `JERRY_DISABLE_JS_PARSER` and makes
use of it in jerry-core based on its state, not based on its value.
As obvious from the guard name, the default for the JS parser is
that it is included in the build.

The patch also touches those targets in the repository that
explicitly defined the original macro (correctly or incorrectly).

* Make cppcheck verbose

Cppcheck can be quite slow sometimes, especially on Travis CI,
which has a "10 mins without output means failure" rule. As the
code base of the project grows, we start to undeterministically
fall over that limit. Thus, this PR makes cppcheck verbose to
ensure that it keeps Travis CI continuously fed with output.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-17 17:11:54 +02:00
Zsolt Borbély
1cc7cb58ce Enable promise builtin for nuttx-stm32f4 target (#2033)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-10-04 15:46:18 +02:00
László Langó
a54427e255 Followup changes in JerryScript debugger after #1910.
* Remove 'jerry_debugger_cleaup'. Do it automatically in 'jerry_cleanup'.
* Updated the documentations.
* Updated the NuttX and Artik053 targets.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-09-07 17:26:03 +09:00
Robert Sipka
ddbe067dee Set log level to JERRY_LOG_LEVEL_DEBUG when using show-opcodes on nuttx-stm32f4 target (#1869)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-06-01 08:51:15 +09:00
Robert Sipka
04f3bf62b0 Set log level to JERRY_LOG_LEVEL_DEBUG when using mem-stats. (#1843)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-22 12:58:40 +02:00
Sanggyu Lee
91b06726bb Include jerry-ext/handler only in nuttx-stm32f4 target (#1816)
I included jerry-ext/handler only, rather than including all in jerry-ext.
Currently only handler is used in nuttx-stm32f4 repl.
nuttx.bin binary size is reduced from 231576 to 230456 bytes.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-12 15:17:11 +02:00
Robert Sipka
7d133e55e4 Use external print, gc and assert handlers in nuttx-stm32f4 target (#1813)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-11 07:26:10 +02:00
Akos Kiss
240411771a Remove the built-in print and the jerry_port_console port API functions (#1749)
The built-in `print` is removed from jerry-core, but an external
`print` implementation is added to jerry-main. From now on, all
embedders of the engine have to implement their own `print` if they
need such a functionality.

For printing results in REPL mode of jerry-main, the external
`print` handler is called directly instead of looking up the `print`
function registered into the global object. (The two are the same,
but the indirection is not needed anymore.)

Because jerry-core does not contain `print` anymore,
`jerry_port_console` is removed from the port API. The default port
is updated, i.e., the implementation of `jerry_port_console` is
removed. Additionally, all references to `jerry_port_console` in
jerry-main are replaced by `printf`.

Speculatively, `jerry_port_console` is also removed from all
non-default targets. Most targets implemented it for the sake of the
engine only; in those targets the removal was trivial. Where the
function was called from the embedder application as well, the
calls were replaced with equivalents (e.g., `printf`, `printk`).

NOTE 1: This is a breaking change!

NOTE 2: This patch still leaves several targets without a JS `print`
implementation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-03 11:47:56 +02:00
Akos Kiss
6c3a6e7be3 Rename jerry-port.h to jerryscript-port.h (#1762)
All public headers should follow the pattern `jerryscript[-*].h`.
The `jerry-api.h` to `jerryscript.h` renaming has already happened
a while ago, now it's time for the port API header to follow.

This patch
* renames the public header file,
* updates all includes to use the new file name (in `jerry-main`,
  in all the targets, and in the docs), and
* keeps `jerry-port.h` as a deprecated forwarding header to leave
  some time for external users to follow up with this change.

As a related change, the header of the default port implementation
is also changed to `jerryscript-port-default.h`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-22 10:53:12 +09:00
Roland Takacs
5231829fc9 Enable dummy time zone in nuttx-stm32f4 target. (#1760)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
2017-04-21 18:09:11 +09:00
Robert Sipka
5271214623 Support error messages on nuttx-stm32f4 target (#1754)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-21 09:48:58 +09:00
Zsolt Borbély
befa7a88fe [nuttx-stm32f4] Use jerry-libm instead of the math library in NuttX (#1744)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-19 10:22:48 +02:00
Robert Sipka
8d99e73db3 Add setjmp and longjmp functions for nuttx-stm32f4 target. (#1743)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-19 07:10:05 +09:00
Robert Sipka
605e9847d2 Add testing support for nuttx-stm32f4 target (#1733)
Provide the 'assert' and 'gc' implementation for the engine.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-13 14:09:31 +02:00
Robert Sipka
95809cd977 Buildfix for nuttx-stm32f4 target (#1732)
The `jerry_port_jobqueue_enqueue` function is undefined on this target.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-13 20:47:00 +09:00
Levente Orban
a83319cfa1 Fix the stlink binary path (#1726)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-04-12 14:45:58 +02:00
Tilmann Scheller
f8dd54abb6 Fix old-style function definitions and enable warning. (#1651)
Function definitions with no parameters should always use the void keyword to allow the compiler to catch invalid calls of those functions at compile time.

Enable -Wold-style-definition to catch this early in the future.

Fixes #1649.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2017-03-09 13:41:26 +01:00
Robert Sipka
993f1ce896 Set available features from nuttx menuconfig (nuttx-stm32f4 target). (#1607)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-22 12:36:31 +01:00
Robert Sipka
9043ec620d Add debugger support on nuttx-smt32f4 target (#1591)
Using jerry_parse_named_resource to parse script and construct an EcmaScript function.
The file name will also passed to this function which is used by the debugger to find
the source code.
Run the constructed EcmaScript function instead of using the simple jerry runner.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-21 15:22:48 +01:00
Robert Sipka
68afd14f7c Add --start_debug_server cmdline argument to nuttx-stm32f4 target (#1586)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-16 14:19:51 +01:00
Robert Sipka
fdd31f20b5 Add print_help function to nuttx-stm32f4 target (#1584)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-16 12:49:49 +01:00
Péter Gál
75d8226af3 Add jerryscript.h and mark jerry-api.h as deprecated (#1579)
Add a notification for JerryScript API users that the jerry-api.h
will be removed in the future and should use the jerryscript.h
header instead.

Also update the examples in the docs and the targets where
the jerry-api.h is used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-02-16 08:46:08 +01:00
Robert Sipka
f3436840dd Build fix for STM32F4-Discovery board with NuttX. (#1489)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-13 15:12:55 +01:00
Tilmann Scheller
0511091e8a Streamline copyright notices across the codebase. (#1473)
Since the project is now hosted at the JS Foundation we can move to unified copyright notices for the project.

Starting with this commit all future contributions to the project should only carry the following copyright notice (except for third-party code which requires copyright information to be preserved):

"Copyright JS Foundation and other contributors, http://js.foundation" (without the quotes)

This avoids cluttering the codebase with contributor-specific copyright notices which have a higher maintenance overhead and tend to get outdated quickly. Also dropping the year from the copyright notices helps to avoid yearly code changes just to update the copyright notices.

Note that each contributor still retains full copyright ownership of his/her contributions and the respective authorship is tracked very accurately via Git.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-12-08 06:39:11 +01:00
Tilmann Scheller
813a7020af Update various repository references across the project to be in sync with the new repository location. (#1448)
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-11-25 10:34:22 +01:00
Zsolt Borbély
9ca78d380f [nuttx-stm32f4] Fix jerry_port_log function
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-09-01 12:51:27 +02:00
Zsolt Borbély
18f9308cd6 Minor stylefix for targets/nuttx-stm32f4/README.md
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-08-31 09:47:30 +02:00
Zsolt Borbély
1e82ae1eb5 Update the nuttx-stm32f4 target
Related issue: #1202

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-08-26 15:38:14 +02:00
Akos Kiss
a2d5acb43c Follow-up refactoring of logging-related parts
This patch:
* Ensures that all calls to `jerry_port_log` in jerry-core happen
  via macros defined in jrt.h. Also, it unifies the names of those
  macros: as `JERRY_ERROR_MSG` and `JERRY_WARNING_MSG` gave a good
  pattern that was well aligned with the naming scheme of the log
  level enum, `JERRY_DLOG` and `JERRY_DDLOG` were rewritten to
  `JERRY_DEBUG_MSG` and `JERRY_TRACE_MSG`.
* Ensures that all debug logging code parts of jerry-core (i.e.,
  memory statistics, JS byte-code dumps, and RegExp byte-code
  dumps) are guarded by macros: `JMEM_STATS`,
  `PARSER_DUMP_BYTE_CODE`, and `REGEXP_DUMP_BYTE_CODE`, which in
  turn are controled by cmake build system feature flags
  `FEATURE_MEM_STATS`, `FEATURE_PARSER_DUMP`, and
  `FEATURE_REGEXP_DUMP`.
* Ensures that all debug logging functionalities can be controled
  during run time (provided that they were enabled during build
  time): the engine has `JERRY_INIT_MEM_STATS[_SEPARATE]`,
  `JERRY_INIT_SHOW_OPCODES`, `JERRY_INIT_SHOW_REGEXP_OPCODES` init
  flags, and the default unix/linux command line app has
  corresponding command line switches.`
* Drops `FEATURE_LOG`, `JERRY_ENABLE_LOG`, and
  `JERRY_INIT_ENABLE_LOG`, as their name was misleadingly general,
  even though they mostly controled the regexp engine only. The
  above-mentioned `*REGEXP*` things mostly act as their
  replacements.
* Updates build, test, and measurement tool scripts, and
  documentation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-11 22:00:12 +02:00
Akos Kiss
d5eb2f0be1 Let the build script use a default for toolchain
The `cmake` directory already contains several toolchain files for
various platforms (operating system + architecture). However,
`tools/build.py` does not define a toolchain file for cmake unless
explicitly specified. This patch changes the script to look into
the `cmake` directory for a file named
`toolchain_$(os)_$(arch).cmake` and, if found, pass that to cmake
by default.

OS and arch are determined by `os.uname()`. As Linux on Raspberry
Pi identifies itself as "armv7l", the legacy "armv7l-hf" arch name
is shortened to "armv7l". This way, building jerry on RPi
(natively, not cross) becomes possible by simply running
`tools/build.py` without any extra options.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-08 13:42:59 +02:00
László Langó
fa94c67ee7 Implement IO port API
Related issue: #964

Implemented the IO API of Jerry ports. Removed log file from API level.
The port implementation should define the destination of log messages.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-07-14 13:15:30 +02:00
Akos Kiss
33a1203d6b Drop jerry_port_putchar
Recent changes eliminate the need for `jerry_port_putchar`. As port
API discussions don't make it likely that it will ever be needed
again, this patch removes its declaration from jerry-port.h and its
implementations from the port(s).

The related code in jerry-libc is not needed either: whatever `putc`
(and `puts`) can do, `printf` can do as well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-23 22:50:50 +02:00
Akos Kiss
02ba19f24d Introduce the Termination Port API
* Moved the error codes to jerry-port.h and declared port function
  `jerry_port_fatal`.

* Moved "exit or abort on fail" functionality to the newly added
  jerry-port-default-fatal.c.

* This implied that a default port-specific API had to be introduced:
  functions `jerry_port_default_set_abort_on_fail` and
  `jerry_port_default_is_abort_on_fail` declared in jerry-port-default.h
  control the fatal exit behaviour.

* For the sake of clarity, renamed jerry-port.c to
  jerry-port-default-io.c.

* Adapted CMakeLists to deal with port implementations consisting of
  more then one source file and exposing headers. This also required
  the renaming of `EXTERNAL_PORT_FILE` cmake option to
  `EXTERNAL_PORT_DIR`.

* Adapted main sources to use the default port header for the
  abort-on-fail functionality, as that is not part of the core jerry
  API anymore.

* Added default port implementation to the static source code checker
  tools.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-19 14:10:18 +02:00