diff --git a/targets/zephyr/Makefile b/targets/zephyr/Makefile index 48d6233f1..2cee86f56 100755 --- a/targets/zephyr/Makefile +++ b/targets/zephyr/Makefile @@ -20,7 +20,7 @@ $(error Missing zephyr base) endif # For testing without real hardware use qemu_x86 instead of arduino_101 -BOARD ?= arduino_101 +BOARD ?= arduino_101_factory O ?= $(PROJECT_BASE)/outdir diff --git a/targets/zephyr/Makefile.zephyr b/targets/zephyr/Makefile.zephyr index 2ca56f55e..05ba8b9dd 100755 --- a/targets/zephyr/Makefile.zephyr +++ b/targets/zephyr/Makefile.zephyr @@ -18,15 +18,11 @@ ifeq ($(.DEFAULT_GOAL),) $(warning no default goal is set) endif -ifeq ($(MAKECMDGOALS),qemu) -BOARD ?= qemu_x86 -else -BOARD ?= arduino_101 +BOARD ?= arduino_101_factory BOARD_NAME ?= arduino_101 -endif ifeq ($(BOARD),qemu_x86) -BOARD_NAME ?= qemu_x86 +BOARD_NAME = qemu_x86 endif TARGET_ZEPHYR ?= ./targets/zephyr @@ -156,6 +152,11 @@ qemu: $(EXTERNAL_LIB) $(ZEPHYR_BIN) flash: $(EXTERNAL_LIB) $(OUTPUT)/zephyr/zephyr.strip make -f $(TARGET_ZEPHYR)/Makefile $(BUILD_CONFIG) flash +dfu-x86: all + @- dfu-util -a x86_app -D build/$(BOARD)/zephyr/zephyr.bin; \ + if [ $$? -eq 0 ] ; then echo "\nYour program will launch in 5 seconds." ; \ + else echo "\nProgram didn't flash, try pressing the reset buttons \nand wait a second for the bootloader to load, \nor flash again the factory bootloader."; fi + usage: help: @echo Usage: @@ -184,7 +185,6 @@ clean: @echo "Clearing Jerryscript" @rm -rf $(OUTPUT) @rm -rf $(INTERM) - @rm -f $(TARGET_ZEPHYR_SRC_DIR)/.*.o.cmd @rm -f $(TARGET_ZEPHYR_SRC_DIR)/*.o @echo "Clearing Zephyr" make -f $(TARGET_ZEPHYR)/Makefile clean diff --git a/targets/zephyr/README.md b/targets/zephyr/README.md old mode 100644 new mode 100755 index 0de041f65..2732539b4 --- a/targets/zephyr/README.md +++ b/targets/zephyr/README.md @@ -19,7 +19,7 @@ harmony + jerryscript | + targets | + zephyr - + zephyr + + zephyr-project ``` @@ -37,13 +37,13 @@ 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 as explained in the zephyr documenation: ``` +cd zephyr-project source zephyr-env.sh export ZEPHYR_GCC_VARIANT=zephyr - export ZEPHYR_SDK_INSTALL_DIR= ``` @@ -67,20 +67,20 @@ make -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_cortex_m3 qemu ``` # assume you are in harmony folder -cd jerry -make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101 +cd jerryscript +make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory ``` This will generate the following libraries: ``` -./build/arduino_101/librelease-cp_minimal.jerry-core.a -./build/arduino_101/librelease-cp_minimal.jerry-libm.lib.a -./build/arduino_101/librelease.external-cp_minimal-entry.a +./build/arduino_101_factory/librelease-cp_minimal.jerry-core.a +./build/arduino_101_factory/librelease-cp_minimal.jerry-libm.lib.a +./build/arduino_101_factory/librelease.external-cp_minimal-entry.a ``` The final Zephyr image will be located here: ``` -./build/arduino_101/zephyr/zephyr.strip +./build/arduino_101_factory/zephyr/zephyr.strip ``` #### 5. Flashing @@ -90,32 +90,39 @@ Details on how to flash the image can be found here: (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 +which will be generating output to Pins 0 & 1. + +You will need a 3.3v TTL to RS232, please follow the zephyr documentation on it. Some examples of building the software ``` -make -f ./targets/zephyr/Makefile.zephyr clean +make -f ./targets/zephyr/Makefile.zephyr BOARD= clean ``` - Not using a Jtag and having a factory stock Arduino 101. +You can follow the Zephyr instructions to flash using the dfu-util command +or use this helper: ``` -make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory +make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory dfu-x86 ``` -Follow the Zephyr instructions to flash using the dfu-util command. - +Make sure you have the factory bootloader in your device to use this method or it will not flash. - Using JTAG There is a helper function to flash using the JTAG and Flywatter2 ![alt tag](docs/arduino_101.jpg?raw=true "Example") -``` -make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101 flash ``` +make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory flash +``` + + Careful if you flash the BOARD arduino_101, you will lose the bootloader +and you will have to follow the zephyr documentation to get it back from +the backup we all know you did at the setup. #### 6. Serial terminal diff --git a/targets/zephyr/prj.conf b/targets/zephyr/prj.conf old mode 100644 new mode 100755 index 743d94a01..29c933f09 --- a/targets/zephyr/prj.conf +++ b/targets/zephyr/prj.conf @@ -3,5 +3,5 @@ CONFIG_NEWLIB_LIBC=y CONFIG_FLOAT=y CONFIG_CONSOLE_HANDLER=y CONFIG_CONSOLE_HANDLER_SHELL=y - +CONFIG_ARC_INIT=n