Skip to content

Commit

Permalink
Separate targets into os and baremetal-sdk parts
Browse files Browse the repository at this point in the history
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
  • Loading branch information
rtakacs committed Dec 6, 2021
1 parent 9860d66 commit 3798846
Show file tree
Hide file tree
Showing 110 changed files with 119 additions and 85 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -268,17 +268,17 @@ 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
steps:
- 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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
```
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -245,7 +245,7 @@ def main(curie_path, project_name, jerry_path):
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)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SUBDIRS= user
endif # } PDIR

# path to the JERRYSCRIPT directory
JERRYDIR ?= $(CURDIR)/../../..
JERRYDIR ?= $(CURDIR)/../../../..

LDDIR = $(SDK_PATH)/ld

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions targets/baremetal-sdk/esp8266-rtos-sdk/js/blink.js
Original file line number Diff line number Diff line change
@@ -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");
20 changes: 20 additions & 0 deletions targets/baremetal-sdk/esp8266-rtos-sdk/js/main.js
Original file line number Diff line number Diff line change
@@ -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");
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
```


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ The folder tree related would look like this.
root
+ jerryscript
| + targets
| + particle
| + os
| + particle
+ particle
| + firmware
```
Expand Down Expand Up @@ -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:
Expand All @@ -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 Photon’s application memory:
Expand All @@ -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
Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions targets/esp8266/js/blink.js

This file was deleted.

5 changes: 0 additions & 5 deletions targets/esp8266/js/main.js

This file was deleted.

File renamed without changes.
14 changes: 7 additions & 7 deletions targets/mbedos5/Makefile → targets/os/mbedos5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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=

Expand Down Expand Up @@ -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)
Expand All @@ -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}
Expand All @@ -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
Loading

0 comments on commit 3798846

Please sign in to comment.