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:
Roland Takacs
2021-12-06 11:02:52 +01:00
committed by GitHub
parent 9860d66a56
commit af297bc578
110 changed files with 119 additions and 85 deletions
+10 -10
View File
@@ -256,8 +256,8 @@ jobs:
- run: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
- run: sudo apt update
- run: sudo apt install gcc-arm-embedded python3-setuptools
- run: make -f ./targets/mbedos5/Makefile.travis install
- run: make -f ./targets/mbedos5/Makefile.travis script
- run: make -f ./targets/os/mbedos5/Makefile.travis install
- run: make -f ./targets/os/mbedos5/Makefile.travis script
Zephyr_STM32F4_Build_Test:
runs-on: ubuntu-latest
@@ -268,8 +268,8 @@ jobs:
python-version: '3.x'
- run: sudo apt update
- run: sudo apt install gperf dfu-util device-tree-compiler
- run: make -f ./targets/zephyr/Makefile.travis install
- run: make -f ./targets/zephyr/Makefile.travis script
- run: make -f ./targets/os/zephyr/Makefile.travis install
- run: make -f ./targets/os/zephyr/Makefile.travis script
NuttX_STM32F4_Build_Test:
runs-on: ubuntu-latest
@@ -277,8 +277,8 @@ jobs:
- uses: actions/checkout@v2
- run: sudo apt update
- 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/nuttx-stm32f4/Makefile.travis script
- run: make -f ./targets/os/nuttx/Makefile.travis install-noapt
- run: make -f ./targets/os/nuttx/Makefile.travis script
RIOT_STM32F4_Build_Test:
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 apt update
- run: sudo apt install clang gcc-arm-embedded gcc-multilib
- run: make -f ./targets/riot-stm32f4/Makefile.travis install-noapt
- run: make -f ./targets/riot-stm32f4/Makefile.travis script
- run: make -f ./targets/os/riot/Makefile.travis install-noapt
- run: make -f ./targets/os/riot/Makefile.travis script
ESP8266_Build_Test:
runs-on: ubuntu-latest
@@ -299,8 +299,8 @@ jobs:
- uses: actions/setup-python@v2
with:
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/esp8266/Makefile.travis script
- run: make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.travis install-noapt
- run: make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.travis script
Notification:
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
##### 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>
```

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 = [
{ # 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'
},
{ # 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'
},
{ # 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'
},
{ # quark/jerryscript
@@ -76,7 +76,7 @@ def build_jerry_data(jerry_path):
"""
jerry_sources = []
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):
path = os.path.join('jerryscript', file)
jerry_sources.append(path)
@@ -199,7 +199,7 @@ def create_quark_kbuild(project_path, jerry_path):
'include',
'jerryscript',
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'])
quark_includes = [
@@ -245,7 +245,7 @@ if __name__ == '__main__':
project_name = 'curie_bsp_jerry'
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])
main(curie_path, project_name, jerry_path)
@@ -2,10 +2,10 @@
# - set the JERRY_DIR wherever the jerryscript source code (the include files) is
# - a "lib" directory with the 2 libraries below
set(JERRY_DIR ${PROJECT_DIR}/../../jerryscript/)
set(JERRY_DIR ${PROJECT_DIR}/../../../jerryscript/)
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
)
@@ -16,7 +16,7 @@ Then copy the artifacts 'build/lib/\*.a' in an esp-idf component named 'jerryscr
set(JERRY_DIR ${PROJECT_DIR}/../../jerryscript/)
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
)
@@ -41,7 +41,7 @@ SUBDIRS= user
endif # } PDIR
# path to the JERRYSCRIPT directory
JERRYDIR ?= $(CURDIR)/../../..
JERRYDIR ?= $(CURDIR)/../../../..
LDDIR = $(SDK_PATH)/ld
@@ -15,7 +15,7 @@
CURDIR = `pwd`
ESP_LIB = $(SDK_PATH)/lib
BUILD_DIR = build/obj-esp8266
COPYTARGET = targets/esp8266/libs
COPYTARGET = targets/baremetal-sdk/esp8266-rtos-sdk/libs
USBDEVICE ?= /dev/ttyUSB0
JERRYHEAP ?= 20
ESPTOOL ?= $(ESPTOOL_PATH)/esptool.py
@@ -61,11 +61,11 @@ jerry:
cp $(BUILD_DIR)/lib/libjerry-math.a $(COPYTARGET)/
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:
make -Ctargets/esp8266 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 clean
make -Ctargets/baremetal-sdk/esp8266-rtos-sdk BOOT=new APP=0 SPI_SPEED=40 SPI_MODE=DIO SPI_SIZE_MAP=4
check-env:
ifndef SDK_PATH
@@ -43,4 +43,4 @@ install: install-apt-get-deps install-noapt
# Build the firmware (ESP8266 with JerryScript).
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
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.
You can view online from
[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
make -f ./targets/esp8266/Makefile.esp8266
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266
```
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.
```
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;
```
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
@@ -49,12 +49,12 @@ LED should blink on and off every second
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:
```
make -f ./targets/esp8266/Makefile.esp8266 erase_flash
make -f ./targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266 erase_flash
```
@@ -29,7 +29,7 @@ PARTICLE_BUILD_CONFIG = \
LIBS=jerry-core \
PLATFORM=photon \
LIB_DIRS=$(BUILD_DIR)/lib \
APPDIR=$(JERRYDIR)/targets/particle/source \
APPDIR=$(JERRYDIR)/targets/baremetal-sdk/particle/source \
TARGET_FILE=jerry_main \
TARGET_DIR=$(BUILD_DIR) \
LDFLAGS=--specs=nano.specs
@@ -14,7 +14,8 @@ The folder tree related would look like this.
root
+ jerryscript
| + targets
| + particle
| + os
| + particle
+ particle
| + firmware
```
@@ -53,7 +54,7 @@ make PLATFORM=photon clean all program-dfu
```
# assume you are in root folder
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:
@@ -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:
```
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 Photons 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:
```
make -f targets/particle/Makefile.particle clean
make -f targets/baremetal-sdk/particle/Makefile.particle clean
```
### Running the example
-15
View File
@@ -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");
-5
View File
@@ -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
MBED_VERBOSE?=0
MBED_CLI_FLAGS=-j0 --source . --source ../../
MBED_CLI_FLAGS=-j0 --source . --source ../../../
EXTRA_SRC=
@@ -52,11 +52,11 @@ MBED_CLI_FLAGS += -D "JERRY_GLOBAL_HEAP_SIZE=$(HEAPSIZE)"
MBED_CLI_FLAGS += -t GCC_ARM
.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 compile $(MBED_CLI_FLAGS)
library: .mbed ../../.mbedignore
library: .mbed ../../../.mbedignore
# delete encoded js code if it exists
rm -f source/jerry-targetjs.h
mbed target $(BOARD)
@@ -66,7 +66,7 @@ clean:
rm -rf ./BUILD/$(BOARD)
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:
python tools/generate_pins.py ${BOARD}
@@ -86,9 +86,9 @@ getlibs: .mbed
mbed target $(BOARD)
mbed deploy
../../.mbedignore:
../../../.mbedignore:
ifeq ($(OS),Windows_NT)
copy template-mbedignore.txt ..\..\.mbedignore
copy template-mbedignore.txt ..\..\..\.mbedignore
else
cp ./template-mbedignore.txt ../../.mbedignore
cp ./template-mbedignore.txt ../../../.mbedignore
endif
@@ -24,10 +24,10 @@ all:
# Deploy Mbed and install Mbed Python dependencies.
install:
pip install mbed-cli
cd targets/mbedos5 && mbed deploy
cd targets/os/mbedos5 && mbed deploy
pip install idna==2.5 # FIXME: workaround
pip install -r targets/mbedos5/mbed-os/requirements.txt
pip install -r targets/mbedos5/tools/requirements.txt
pip install -r targets/os/mbedos5/mbed-os/requirements.txt
pip install -r targets/os/mbedos5/tools/requirements.txt
## 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: 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
$(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
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
@@ -21,7 +21,7 @@ STACKSIZE = $(CONFIG_INTERPRETERS_JERRYSCRIPT_STACKSIZE)
# Path to the JerryScript and NuttX projects. If not specified, it is
# 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
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.
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.
script-configure-usbnsh:
@@ -29,7 +29,8 @@ The following directory structure is created after these commands:
jerry-nuttx
+ jerryscript
| + targets
| + nuttx-stm32f4
| + os
| + nuttx
+ nuttx
+ apps
+ tools
@@ -63,10 +64,10 @@ Move JerryScript application files to `apps/interpreters/jerryscript` folder.
```sh
# Assuming you are in jerry-nuttx folder.
mkdir -p apps/interpreters/jerryscript
cp jerryscript/targets/nuttx-stm32f4/* apps/interpreters/jerryscript/
cp jerryscript/targets/os/nuttx/* apps/interpreters/jerryscript/
# 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
@@ -18,17 +18,17 @@ APPLICATION = riot_jerryscript
# default BOARD enviroment
BOARD ?= stm32f4discovery
# path to jerryscript/targets/riot-stm32f4
# path to jerryscript/targets/os/riot
TARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# path to the JERRYSCRIPT directory
JERRYDIR ?= $(TARGET_DIR)/../..
JERRYDIR ?= $(TARGET_DIR)/../../..
# path to the RIOT base directory
RIOTBASE ?= $(JERRYDIR)/../RIOT
# path to the application directory
APPDIR ?= $(JERRYDIR)/targets/riot-stm32f4/source
APPDIR ?= $(JERRYDIR)/targets/os/riot/source
# path to the binary directory
BUILDDIR ?= $(JERRYDIR)/build/riot-stm32f4
@@ -37,4 +37,4 @@ install: install-apt-get-deps install-noapt
# Build the firmware (RIOT with JerryScript).
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
+ jerryscript
| + targets
| + riot-stm32f4
| + os
| + riot
+ RIOT
```
@@ -43,7 +44,7 @@ jerry-riot
```
# 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.
@@ -54,7 +55,7 @@ Connect Mini-USB for charging and flashing the device.
```
# 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).

Some files were not shown because too many files have changed in this diff Show More