mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
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:
parent
64f49385ae
commit
4091444016
7
targets/arduino_101/Makefile → targets/zephyr/Makefile
Normal file → Executable file
7
targets/arduino_101/Makefile → targets/zephyr/Makefile
Normal file → Executable file
@ -18,10 +18,10 @@
|
||||
ifndef ZEPHYR_BASE
|
||||
$(error Missing zephyr base)
|
||||
endif
|
||||
|
||||
|
||||
# For testing without real hardware use qemu_x86 instead of arduino_101
|
||||
BOARD ?= arduino_101
|
||||
|
||||
|
||||
O ?= $(PROJECT_BASE)/outdir
|
||||
|
||||
ZEPHYR ?= $(ZEPHYR_BASE)
|
||||
@ -31,7 +31,8 @@ JERRYHEAP ?= 16
|
||||
ZEPHYRINC = $(ZEPHYR_BASE)/include
|
||||
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/
|
||||
|
||||
34
targets/arduino_101/Makefile.arduino_101 → targets/zephyr/Makefile.zephyr
Normal file → Executable file
34
targets/arduino_101/Makefile.arduino_101 → targets/zephyr/Makefile.zephyr
Normal file → Executable file
@ -29,6 +29,9 @@ ifeq ($(BOARD),qemu_x86)
|
||||
BOARD_NAME ?= qemu_x86
|
||||
endif
|
||||
|
||||
TARGET_ZEPHYR ?= ./targets/zephyr
|
||||
SOURCE_DIR = $(TARGET_ZEPHYR)/src
|
||||
|
||||
TYPE ?= release
|
||||
JERRYHEAP ?= 16
|
||||
|
||||
@ -68,6 +71,11 @@ else ifeq ($(BOARD),qemu_cortex_m3)
|
||||
CONFIG_TOOLCHAIN_VARIANT = arm
|
||||
CPU = arm7-m
|
||||
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
|
||||
CONFIG_TOOLCHAIN_VARIANT = iamcu
|
||||
CPU = lakemont
|
||||
@ -97,10 +105,7 @@ ZEPHYR_BIN = $(OUTPUT)/zephyr/zephyr.strip
|
||||
PREFIX = $(TYPE)$(VARIETY)
|
||||
LIBS = $(TYPE).external$(VARIETY)-entry $(PREFIX).jerry-core $(PREFIX).jerry-libm.lib
|
||||
|
||||
# TODO @sergioamr Change how we link the library to USER_LDFLAGS
|
||||
# https://gerrit.zephyrproject.org/r/#/c/2048/
|
||||
|
||||
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) USER_LIBS="$(LIBS)" USER_LIB_INCLUDE_DIR="-L $(CURDIR)/$(OUTPUT)"
|
||||
BUILD_CONFIG = O="$(OUTPUT)/zephyr" V=$(V) USER_LIBS="$(LIBS)" USER_LIB_INCLUDE_DIR="-L $(CURDIR)/$(OUTPUT)" TARGET_ZEPHYR=$(TARGET_ZEPHYR)
|
||||
|
||||
.PHONY: all
|
||||
all: jerry zephyr
|
||||
@ -124,7 +129,7 @@ endif
|
||||
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=lakemont \
|
||||
-DEXTERNAL_LIBC_INTERFACE="$(ZEPHYR_LIBC_INC)" \
|
||||
-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
|
||||
cp `cat $(INTERM)/$(TYPE).external$(VARIETY)/list` $(OUTPUT)/.
|
||||
@ -134,7 +139,7 @@ $(ZEPHYR_BIN):
|
||||
ifdef V
|
||||
@echo "- ZEPHYR -------------------------------------------------------"
|
||||
endif
|
||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG)
|
||||
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG)
|
||||
@echo "Finished"
|
||||
@file $(OUTPUT)/zephyr/zephyr.strip
|
||||
@size $(OUTPUT)/zephyr/zephyr.strip
|
||||
@ -146,10 +151,10 @@ zephyr: $(EXTERNAL_LIB) $(ZEPHYR_BIN)
|
||||
@touch $(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
|
||||
make -f ./targets/arduino_101/Makefile $(BUILD_CONFIG) flash
|
||||
make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG) flash
|
||||
|
||||
usage:
|
||||
help:
|
||||
@ -171,7 +176,7 @@ showconfig:
|
||||
@echo "LIBS = $(LIBS) "
|
||||
@echo "LIB_INCLUDE_DIR = $(LIB_INCLUDE_DIR) "
|
||||
@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
|
||||
# outdir for the project
|
||||
@ -179,11 +184,12 @@ clean:
|
||||
@echo "Clearing Jerryscript"
|
||||
@rm -rf $(OUTPUT)
|
||||
@rm -rf $(INTERM)
|
||||
@rm -f ./targets/arduino_101/src/.*.o.cmd
|
||||
@rm -f ./targets/arduino_101/src/*.o
|
||||
@rm -f $(SOURCE_DIR)/.*.o.cmd
|
||||
@rm -f $(SOURCE_DIR)/*.o
|
||||
@echo "Clearing Zephyr"
|
||||
make -f ./targets/arduino_101/Makefile clean
|
||||
make -f ./targets/arduino_101/Makefile pristine
|
||||
make -f $(TARGET_ZEPHYR)/Makefile clean
|
||||
make -f $(TARGET_ZEPHYR)/Makefile pristine
|
||||
|
||||
mrproper:
|
||||
make -f ./targets/arduino_101/Makefile mrproper
|
||||
make -f $(TARGET_ZEPHYR)/Makefile mrproper
|
||||
|
||||
@ -1,33 +1,31 @@
|
||||
### About
|
||||
|
||||
This folder contains files to run JerryScript on Zephyr with
|
||||
[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)
|
||||
This folder contains files to integrate JerryScript with Zephyr RTOS to
|
||||
run on a number of supported boards (like
|
||||
[Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101),
|
||||
[Zephyr Arduino 101](https://www.zephyrproject.org/doc/board/arduino_101.html)).
|
||||
|
||||
### How to build
|
||||
|
||||
#### 1. Preface
|
||||
|
||||
1, Directory structure
|
||||
1. Directory structure
|
||||
|
||||
Assume `harmony` as the path to the projects to build.
|
||||
The folder tree related would look like this.
|
||||
|
||||
```
|
||||
harmony
|
||||
+ jerry
|
||||
+ jerryscript
|
||||
| + targets
|
||||
| + arduino_101
|
||||
| + zephyr
|
||||
+ zephyr
|
||||
```
|
||||
|
||||
|
||||
2, Target board
|
||||
2. Target boards/emulations
|
||||
|
||||
Assume [Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101)
|
||||
as the target board.
|
||||
Following Zephyr boards were tested: qemu_x86, qemu_cortex_m3, arduino_101.
|
||||
|
||||
|
||||
#### 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
|
||||
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
|
||||
@ -49,10 +49,26 @@ export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
|
||||
|
||||
#### 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
|
||||
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:
|
||||
@ -71,6 +87,7 @@ The final Zephyr image will be located here:
|
||||
|
||||
Details on how to flash the image can be found here:
|
||||
[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
|
||||
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
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
```
|
||||
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.
|
||||
@ -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
|
||||
|
||||
Test command line in a serial terminal.
|
||||
@ -137,4 +148,4 @@ Help will provide a list of commands
|
||||
> help
|
||||
```
|
||||
|
||||
This program, is built in top of the Zephyr command line, so there is a limit of 10 spaces.
|
||||
This program, is built in top of the Zephyr command line, so there is a limit of 10 spaces.
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Loading…
x
Reference in New Issue
Block a user