Akos Kiss 91e976f8c7 Move jerry-core API implementations and headers into dedicated subdirectories (#1793)
Moved all public API headers under the `jerry-core/include`
directory. This makes installing all the public headers easier.
Also, should we have new public headers in the future, their
installation will be automatic, there will be no need to update the
build files. Moreover, this aligns better with the structure of
other libraries in the project (in those cases, public headers
always reside in `<library>/include`).

Moved all public API implementations under the `jerry-core/api`
directory. This cleans up the root directory of `jerry-core`,
moving all implementation code under "modules", i.e.,
subdirectories. This also makes the future splitting of the big and
monolithic `jerry.c` along features easier, if needed. (Debugger
and snapshot-related functions are already in separate sources.)

Notes:
* `jerryscript.h` is split up to separate header files along
  feature boundaries. These new headers are included by
  `jerryscript.h`, so this is not a breaking change but header
  modularization only.
* `jerry-snapshot.h` is still under `jerry-core/api`, keeping it as
  a non-public header.
* This commit also adapts all targets to the include path change.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-04 15:28:24 +02:00
..
2016-05-06 13:33:26 +02:00
2016-10-27 09:54:01 +02:00

This folder contains files to run JerryScript in mbed / for:

  • Freedom-K64F (k64)
  • Discovery-STM32F4 (stm32f4)
  • Discovery-STM32F429ZI (stm32f429i)
  • Nucleo-F401RE (nucleo)

####Yotta You need to install yotta before proceeding. Please visit Yotta docs page.

####Cross-compiler For cross-compilation the GCC 5.2.1 is suggested to be used. All the supported targets were tested with this version. If you don't have any GCC compiler installed, please visit this page to download GCC 5.2.1.

####How to build a target Navigate to your JerryScript root folder (after you cloned this repository into the targets folder) and use the following command:

make -f targets/mbed/Makefile.mbed board=$(TARGET)

Where the $(TARGET) is one of the following options: k64f, stm32f4, stm32f429i or nucleo. This command will create a new folder for your target and build the jerryscript and mbed OS into that folder.

####How to build a completely new target If you want to build a new target (which is not available in this folder) you have to modify the makefile. You have to add the new board name to the TARGET_LIST and you have to add a new branch with the new YOTTA_TARGET and a new TARGET_DIR path (if it neccessary) to the if at the top in the Makefile (just as you see right now). There is a little code snippet:

ifeq ($(TARGET), k64f)
  YOTTA_TARGET  = frdm-k64f-gcc
  TARGET_DIR   ?= /media/$(USER)/MBED
else ifeq ($(TARGET), stm32f4)
  YOTTA_TARGET  = 

Basically, you can create a new target in this way (If the mbed OS support your board).

#####Let's get into the details!

  1. The next rule is the jerry rule. This rule builds the JerryScript and copy the output files into the target libjerry folder. Two files will be generated at targets/mbed/libjerry:
  • libjerrycore.a
  • libfdlibm.a

You can run this rule with the following command:

  • make -f targets/mbed/Makefile.mbed board=$(TARGET) jerry
  1. The next rule is the js2c. This rule calls a js2c.py python script from the jerryscript/targets/tools and creates the JavaScript builtin file into the targets/mbed/source/ folder. This file is the jerry-targetjs.h. You can run this rule with the follwoing command:
  • make -f targets/mbed/Makefile.mbed board=$(TARGET) js2c
  1. The last rule is the yotta. This rule sets the yotta target and install the mbed-drivers module, install the dependencies for the mbed OS and finaly creates the mbed binary file. The binary file will be genrated at targets/mbed/build/$(YOTTA_TARGET)/source/jerry.bin. You can run this rule with the following command:
  • make -f targets/mbed/Makefile.mbed board=$(TARGET) yotta
  1. Optional rule: clean. It removes the build folder from the mbed and jerry. You can run this rule with this command:
  • make -f targets/mbed/Makefile.mbed board=$(TARGET) clean

#####Flashing When the build is finished you can flash the binary into your board if you want. In case of ST boards you have to install the st-link software. Please visit this page to install STLink-v2. You can flash your binary into your board with the following command:

make -f targets/mbed/Makefile.mbed board=$(TARGET) flash

The flash rule grabs the binary and copies it to the mounted board or use the STLink-v2 to flash. When the status LED of the board stops blinking, press RESET button on the board to execute JerryScript led flashing sample program in js folder.

###Note If you use an STM32F4 board your build will stop with missing header errors. To fix this error please visit to this page and read about the fix in the New target for STM32F4 block.