Separate targets into os and baremetal-sdk parts (#4842)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
This commit is contained in:
@@ -256,8 +256,8 @@ jobs:
|
|||||||
- run: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
|
- run: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
|
||||||
- run: sudo apt update
|
- run: sudo apt update
|
||||||
- run: sudo apt install gcc-arm-embedded python3-setuptools
|
- run: sudo apt install gcc-arm-embedded python3-setuptools
|
||||||
- run: make -f ./targets/mbedos5/Makefile.travis install
|
- run: make -f ./targets/os/mbedos5/Makefile.travis install
|
||||||
- run: make -f ./targets/mbedos5/Makefile.travis script
|
- run: make -f ./targets/os/mbedos5/Makefile.travis script
|
||||||
|
|
||||||
Zephyr_STM32F4_Build_Test:
|
Zephyr_STM32F4_Build_Test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -268,8 +268,8 @@ jobs:
|
|||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- run: sudo apt update
|
- run: sudo apt update
|
||||||
- run: sudo apt install gperf dfu-util device-tree-compiler
|
- run: sudo apt install gperf dfu-util device-tree-compiler
|
||||||
- run: make -f ./targets/zephyr/Makefile.travis install
|
- run: make -f ./targets/os/zephyr/Makefile.travis install
|
||||||
- run: make -f ./targets/zephyr/Makefile.travis script
|
- run: make -f ./targets/os/zephyr/Makefile.travis script
|
||||||
|
|
||||||
NuttX_STM32F4_Build_Test:
|
NuttX_STM32F4_Build_Test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -277,8 +277,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: sudo apt update
|
- run: sudo apt update
|
||||||
- run: sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi gperf
|
- run: sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi gperf
|
||||||
- run: make -f ./targets/nuttx-stm32f4/Makefile.travis install-noapt
|
- run: make -f ./targets/os/nuttx/Makefile.travis install-noapt
|
||||||
- run: make -f ./targets/nuttx-stm32f4/Makefile.travis script
|
- run: make -f ./targets/os/nuttx/Makefile.travis script
|
||||||
|
|
||||||
RIOT_STM32F4_Build_Test:
|
RIOT_STM32F4_Build_Test:
|
||||||
runs-on: ubuntu-18.04 # needed due to ppa:team-gcc-arm-embedded/ppa
|
runs-on: ubuntu-18.04 # needed due to ppa:team-gcc-arm-embedded/ppa
|
||||||
@@ -289,8 +289,8 @@ jobs:
|
|||||||
- run: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
|
- run: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
|
||||||
- run: sudo apt update
|
- run: sudo apt update
|
||||||
- run: sudo apt install clang gcc-arm-embedded gcc-multilib
|
- run: sudo apt install clang gcc-arm-embedded gcc-multilib
|
||||||
- run: make -f ./targets/riot-stm32f4/Makefile.travis install-noapt
|
- run: make -f ./targets/os/riot/Makefile.travis install-noapt
|
||||||
- run: make -f ./targets/riot-stm32f4/Makefile.travis script
|
- run: make -f ./targets/os/riot/Makefile.travis script
|
||||||
|
|
||||||
ESP8266_Build_Test:
|
ESP8266_Build_Test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -299,8 +299,8 @@ jobs:
|
|||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: '2.7' # needed due to ESP8266_RTOS_SDK/tools/gen_appbin.py
|
python-version: '2.7' # needed due to ESP8266_RTOS_SDK/tools/gen_appbin.py
|
||||||
- run: make -f ./targets/esp8266/Makefile.travis install-noapt
|
- run: make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.travis install-noapt
|
||||||
- run: make -f ./targets/esp8266/Makefile.travis script
|
- run: make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.travis script
|
||||||
|
|
||||||
Notification:
|
Notification:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ You will first register in the web page. Then you will receive an email where is
|
|||||||
|
|
||||||
#### 3. Build JerryScript and Curie BSP
|
#### 3. Build JerryScript and Curie BSP
|
||||||
##### 1. Generate makefiles
|
##### 1. Generate makefiles
|
||||||
Run the Python script ``setup.py`` in ``jerryscript/targets/curie_bsp/`` with the full path or relative path of the ``Curie_BSP``:
|
Run the Python script ``setup.py`` in ``jerryscript/targets/baremetal-sdk/curie-bsp/`` with the full path or relative path of the ``Curie_BSP``:
|
||||||
```
|
```
|
||||||
python setup.py <path of Curie_BSP>
|
python setup.py <path of Curie_BSP>
|
||||||
```
|
```
|
||||||
|
Before Width: | Height: | Size: 575 KiB After Width: | Height: | Size: 575 KiB |
@@ -25,15 +25,15 @@ def build_soft_links(project_path, jerry_path):
|
|||||||
|
|
||||||
links = [
|
links = [
|
||||||
{ # arc
|
{ # arc
|
||||||
'src': os.path.join('targets', 'curie_bsp', 'jerry_app', 'arc'),
|
'src': os.path.join('targets', 'baremetal-sdk', 'curie-bsp', 'jerry_app', 'arc'),
|
||||||
'link_name': 'arc'
|
'link_name': 'arc'
|
||||||
},
|
},
|
||||||
{ # include
|
{ # include
|
||||||
'src': os.path.join('targets', 'curie_bsp', 'jerry_app', 'include'),
|
'src': os.path.join('targets', 'baremetal-sdk', 'curie-bsp', 'jerry_app', 'include'),
|
||||||
'link_name': 'include'
|
'link_name': 'include'
|
||||||
},
|
},
|
||||||
{ # quark
|
{ # quark
|
||||||
'src': os.path.join('targets', 'curie_bsp', 'jerry_app', 'quark'),
|
'src': os.path.join('targets', 'baremetal-sdk', 'curie-bsp', 'jerry_app', 'quark'),
|
||||||
'link_name': 'quark'
|
'link_name': 'quark'
|
||||||
},
|
},
|
||||||
{ # quark/jerryscript
|
{ # quark/jerryscript
|
||||||
@@ -76,7 +76,7 @@ def build_jerry_data(jerry_path):
|
|||||||
"""
|
"""
|
||||||
jerry_sources = []
|
jerry_sources = []
|
||||||
jerry_dirs = set()
|
jerry_dirs = set()
|
||||||
for sub_dir in ['jerry-core', 'jerry-math', os.path.join('targets', 'curie_bsp', 'source')]:
|
for sub_dir in ['jerry-core', 'jerry-math', os.path.join('targets', 'baremetal-sdk', 'curie-bsp', 'source')]:
|
||||||
for file in find_sources(os.path.normpath(jerry_path), sub_dir):
|
for file in find_sources(os.path.normpath(jerry_path), sub_dir):
|
||||||
path = os.path.join('jerryscript', file)
|
path = os.path.join('jerryscript', file)
|
||||||
jerry_sources.append(path)
|
jerry_sources.append(path)
|
||||||
@@ -199,7 +199,7 @@ def create_quark_kbuild(project_path, jerry_path):
|
|||||||
'include',
|
'include',
|
||||||
'jerryscript',
|
'jerryscript',
|
||||||
os.path.join('jerryscript', 'jerry-math', 'include'),
|
os.path.join('jerryscript', 'jerry-math', 'include'),
|
||||||
os.path.join('jerryscript', 'targets' ,'curie_bsp', 'include')
|
os.path.join('jerryscript', 'targets', 'baremetal-sdk', 'curie-bsp', 'include')
|
||||||
] + list(jerry_data['dirs'])
|
] + list(jerry_data['dirs'])
|
||||||
|
|
||||||
quark_includes = [
|
quark_includes = [
|
||||||
@@ -245,7 +245,7 @@ if __name__ == '__main__':
|
|||||||
project_name = 'curie_bsp_jerry'
|
project_name = 'curie_bsp_jerry'
|
||||||
|
|
||||||
file_dir = os.path.dirname(os.path.abspath(__file__))
|
file_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
jerry_path = os.path.join(file_dir, "..", "..")
|
jerry_path = os.path.join(file_dir, "..", "..", "..")
|
||||||
curie_path = os.path.join(os.getcwd(), sys.argv[1])
|
curie_path = os.path.join(os.getcwd(), sys.argv[1])
|
||||||
|
|
||||||
main(curie_path, project_name, jerry_path)
|
main(curie_path, project_name, jerry_path)
|
||||||
+2
-2
@@ -2,10 +2,10 @@
|
|||||||
# - set the JERRY_DIR wherever the jerryscript source code (the include files) is
|
# - set the JERRY_DIR wherever the jerryscript source code (the include files) is
|
||||||
# - a "lib" directory with the 2 libraries below
|
# - a "lib" directory with the 2 libraries below
|
||||||
|
|
||||||
set(JERRY_DIR ${PROJECT_DIR}/../../jerryscript/)
|
set(JERRY_DIR ${PROJECT_DIR}/../../../jerryscript/)
|
||||||
|
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRC_DIRS ${JERRY_DIR}/targets/esp-idf
|
SRC_DIRS ${JERRY_DIR}/targets/baremetal-sdk/esp-idf
|
||||||
INCLUDE_DIRS ${JERRY_DIR}/jerry-core/include ${JERRY_DIR}/jerry-ext/include
|
INCLUDE_DIRS ${JERRY_DIR}/jerry-core/include ${JERRY_DIR}/jerry-ext/include
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ Then copy the artifacts 'build/lib/\*.a' in an esp-idf component named 'jerryscr
|
|||||||
set(JERRY_DIR ${PROJECT_DIR}/../../jerryscript/)
|
set(JERRY_DIR ${PROJECT_DIR}/../../jerryscript/)
|
||||||
|
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRC_DIRS ${JERRY_DIR}/targets/esp-idf
|
SRC_DIRS ${JERRY_DIR}/targets/baremetal-sdk/esp-idf
|
||||||
INCLUDE_DIRS ${JERRY_DIR}/jerry-core/include ${JERRY_DIR}/jerry-ext/include
|
INCLUDE_DIRS ${JERRY_DIR}/jerry-core/include ${JERRY_DIR}/jerry-ext/include
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ SUBDIRS= user
|
|||||||
endif # } PDIR
|
endif # } PDIR
|
||||||
|
|
||||||
# path to the JERRYSCRIPT directory
|
# path to the JERRYSCRIPT directory
|
||||||
JERRYDIR ?= $(CURDIR)/../../..
|
JERRYDIR ?= $(CURDIR)/../../../..
|
||||||
|
|
||||||
LDDIR = $(SDK_PATH)/ld
|
LDDIR = $(SDK_PATH)/ld
|
||||||
|
|
||||||
+4
-4
@@ -15,7 +15,7 @@
|
|||||||
CURDIR = `pwd`
|
CURDIR = `pwd`
|
||||||
ESP_LIB = $(SDK_PATH)/lib
|
ESP_LIB = $(SDK_PATH)/lib
|
||||||
BUILD_DIR = build/obj-esp8266
|
BUILD_DIR = build/obj-esp8266
|
||||||
COPYTARGET = targets/esp8266/libs
|
COPYTARGET = targets/baremetal-sdk/esp8266-rtos-sdk/libs
|
||||||
USBDEVICE ?= /dev/ttyUSB0
|
USBDEVICE ?= /dev/ttyUSB0
|
||||||
JERRYHEAP ?= 20
|
JERRYHEAP ?= 20
|
||||||
ESPTOOL ?= $(ESPTOOL_PATH)/esptool.py
|
ESPTOOL ?= $(ESPTOOL_PATH)/esptool.py
|
||||||
@@ -61,11 +61,11 @@ jerry:
|
|||||||
cp $(BUILD_DIR)/lib/libjerry-math.a $(COPYTARGET)/
|
cp $(BUILD_DIR)/lib/libjerry-math.a $(COPYTARGET)/
|
||||||
|
|
||||||
js2c:
|
js2c:
|
||||||
tools/js2c.py --dest targets/esp8266/include --js-source targets/esp8266/js
|
tools/js2c.py --dest targets/baremetal-sdk/esp8266-rtos-sdk/include --js-source targets/baremetal-sdk/esp8266-rtos-sdk/js
|
||||||
|
|
||||||
mkbin:
|
mkbin:
|
||||||
make -Ctargets/esp8266 clean
|
make -Ctargets/baremetal-sdk/esp8266-rtos-sdk clean
|
||||||
make -Ctargets/esp8266 BOOT=new APP=0 SPI_SPEED=40 SPI_MODE=DIO SPI_SIZE_MAP=4
|
make -Ctargets/baremetal-sdk/esp8266-rtos-sdk BOOT=new APP=0 SPI_SPEED=40 SPI_MODE=DIO SPI_SIZE_MAP=4
|
||||||
|
|
||||||
check-env:
|
check-env:
|
||||||
ifndef SDK_PATH
|
ifndef SDK_PATH
|
||||||
+1
-1
@@ -43,4 +43,4 @@ install: install-apt-get-deps install-noapt
|
|||||||
|
|
||||||
# Build the firmware (ESP8266 with JerryScript).
|
# Build the firmware (ESP8266 with JerryScript).
|
||||||
script:
|
script:
|
||||||
PATH=$(CURDIR)/../xtensa-lx106-elf/bin:$$PATH $(MAKE) -f ./targets/esp8266/Makefile.esp8266 BIN_PATH=build/obj-esp8266 SDK_PATH=$(CURDIR)/../ESP8266_RTOS_SDK
|
PATH=$(CURDIR)/../xtensa-lx106-elf/bin:$$PATH $(MAKE) -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 BIN_PATH=build/obj-esp8266 SDK_PATH=$(CURDIR)/../ESP8266_RTOS_SDK
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var check = 1;
|
||||||
|
|
||||||
|
function blink() {
|
||||||
|
var inp = gpio_get(0);
|
||||||
|
var blk = (check > 8) ? 1 - inp : inp;
|
||||||
|
gpio_set(2, blk);
|
||||||
|
check = check >= 10 ? 1 : check+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIO 0 as input
|
||||||
|
// GPIO 2 as output
|
||||||
|
gpio_dir(0, 0);
|
||||||
|
gpio_dir(2, 1);
|
||||||
|
|
||||||
|
print("blink js OK");
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function sysloop(ticknow) {
|
||||||
|
blink();
|
||||||
|
};
|
||||||
|
print("Random generated number: ", Math.random());
|
||||||
|
print("main js OK");
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
### About
|
### About
|
||||||
|
|
||||||
Files in this folder (targets/esp8266) are copied from
|
Files in this folder (targets/baremetal-sdk/esp8266-rtos-sdk) are copied from
|
||||||
`examples/project_template` of `esp_iot_rtos_sdk` and modified for JerryScript.
|
`examples/project_template` of `esp_iot_rtos_sdk` and modified for JerryScript.
|
||||||
You can view online from
|
You can view online from
|
||||||
[this](https://github.com/espressif/esp_iot_rtos_sdk/tree/master/examples/project_template) page.
|
[this](https://github.com/espressif/esp_iot_rtos_sdk/tree/master/examples/project_template) page.
|
||||||
@@ -17,7 +17,7 @@ Follow [this](./docs/ESP-PREREQUISITES.md) page to setup build environment
|
|||||||
|
|
||||||
```
|
```
|
||||||
# assume you are in jerryscript folder
|
# assume you are in jerryscript folder
|
||||||
make -f ./targets/esp8266/Makefile.esp8266
|
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266
|
||||||
```
|
```
|
||||||
|
|
||||||
Output files should be placed at $BIN_PATH
|
Output files should be placed at $BIN_PATH
|
||||||
@@ -27,13 +27,13 @@ Follow
|
|||||||
[this](http://www.kloppenborg.net/images/blog/esp8266/esp8266-esp12e-specs.pdf) page to get details about this board.
|
[this](http://www.kloppenborg.net/images/blog/esp8266/esp8266-esp12e-specs.pdf) page to get details about this board.
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f ./targets/esp8266/Makefile.esp8266 flash
|
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 flash
|
||||||
```
|
```
|
||||||
|
|
||||||
Default USB device is `/dev/ttyUSB0`. If you have different one, give with `USBDEVICE`, like;
|
Default USB device is `/dev/ttyUSB0`. If you have different one, give with `USBDEVICE`, like;
|
||||||
|
|
||||||
```
|
```
|
||||||
USBDEVICE=/dev/ttyUSB1 make -f ./targets/esp8266/Makefile.esp8266 flash
|
USBDEVICE=/dev/ttyUSB1 make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 flash
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Running
|
### 4. Running
|
||||||
@@ -49,12 +49,12 @@ LED should blink on and off every second
|
|||||||
To clean the build result:
|
To clean the build result:
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f ./targets/esp8266/Makefile.esp8266 clean
|
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 clean
|
||||||
```
|
```
|
||||||
|
|
||||||
To clean the board's flash memory:
|
To clean the board's flash memory:
|
||||||
```
|
```
|
||||||
make -f ./targets/esp8266/Makefile.esp8266 erase_flash
|
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 erase_flash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -29,7 +29,7 @@ PARTICLE_BUILD_CONFIG = \
|
|||||||
LIBS=jerry-core \
|
LIBS=jerry-core \
|
||||||
PLATFORM=photon \
|
PLATFORM=photon \
|
||||||
LIB_DIRS=$(BUILD_DIR)/lib \
|
LIB_DIRS=$(BUILD_DIR)/lib \
|
||||||
APPDIR=$(JERRYDIR)/targets/particle/source \
|
APPDIR=$(JERRYDIR)/targets/baremetal-sdk/particle/source \
|
||||||
TARGET_FILE=jerry_main \
|
TARGET_FILE=jerry_main \
|
||||||
TARGET_DIR=$(BUILD_DIR) \
|
TARGET_DIR=$(BUILD_DIR) \
|
||||||
LDFLAGS=--specs=nano.specs
|
LDFLAGS=--specs=nano.specs
|
||||||
@@ -14,7 +14,8 @@ The folder tree related would look like this.
|
|||||||
root
|
root
|
||||||
+ jerryscript
|
+ jerryscript
|
||||||
| + targets
|
| + targets
|
||||||
| + particle
|
| + os
|
||||||
|
| + particle
|
||||||
+ particle
|
+ particle
|
||||||
| + firmware
|
| + firmware
|
||||||
```
|
```
|
||||||
@@ -53,7 +54,7 @@ make PLATFORM=photon clean all program-dfu
|
|||||||
```
|
```
|
||||||
# assume you are in root folder
|
# assume you are in root folder
|
||||||
cd jerryscript
|
cd jerryscript
|
||||||
make -f ./targets/particle/Makefile.particle
|
make -f ./targets/baremetal-sdk/particle/Makefile.particle
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create a binary file in the `/build/particle/` folder:
|
This will create a binary file in the `/build/particle/` folder:
|
||||||
@@ -70,7 +71,7 @@ Make sure you put your Photon in DFU mode.
|
|||||||
Alternatively, you can make your life a bit easier by using the make command to invoke dfu-util:
|
Alternatively, you can make your life a bit easier by using the make command to invoke dfu-util:
|
||||||
|
|
||||||
```
|
```
|
||||||
make -f targets/particle/Makefile.particle flash
|
make -f targets/baremetal-sdk/particle/Makefile.particle flash
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use this dfu-util command directly to upload your BIN file to the Photon’s application memory:
|
You can also use this dfu-util command directly to upload your BIN file to the Photon’s application memory:
|
||||||
@@ -83,7 +84,7 @@ dfu-util -d 2b04:d006 -a 0 -i 0 -s 0x80A0000:leave -D build/particle/jerry_main.
|
|||||||
|
|
||||||
To clean the build result:
|
To clean the build result:
|
||||||
```
|
```
|
||||||
make -f targets/particle/Makefile.particle clean
|
make -f targets/baremetal-sdk/particle/Makefile.particle clean
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running the example
|
### Running the example
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
var check = 1;
|
|
||||||
|
|
||||||
function blink() {
|
|
||||||
var inp = gpio_get(0);
|
|
||||||
var blk = (check > 8) ? 1 - inp : inp;
|
|
||||||
gpio_set(2, blk);
|
|
||||||
check = check >= 10 ? 1 : check+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIO 0 as input
|
|
||||||
// GPIO 2 as output
|
|
||||||
gpio_dir(0, 0);
|
|
||||||
gpio_dir(2, 1);
|
|
||||||
|
|
||||||
print("blink js OK");
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
function sysloop(ticknow) {
|
|
||||||
blink();
|
|
||||||
};
|
|
||||||
print("Random generated number: ", Math.random());
|
|
||||||
print("main js OK");
|
|
||||||
@@ -23,7 +23,7 @@ DEBUG?=0
|
|||||||
NO_JS?=0
|
NO_JS?=0
|
||||||
MBED_VERBOSE?=0
|
MBED_VERBOSE?=0
|
||||||
|
|
||||||
MBED_CLI_FLAGS=-j0 --source . --source ../../
|
MBED_CLI_FLAGS=-j0 --source . --source ../../../
|
||||||
|
|
||||||
EXTRA_SRC=
|
EXTRA_SRC=
|
||||||
|
|
||||||
@@ -52,11 +52,11 @@ MBED_CLI_FLAGS += -D "JERRY_GLOBAL_HEAP_SIZE=$(HEAPSIZE)"
|
|||||||
MBED_CLI_FLAGS += -t GCC_ARM
|
MBED_CLI_FLAGS += -t GCC_ARM
|
||||||
|
|
||||||
.PHONY: all js2c getlibs rebuild library
|
.PHONY: all js2c getlibs rebuild library
|
||||||
all: source/jerry-targetjs.h source/pins.cpp .mbed ../../.mbedignore
|
all: source/jerry-targetjs.h source/pins.cpp .mbed ../../../.mbedignore
|
||||||
mbed target $(BOARD)
|
mbed target $(BOARD)
|
||||||
mbed compile $(MBED_CLI_FLAGS)
|
mbed compile $(MBED_CLI_FLAGS)
|
||||||
|
|
||||||
library: .mbed ../../.mbedignore
|
library: .mbed ../../../.mbedignore
|
||||||
# delete encoded js code if it exists
|
# delete encoded js code if it exists
|
||||||
rm -f source/jerry-targetjs.h
|
rm -f source/jerry-targetjs.h
|
||||||
mbed target $(BOARD)
|
mbed target $(BOARD)
|
||||||
@@ -66,7 +66,7 @@ clean:
|
|||||||
rm -rf ./BUILD/$(BOARD)
|
rm -rf ./BUILD/$(BOARD)
|
||||||
|
|
||||||
js2c: js/main.js js/flash_leds.js
|
js2c: js/main.js js/flash_leds.js
|
||||||
python ../../tools/js2c.py --ignore pins.js
|
python ../../../tools/js2c.py --ignore pins.js
|
||||||
|
|
||||||
source/pins.cpp:
|
source/pins.cpp:
|
||||||
python tools/generate_pins.py ${BOARD}
|
python tools/generate_pins.py ${BOARD}
|
||||||
@@ -86,9 +86,9 @@ getlibs: .mbed
|
|||||||
mbed target $(BOARD)
|
mbed target $(BOARD)
|
||||||
mbed deploy
|
mbed deploy
|
||||||
|
|
||||||
../../.mbedignore:
|
../../../.mbedignore:
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
copy template-mbedignore.txt ..\..\.mbedignore
|
copy template-mbedignore.txt ..\..\..\.mbedignore
|
||||||
else
|
else
|
||||||
cp ./template-mbedignore.txt ../../.mbedignore
|
cp ./template-mbedignore.txt ../../../.mbedignore
|
||||||
endif
|
endif
|
||||||
@@ -24,10 +24,10 @@ all:
|
|||||||
# Deploy Mbed and install Mbed Python dependencies.
|
# Deploy Mbed and install Mbed Python dependencies.
|
||||||
install:
|
install:
|
||||||
pip install mbed-cli
|
pip install mbed-cli
|
||||||
cd targets/mbedos5 && mbed deploy
|
cd targets/os/mbedos5 && mbed deploy
|
||||||
pip install idna==2.5 # FIXME: workaround
|
pip install idna==2.5 # FIXME: workaround
|
||||||
pip install -r targets/mbedos5/mbed-os/requirements.txt
|
pip install -r targets/os/mbedos5/mbed-os/requirements.txt
|
||||||
pip install -r targets/mbedos5/tools/requirements.txt
|
pip install -r targets/os/mbedos5/tools/requirements.txt
|
||||||
|
|
||||||
|
|
||||||
## Targets for building Mbed OS 5 with JerryScript.
|
## Targets for building Mbed OS 5 with JerryScript.
|
||||||
@@ -37,4 +37,4 @@ script:
|
|||||||
# HACK: `EXTRA_SRC[_MOD]` are abused to pass `--library` to `mbed compile` in the `all` make target that builds an app
|
# HACK: `EXTRA_SRC[_MOD]` are abused to pass `--library` to `mbed compile` in the `all` make target that builds an app
|
||||||
# HACK: this is needed because the Mbed OS 5 target code does not contain any `main` function, so the `all` make target does not link
|
# HACK: this is needed because the Mbed OS 5 target code does not contain any `main` function, so the `all` make target does not link
|
||||||
# HACK: but the `library` make target does not build either because the launcher sources require `jerry-targetjs.h` that are explicitly not generated for libraries
|
# HACK: but the `library` make target does not build either because the launcher sources require `jerry-targetjs.h` that are explicitly not generated for libraries
|
||||||
$(MAKE) -C targets/mbedos5 BOARD=K64F EXTRA_SRC=dummy EXTRA_SRC_MOD=--library
|
$(MAKE) -C targets/os/mbedos5 BOARD=K64F EXTRA_SRC=dummy EXTRA_SRC_MOD=--library
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
Generate pins.cpp for a specified target, using target definitions from the
|
Generate pins.cpp for a specified target, using target definitions from the
|
||||||
mbed OS source tree.
|
mbed OS source tree.
|
||||||
|
|
||||||
It's expecting to be run from the targets/mbedos5 directory.
|
It's expecting to be run from the targets/os/mbedos5 directory.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
@@ -21,7 +21,7 @@ STACKSIZE = $(CONFIG_INTERPRETERS_JERRYSCRIPT_STACKSIZE)
|
|||||||
|
|
||||||
# Path to the JerryScript and NuttX projects. If not specified, it is
|
# Path to the JerryScript and NuttX projects. If not specified, it is
|
||||||
# supposed that JerryScript is located next to the nuttx folder.
|
# supposed that JerryScript is located next to the nuttx folder.
|
||||||
JERRYSCRIPT_ROOT_DIR ?= ../../../jerryscript
|
JERRYSCRIPT_ROOT_DIR ?= ../../../../jerryscript
|
||||||
NUTTX_ROOT_DIR ?= $(JERRYSCRIPT_ROOT_DIR)/../nuttx
|
NUTTX_ROOT_DIR ?= $(JERRYSCRIPT_ROOT_DIR)/../nuttx
|
||||||
|
|
||||||
CFLAGS += -std=c99
|
CFLAGS += -std=c99
|
||||||
@@ -51,7 +51,7 @@ install: install-apt-get-deps install-noapt
|
|||||||
|
|
||||||
# Link in the NuttX JerryScript target directory under the NuttX apps tree.
|
# Link in the NuttX JerryScript target directory under the NuttX apps tree.
|
||||||
script-add-jerryscript-app:
|
script-add-jerryscript-app:
|
||||||
ln -s ../../jerryscript/targets/nuttx-stm32f4 ../apps/interpreters/jerryscript
|
ln -s ../../jerryscript/targets/os/nuttx ../apps/interpreters/jerryscript
|
||||||
|
|
||||||
# Configure USB shell.
|
# Configure USB shell.
|
||||||
script-configure-usbnsh:
|
script-configure-usbnsh:
|
||||||
@@ -29,7 +29,8 @@ The following directory structure is created after these commands:
|
|||||||
jerry-nuttx
|
jerry-nuttx
|
||||||
+ jerryscript
|
+ jerryscript
|
||||||
| + targets
|
| + targets
|
||||||
| + nuttx-stm32f4
|
| + os
|
||||||
|
| + nuttx
|
||||||
+ nuttx
|
+ nuttx
|
||||||
+ apps
|
+ apps
|
||||||
+ tools
|
+ tools
|
||||||
@@ -63,10 +64,10 @@ Move JerryScript application files to `apps/interpreters/jerryscript` folder.
|
|||||||
```sh
|
```sh
|
||||||
# Assuming you are in jerry-nuttx folder.
|
# Assuming you are in jerry-nuttx folder.
|
||||||
mkdir -p apps/interpreters/jerryscript
|
mkdir -p apps/interpreters/jerryscript
|
||||||
cp jerryscript/targets/nuttx-stm32f4/* apps/interpreters/jerryscript/
|
cp jerryscript/targets/os/nuttx/* apps/interpreters/jerryscript/
|
||||||
|
|
||||||
# Or more simply:
|
# Or more simply:
|
||||||
# ln -s jerryscript/targets/nuttx-stm32f4 apps/interpreters/jerryscript
|
# ln -s jerryscript/targets/os/nuttx apps/interpreters/jerryscript
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4. Build kconfig-frontend to configure NuttX
|
#### 4. Build kconfig-frontend to configure NuttX
|
||||||
@@ -18,17 +18,17 @@ APPLICATION = riot_jerryscript
|
|||||||
# default BOARD enviroment
|
# default BOARD enviroment
|
||||||
BOARD ?= stm32f4discovery
|
BOARD ?= stm32f4discovery
|
||||||
|
|
||||||
# path to jerryscript/targets/riot-stm32f4
|
# path to jerryscript/targets/os/riot
|
||||||
TARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
TARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
# path to the JERRYSCRIPT directory
|
# path to the JERRYSCRIPT directory
|
||||||
JERRYDIR ?= $(TARGET_DIR)/../..
|
JERRYDIR ?= $(TARGET_DIR)/../../..
|
||||||
|
|
||||||
# path to the RIOT base directory
|
# path to the RIOT base directory
|
||||||
RIOTBASE ?= $(JERRYDIR)/../RIOT
|
RIOTBASE ?= $(JERRYDIR)/../RIOT
|
||||||
|
|
||||||
# path to the application directory
|
# path to the application directory
|
||||||
APPDIR ?= $(JERRYDIR)/targets/riot-stm32f4/source
|
APPDIR ?= $(JERRYDIR)/targets/os/riot/source
|
||||||
|
|
||||||
# path to the binary directory
|
# path to the binary directory
|
||||||
BUILDDIR ?= $(JERRYDIR)/build/riot-stm32f4
|
BUILDDIR ?= $(JERRYDIR)/build/riot-stm32f4
|
||||||
@@ -37,4 +37,4 @@ install: install-apt-get-deps install-noapt
|
|||||||
|
|
||||||
# Build the firmware (RIOT with JerryScript).
|
# Build the firmware (RIOT with JerryScript).
|
||||||
script:
|
script:
|
||||||
$(MAKE) -f ./targets/riot-stm32f4/Makefile
|
$(MAKE) -f ./targets/os/riot/Makefile
|
||||||
@@ -35,7 +35,8 @@ The following directory structure has been created:
|
|||||||
jerry-riot
|
jerry-riot
|
||||||
+ jerryscript
|
+ jerryscript
|
||||||
| + targets
|
| + targets
|
||||||
| + riot-stm32f4
|
| + os
|
||||||
|
| + riot
|
||||||
+ RIOT
|
+ RIOT
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ jerry-riot
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Assuming you are in jerry-riot folder.
|
# Assuming you are in jerry-riot folder.
|
||||||
make BOARD=stm32f4discovery -f jerryscript/targets/riot-stm32f4/Makefile
|
make BOARD=stm32f4discovery -f jerryscript/targets/os/riot/Makefile
|
||||||
```
|
```
|
||||||
|
|
||||||
The created binary is a `riot_jerryscript.elf` named file located in `jerryscript/build/riot-stm32f4/bin/` folder.
|
The created binary is a `riot_jerryscript.elf` named file located in `jerryscript/build/riot-stm32f4/bin/` folder.
|
||||||
@@ -54,7 +55,7 @@ Connect Mini-USB for charging and flashing the device.
|
|||||||
|
|
||||||
```
|
```
|
||||||
# Assuming you are in jerry-riot folder.
|
# Assuming you are in jerry-riot folder.
|
||||||
make BOARD=stm32f4discovery -f jerryscript/targets/riot-stm32f4/Makefile flash
|
make BOARD=stm32f4discovery -f jerryscript/targets/os/riot/Makefile flash
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: `ST-LINK` also can be used that is described at [this page](https://github.com/RIOT-OS/RIOT/wiki/ST-LINK-tool).
|
Note: `ST-LINK` also can be used that is described at [this page](https://github.com/RIOT-OS/RIOT/wiki/ST-LINK-tool).
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user