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
..

About

This folder contains files to run JerryScript on STM32F4-Discovery board with NuttX

How to build

1. Setting up the build environment for STM32F4-Discovery board

Clone JerryScript and NuttX into jerry-nuttx directory

mkdir jerry-nuttx
cd jerry-nuttx
git clone https://github.com/jerryscript-project/jerryscript.git
git clone https://bitbucket.org/nuttx/nuttx.git
git clone https://bitbucket.org/nuttx/apps.git
git clone https://github.com/texane/stlink.git

The following directory structure is created after these commands

jerry-nuttx
  + apps
  + jerryscript
  |  + targets
  |      + nuttx-stm32f4
  + nuttx
  + stlink

2. Adding JerryScript as an interpreter for NuttX

cd apps/interpreters
mkdir jerryscript
cp ../../jerryscript/targets/nuttx-stm32f4/* ./jerryscript/

3. Configure NuttX

# assuming you are in jerry-nuttx folder
cd nuttx/tools

# configure NuttX USB console shell
./configure.sh stm32f4discovery/usbnsh

cd ..
# might require to run "make menuconfig" twice
make menuconfig

We must set the following options:

  • Change Build Setup -> Build Host Platform from Windows to Linux
  • Enable System Type -> FPU support
  • Enable Application Configuration -> Interpreters -> JerryScript

If you get kconfig-mconf: not found error when you run make menuconfig you may have to install kconfig-frontends:

# assume you are in jerry-nuttx folder
sudo apt-get install gperf flex bison libncurses-dev
git clone https://github.com/jameswalmsley/kconfig-frontends.git
cd kconfig-frontends
./bootstrap
./configure --enable-mconf
make
sudo make install
sudo ldconfig

4. Build JerryScript for NuttX

# assuming you are in jerry-nuttx folder
cd nuttx/
make

5. Flashing

Connect Mini-USB for power supply and connect Micro-USB for NSH console.

To configure stlink utility for flashing, follow the instructions in the official Stlink repository.

To flash,

# assuming you are in nuttx folder
sudo ../stlink/build/Release/st-flash write nuttx.bin 0x8000000

Running JerryScript

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

sudo minicom --device=/dev/ttyACM0 --baud=115200

You may have to press RESET on the board and press Enter keys on the console several times to make nsh prompt to appear.

If the prompt shows like this,

NuttShell (NSH)
               nsh>
                    nsh>
                         nsh>

please set Add Carriage Ret option by CTRL-A > Z > U at the console, if you're using minicom.

Run jerry with javascript file(s)

NuttShell (NSH)
nsh> jerry full_path/any.js

Without argument it prints:

nsh> jerry
No input files, running a hello world demo:
Hello world 5 times from JerryScript