targets/zephyr: Rename from arduino_101, with more targets supported.
- Add preliminary support for ARC architecture. Using "em_starterkit" board supported by Zephyr. Only build for this board is tested, not booted on a real device due to lack of access. There's no QEMU emulation support for ARC in Zephyr (yet) either. - Update README to cover different Zephyr architectures/boards. - Changed the arduino_101 paths to something more generic and adaptable - Made sure it compiles and runs on Arduino 101 JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
This commit is contained in:
Regular → Executable
+2
-1
@@ -31,7 +31,8 @@ JERRYHEAP ?= 16
|
|||||||
ZEPHYRINC = $(ZEPHYR_BASE)/include
|
ZEPHYRINC = $(ZEPHYR_BASE)/include
|
||||||
ZEPHYRLIB = $(ZEPHYR_BASE)/lib
|
ZEPHYRLIB = $(ZEPHYR_BASE)/lib
|
||||||
|
|
||||||
SOURCE_DIR = ./targets/arduino_101/src
|
TARGET_ZEPHYR ?= ./targets/zephyr
|
||||||
|
SOURCE_DIR = $(TARGET_ZEPHYR)/src
|
||||||
|
|
||||||
export JERRY_INCLUDE = $(CURDIR)/jerry-core/
|
export JERRY_INCLUDE = $(CURDIR)/jerry-core/
|
||||||
|
|
||||||
Regular → Executable
+20
-14
@@ -29,6 +29,9 @@ ifeq ($(BOARD),qemu_x86)
|
|||||||
BOARD_NAME ?= qemu_x86
|
BOARD_NAME ?= qemu_x86
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
TARGET_ZEPHYR ?= ./targets/zephyr
|
||||||
|
SOURCE_DIR = $(TARGET_ZEPHYR)/src
|
||||||
|
|
||||||
TYPE ?= release
|
TYPE ?= release
|
||||||
JERRYHEAP ?= 16
|
JERRYHEAP ?= 16
|
||||||
|
|
||||||
@@ -68,6 +71,11 @@ else ifeq ($(BOARD),qemu_cortex_m3)
|
|||||||
CONFIG_TOOLCHAIN_VARIANT = arm
|
CONFIG_TOOLCHAIN_VARIANT = arm
|
||||||
CPU = arm7-m
|
CPU = arm7-m
|
||||||
EXT_CFLAGS += -march=armv7-m -mthumb -mcpu=cortex-m3 -mabi=aapcs
|
EXT_CFLAGS += -march=armv7-m -mthumb -mcpu=cortex-m3 -mabi=aapcs
|
||||||
|
else ifeq ($(BOARD),em_starterkit)
|
||||||
|
# TODO: Tested only to build, untested to boot
|
||||||
|
CONFIG_TOOLCHAIN_VARIANT = arc
|
||||||
|
CPU = arc
|
||||||
|
EXT_CFLAGS += -mARCv2EM -mav2em -mno-sdata
|
||||||
else
|
else
|
||||||
CONFIG_TOOLCHAIN_VARIANT = iamcu
|
CONFIG_TOOLCHAIN_VARIANT = iamcu
|
||||||
CPU = lakemont
|
CPU = lakemont
|
||||||
@@ -97,10 +105,7 @@ ZEPHYR_BIN = $(OUTPUT)/zephyr/zephyr.strip
|
|||||||
PREFIX = $(TYPE)$(VARIETY)
|
PREFIX = $(TYPE)$(VARIETY)
|
||||||
LIBS = $(TYPE).external$(VARIETY)-entry $(PREFIX).jerry-core $(PREFIX).jerry-libm.lib
|
LIBS = $(TYPE).external$(VARIETY)-entry $(PREFIX).jerry-core $(PREFIX).jerry-libm.lib
|
||||||
|
|
||||||
# TODO @sergioamr Change how we link the library to USER_LDFLAGS
|
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) USER_LIBS="$(LIBS)" USER_LIB_INCLUDE_DIR="-L $(CURDIR)/$(OUTPUT)" TARGET_ZEPHYR=$(TARGET_ZEPHYR)
|
||||||
# https://gerrit.zephyrproject.org/r/#/c/2048/
|
|
||||||
|
|
||||||
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) USER_LIBS="$(LIBS)" USER_LIB_INCLUDE_DIR="-L $(CURDIR)/$(OUTPUT)"
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: jerry zephyr
|
all: jerry zephyr
|
||||||
@@ -124,7 +129,7 @@ endif
|
|||||||
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=lakemont \
|
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=lakemont \
|
||||||
-DEXTERNAL_LIBC_INTERFACE="$(ZEPHYR_LIBC_INC)" \
|
-DEXTERNAL_LIBC_INTERFACE="$(ZEPHYR_LIBC_INC)" \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_external.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_external.cmake \
|
||||||
-DEXTERNAL_BUILD_ENTRY_FILE=./targets/arduino_101/src/jerry-entry.c
|
-DEXTERNAL_BUILD_ENTRY_FILE=$(SOURCE_DIR)/jerry-entry.c
|
||||||
|
|
||||||
make -C $(INTERM) $(TYPE).external$(VARIETY) V=1
|
make -C $(INTERM) $(TYPE).external$(VARIETY) V=1
|
||||||
cp `cat $(INTERM)/$(TYPE).external$(VARIETY)/list` $(OUTPUT)/.
|
cp `cat $(INTERM)/$(TYPE).external$(VARIETY)/list` $(OUTPUT)/.
|
||||||
@@ -134,7 +139,7 @@ $(ZEPHYR_BIN):
|
|||||||
ifdef V
|
ifdef V
|
||||||
@echo "- ZEPHYR -------------------------------------------------------"
|
@echo "- ZEPHYR -------------------------------------------------------"
|
||||||
endif
|
endif
|
||||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG)
|
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG)
|
||||||
@echo "Finished"
|
@echo "Finished"
|
||||||
@file $(OUTPUT)/zephyr/zephyr.strip
|
@file $(OUTPUT)/zephyr/zephyr.strip
|
||||||
@size $(OUTPUT)/zephyr/zephyr.strip
|
@size $(OUTPUT)/zephyr/zephyr.strip
|
||||||
@@ -146,10 +151,10 @@ zephyr: $(EXTERNAL_LIB) $(ZEPHYR_BIN)
|
|||||||
@touch $(ZEPHYR_BIN)
|
@touch $(ZEPHYR_BIN)
|
||||||
|
|
||||||
qemu: $(EXTERNAL_LIB) $(ZEPHYR_BIN)
|
qemu: $(EXTERNAL_LIB) $(ZEPHYR_BIN)
|
||||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG) qemu
|
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG) qemu
|
||||||
|
|
||||||
flash: $(EXTERNAL_LIB) $(OUTPUT)/zephyr/zephyr.strip
|
flash: $(EXTERNAL_LIB) $(OUTPUT)/zephyr/zephyr.strip
|
||||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG) flash
|
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG) flash
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
help:
|
help:
|
||||||
@@ -171,7 +176,7 @@ showconfig:
|
|||||||
@echo "LIBS = $(LIBS) "
|
@echo "LIBS = $(LIBS) "
|
||||||
@echo "LIB_INCLUDE_DIR = $(LIB_INCLUDE_DIR) "
|
@echo "LIB_INCLUDE_DIR = $(LIB_INCLUDE_DIR) "
|
||||||
@echo "BUILD_CONFIG = $(BUILD_CONFIG) "
|
@echo "BUILD_CONFIG = $(BUILD_CONFIG) "
|
||||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG) showconfig
|
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG) showconfig
|
||||||
|
|
||||||
# TODO @sergioamr Temporal cleanup before finding why Zephyr is ignoring my
|
# TODO @sergioamr Temporal cleanup before finding why Zephyr is ignoring my
|
||||||
# outdir for the project
|
# outdir for the project
|
||||||
@@ -179,11 +184,12 @@ clean:
|
|||||||
@echo "Clearing Jerryscript"
|
@echo "Clearing Jerryscript"
|
||||||
@rm -rf $(OUTPUT)
|
@rm -rf $(OUTPUT)
|
||||||
@rm -rf $(INTERM)
|
@rm -rf $(INTERM)
|
||||||
@rm -f ./targets/arduino_101/src/.*.o.cmd
|
@rm -f $(SOURCE_DIR)/.*.o.cmd
|
||||||
@rm -f ./targets/arduino_101/src/*.o
|
@rm -f $(SOURCE_DIR)/*.o
|
||||||
@echo "Clearing Zephyr"
|
@echo "Clearing Zephyr"
|
||||||
make -f ./targets/arduino_101/Makefile clean
|
make -f $(TARGET_ZEPHYR)/Makefile clean
|
||||||
make -f ./targets/arduino_101/Makefile pristine
|
make -f $(TARGET_ZEPHYR)/Makefile pristine
|
||||||
|
|
||||||
mrproper:
|
mrproper:
|
||||||
make -f ./targets/arduino_101/Makefile mrproper
|
make -f $(TARGET_ZEPHYR)/Makefile mrproper
|
||||||
|
|
||||||
@@ -1,33 +1,31 @@
|
|||||||
### About
|
### About
|
||||||
|
|
||||||
This folder contains files to run JerryScript on Zephyr with
|
This folder contains files to integrate JerryScript with Zephyr RTOS to
|
||||||
[Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101)
|
run on a number of supported boards (like
|
||||||
|
[Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101),
|
||||||
Zephyr project arduino 101
|
[Zephyr Arduino 101](https://www.zephyrproject.org/doc/board/arduino_101.html)).
|
||||||
[Zephyr Arduino 101](https://www.zephyrproject.org/doc/board/arduino_101.html)
|
|
||||||
|
|
||||||
### How to build
|
### How to build
|
||||||
|
|
||||||
#### 1. Preface
|
#### 1. Preface
|
||||||
|
|
||||||
1, Directory structure
|
1. Directory structure
|
||||||
|
|
||||||
Assume `harmony` as the path to the projects to build.
|
Assume `harmony` as the path to the projects to build.
|
||||||
The folder tree related would look like this.
|
The folder tree related would look like this.
|
||||||
|
|
||||||
```
|
```
|
||||||
harmony
|
harmony
|
||||||
+ jerry
|
+ jerryscript
|
||||||
| + targets
|
| + targets
|
||||||
| + arduino_101
|
| + zephyr
|
||||||
+ zephyr
|
+ zephyr
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
2, Target board
|
2. Target boards/emulations
|
||||||
|
|
||||||
Assume [Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101)
|
Following Zephyr boards were tested: qemu_x86, qemu_cortex_m3, arduino_101.
|
||||||
as the target board.
|
|
||||||
|
|
||||||
|
|
||||||
#### 2. Prepare Zephyr
|
#### 2. Prepare Zephyr
|
||||||
@@ -35,9 +33,11 @@ as the target board.
|
|||||||
Follow [this](https://www.zephyrproject.org/doc/getting_started/getting_started.html) page to get
|
Follow [this](https://www.zephyrproject.org/doc/getting_started/getting_started.html) page to get
|
||||||
the Zephyr source and configure the environment.
|
the Zephyr source and configure the environment.
|
||||||
|
|
||||||
Follow "Building a Sample Application" and check that you can flash the Arduino 101
|
If you just start with Zephyr, you may want to follow "Building a Sample
|
||||||
|
Application" section in the doc above and check that you can flash your
|
||||||
|
target board.
|
||||||
|
|
||||||
Remember to source the zephyr environment.
|
Remember to source the Zephyr environment:
|
||||||
|
|
||||||
```
|
```
|
||||||
source zephyr-env.sh
|
source zephyr-env.sh
|
||||||
@@ -49,10 +49,26 @@ export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
|
|||||||
|
|
||||||
#### 3. Build JerryScript for Zephyr
|
#### 3. Build JerryScript for Zephyr
|
||||||
|
|
||||||
|
The easiest way is to build and run on a QEMU emulator:
|
||||||
|
|
||||||
|
For x86 architecture:
|
||||||
|
|
||||||
|
```
|
||||||
|
make -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_x86 qemu
|
||||||
|
```
|
||||||
|
|
||||||
|
For ARM (Cortex-M) architecture:
|
||||||
|
|
||||||
|
```
|
||||||
|
make -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_cortex_m3 qemu
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 4. Build for Arduino 101
|
||||||
|
|
||||||
```
|
```
|
||||||
# assume you are in harmony folder
|
# assume you are in harmony folder
|
||||||
cd jerry
|
cd jerry
|
||||||
make -f ./targets/arduino_101/Makefile.arduino_101
|
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate the following libraries:
|
This will generate the following libraries:
|
||||||
@@ -71,6 +87,7 @@ The final Zephyr image will be located here:
|
|||||||
|
|
||||||
Details on how to flash the image can be found here:
|
Details on how to flash the image can be found here:
|
||||||
[Flashing image](https://www.zephyrproject.org/doc/board/arduino_101.html)
|
[Flashing image](https://www.zephyrproject.org/doc/board/arduino_101.html)
|
||||||
|
(or similar page for other supported boards).
|
||||||
|
|
||||||
To be able to use this demo in hardware you will need the serial console
|
To be able to use this demo in hardware you will need the serial console
|
||||||
which will be generating output to Pins 0 & 1
|
which will be generating output to Pins 0 & 1
|
||||||
@@ -78,13 +95,13 @@ which will be generating output to Pins 0 & 1
|
|||||||
Some examples of building the software
|
Some examples of building the software
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f ./targets/arduino_101/Makefile.arduino_101 clean
|
make -f ./targets/zephyr/Makefile.zephyr clean
|
||||||
```
|
```
|
||||||
|
|
||||||
- Not using a Jtag and having a factory stock Arduino 101.
|
- Not using a Jtag and having a factory stock Arduino 101.
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f ./targets/arduino_101/Makefile.arduino_101 BOARD=arduino_101_factory
|
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory
|
||||||
```
|
```
|
||||||
|
|
||||||
Follow the Zephyr instructions to flash using the dfu-util command.
|
Follow the Zephyr instructions to flash using the dfu-util command.
|
||||||
@@ -96,16 +113,10 @@ There is a helper function to flash using the JTAG and Flywatter2
|
|||||||
|
|
||||||

|

|
||||||
```
|
```
|
||||||
make -f ./targets/arduino_101/Makefile.arduino_101 BOARD=arduino_101 flash
|
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101 flash
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Compiling and running with the emulator
|
|
||||||
```
|
|
||||||
make -f ./targets/arduino_101/Makefile.arduino_101 BOARD=qemu_x86 qemu
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### 6. Serial terminal
|
#### 6. Serial terminal
|
||||||
|
|
||||||
Test command line in a serial terminal.
|
Test command line in a serial terminal.
|
||||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Reference in New Issue
Block a user