Add support for Mbed-OS 6.15.0 (#4909)
The default Mbed OS device (STM32F4) had been changed to FRDM-K64F that is supported by both Mbed OS 5 and Mbed OS 6 versions. Makefile had also been modified to have a flash recipe. JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
This commit is contained in:
@@ -225,7 +225,7 @@ jobs:
|
|||||||
$RUNNER -q --jerry-tests --build-debug
|
$RUNNER -q --jerry-tests --build-debug
|
||||||
--buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static
|
--buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static
|
||||||
|
|
||||||
MbedOS5_K64F_Build_Test:
|
MbedOS_K64F_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
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -235,8 +235,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 mercurial
|
- run: sudo apt install gcc-arm-embedded python3-setuptools mercurial
|
||||||
- run: make -f ./targets/os/mbedos5/Makefile.travis install
|
- run: make -f ./targets/os/mbedos/Makefile.travis install
|
||||||
- run: make -f ./targets/os/mbedos5/Makefile.travis script
|
- run: make -f ./targets/os/mbedos/Makefile.travis script
|
||||||
|
|
||||||
Zephyr_STM32F4_Build_Test:
|
Zephyr_STM32F4_Build_Test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# default board: STM32F4-Discovery
|
# default board: FRDM-K64F
|
||||||
BOARD ?= DISCO_F407VG
|
BOARD ?= K64F
|
||||||
|
|
||||||
# defult toolchain
|
# defult toolchain
|
||||||
TOOLCHAIN ?= GCC_ARM
|
TOOLCHAIN ?= GCC_ARM
|
||||||
@@ -30,28 +30,44 @@ BUILD_DIR ?= $(JERRY_ROOT_DIR)/build/mbed-os
|
|||||||
# default jerry heap size (in KB)
|
# default jerry heap size (in KB)
|
||||||
JERRY_HEAP_SIZE ?= 70
|
JERRY_HEAP_SIZE ?= 70
|
||||||
|
|
||||||
|
define MBED_CLI_FLAGS
|
||||||
|
--clean
|
||||||
|
--build $(BUILD_DIR)
|
||||||
|
--source $(MBED_OS_DIR)
|
||||||
|
--source $(JERRY_ROOT_DIR)
|
||||||
|
--source $(JERRY_TARGET_DIR)
|
||||||
|
--toolchain $(TOOLCHAIN)
|
||||||
|
--target $(BOARD)
|
||||||
|
--artifact-name mbedos
|
||||||
|
--macro JERRY_GLOBAL_HEAP_SIZE=$(JERRY_HEAP_SIZE)
|
||||||
|
endef
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: .mbedignore-copy .mbed-build .mbedignore-remove
|
all: .build
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean: .mbedignore-remove
|
||||||
rm -rf $(JERRY_ROOT_DIR)/build/mbed-os
|
rm -rf $(JERRY_ROOT_DIR)/build/mbed-os
|
||||||
|
|
||||||
|
.PHONY: flash
|
||||||
|
flash: .mbed-set-flash-flag .build
|
||||||
|
|
||||||
|
.PHONY: .mbed-set-flash-flag
|
||||||
|
.mbed-set-flash-flag:
|
||||||
|
$(eval MBED_CLI_FLAGS += --flash)
|
||||||
|
|
||||||
|
.PHONY: .build
|
||||||
|
.build: .mbedignore-copy .mbed-build .mbedignore-remove
|
||||||
|
|
||||||
.PHONY: .mbed-build
|
.PHONY: .mbed-build
|
||||||
.mbed-build:
|
.mbed-build:
|
||||||
mbed config -G MBED_OS_DIR $(MBED_OS_DIR)
|
mbed config -G MBED_OS_DIR $(MBED_OS_DIR)
|
||||||
mbed compile \
|
mbed compile $(strip $(MBED_CLI_FLAGS))
|
||||||
--clean \
|
|
||||||
--build $(BUILD_DIR) \
|
|
||||||
--source $(MBED_OS_DIR) \
|
|
||||||
--source $(JERRY_ROOT_DIR) \
|
|
||||||
--source $(JERRY_TARGET_DIR) \
|
|
||||||
--toolchain $(TOOLCHAIN) \
|
|
||||||
--target $(BOARD) \
|
|
||||||
--macro JERRY_GLOBAL_HEAP_SIZE=$(JERRY_HEAP_SIZE)
|
|
||||||
|
|
||||||
|
.PHONY: .mbedignore-copy
|
||||||
.mbedignore-copy:
|
.mbedignore-copy:
|
||||||
cp .mbedignore $(JERRY_ROOT_DIR)
|
cp mbedignore.txt $(JERRY_ROOT_DIR)/.mbedignore
|
||||||
|
|
||||||
|
.PHONY: .mbedignore-remove
|
||||||
.mbedignore-remove:
|
.mbedignore-remove:
|
||||||
rm $(JERRY_ROOT_DIR)/.mbedignore
|
rm -f $(JERRY_ROOT_DIR)/.mbedignore
|
||||||
@@ -19,10 +19,10 @@ all:
|
|||||||
$(MAKE) script
|
$(MAKE) script
|
||||||
|
|
||||||
|
|
||||||
## Targets for installing build dependencies of the Mbed OS 5 JerryScript target.
|
## Targets for installing build dependencies of the Mbed OS JerryScript target.
|
||||||
|
|
||||||
install-mbedos:
|
install-mbedos:
|
||||||
git clone https://github.com/ARMmbed/mbed-os.git ../mbed-os -b mbed-os-5.15
|
git clone https://github.com/ARMmbed/mbed-os.git ../mbed-os -b mbed-os-6.15.0
|
||||||
|
|
||||||
# Deploy Mbed and install Mbed Python dependencies.
|
# Deploy Mbed and install Mbed Python dependencies.
|
||||||
install-mbedos-deps:
|
install-mbedos-deps:
|
||||||
@@ -31,8 +31,8 @@ install-mbedos-deps:
|
|||||||
|
|
||||||
install: install-mbedos install-mbedos-deps
|
install: install-mbedos install-mbedos-deps
|
||||||
|
|
||||||
## Targets for building Mbed OS 5 with JerryScript.
|
## Targets for building Mbed OS with JerryScript.
|
||||||
|
|
||||||
# Build the firmware (Mbed OS 5 with JerryScript).
|
# Build the firmware (Mbed OS with JerryScript).
|
||||||
script:
|
script:
|
||||||
$(MAKE) -C targets/os/mbedos5 BOARD=K64F MBED_OS_DIR=$(realpath ../mbed-os)
|
$(MAKE) -C targets/os/mbedos MBED_OS_DIR=$(realpath ../mbed-os)
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
### About
|
||||||
|
|
||||||
|
This folder contains files to run JerryScript on
|
||||||
|
[FRDM-K64F board](https://os.mbed.com/platforms/frdm-k64f/) with
|
||||||
|
[Mbed OS](https://os.mbed.com/).
|
||||||
|
The document had been validated on Ubuntu 20.04 operating system.
|
||||||
|
|
||||||
|
#### 1. Setup the build environment
|
||||||
|
|
||||||
|
Clone the necessary projects into a `jerry-mbedos` directory.
|
||||||
|
The latest tested working version of Mbed is `mbed-os-6.15.0`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mkdir jerry-mbedos && cd jerry-mbedos
|
||||||
|
|
||||||
|
git clone https://github.com/jerryscript-project/jerryscript.git
|
||||||
|
git clone https://github.com/ARMmbed/mbed-os.git -b mbed-os-6.15.0
|
||||||
|
```
|
||||||
|
|
||||||
|
The following directory structure has been created:
|
||||||
|
|
||||||
|
```
|
||||||
|
jerry-mbedos
|
||||||
|
+ jerryscript
|
||||||
|
| + targets
|
||||||
|
| + os
|
||||||
|
| + mbedos
|
||||||
|
+ mbed-os
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. Install dependencies of the projects
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Assuming you are in jerry-mbedos folder.
|
||||||
|
jerryscript/tools/apt-get-install-deps.sh
|
||||||
|
|
||||||
|
sudo apt install stlink-tools
|
||||||
|
pip install --user mbed-cli
|
||||||
|
# Install Python dependencies of Mbed OS.
|
||||||
|
pip install --user -r mbed-os/requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. Build Mbed OS (with JerryScript)
|
||||||
|
|
||||||
|
```
|
||||||
|
# Assuming you are in jerry-mbedos folder.
|
||||||
|
make -C jerryscript/targets/os/mbedos MBED_OS_DIR=${PWD}/mbed-os
|
||||||
|
```
|
||||||
|
|
||||||
|
The created binary is a `mbedos.bin` named file located in `jerryscript/build/mbed-os` folder.
|
||||||
|
|
||||||
|
#### 4. Flash
|
||||||
|
|
||||||
|
Connect Micro-USB for charging and flashing the device.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Assuming you are in jerry-mbedos folder.
|
||||||
|
make -C jerryscript/targets/os/mbedos MBED_OS_DIR=${PWD}/mbed-os flash
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 5. Connect to the device
|
||||||
|
|
||||||
|
The device should be visible as `/dev/ttyACM0` on the host.
|
||||||
|
You can use `minicom` communication program with `115200` baud rate.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo minicom --device=/dev/ttyACM0 --baud=115200
|
||||||
|
```
|
||||||
|
|
||||||
|
Set `Add Carriage Ret` option in `minicom` by `CTRL-A -> Z -> U` key combinations.
|
||||||
|
Press `RESET` on the board to get the output of JerryScript application:
|
||||||
|
|
||||||
|
```
|
||||||
|
This test run the following script code: [print ('Hello, World!');]
|
||||||
|
|
||||||
|
Hello, World!
|
||||||
|
```
|
||||||
@@ -26,12 +26,16 @@
|
|||||||
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
|
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
|
||||||
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
|
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
|
||||||
|
|
||||||
int
|
#if MBED_MAJOR_VERSION == 5
|
||||||
main ()
|
static Serial serial(USBTX, USBRX, 115200);
|
||||||
{
|
#elif MBED_MAJOR_VERSION == 6
|
||||||
Serial device (USBTX, USBRX); // tx, rx
|
static BufferedSerial serial(USBTX, USBRX, 115200);
|
||||||
device.baud (115200);
|
#else
|
||||||
|
#error Unsupported Mbed OS version.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
/* Initialize engine */
|
/* Initialize engine */
|
||||||
jerry_init (JERRY_INIT_EMPTY);
|
jerry_init (JERRY_INIT_EMPTY);
|
||||||
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
### About
|
|
||||||
|
|
||||||
This folder contains files to run JerryScript on
|
|
||||||
[STM32F4-Discovery board](https://www.st.com/en/evaluation-tools/stm32f4discovery.html) with
|
|
||||||
[Mbed OS 5](https://os.mbed.com/).
|
|
||||||
The document had been validated on Ubuntu 20.04 operating system.
|
|
||||||
|
|
||||||
#### 1. Setup the build environment
|
|
||||||
|
|
||||||
Clone the necessary projects into a `jerry-mbedos` directory.
|
|
||||||
The latest tested working version of Mbed is `5.15`.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir jerry-mbedos && cd jerry-mbedos
|
|
||||||
|
|
||||||
git clone https://github.com/jerryscript-project/jerryscript.git
|
|
||||||
git clone https://github.com/ARMmbed/mbed-os.git -b mbed-os-5.15
|
|
||||||
```
|
|
||||||
|
|
||||||
The following directory structure has been created:
|
|
||||||
|
|
||||||
```
|
|
||||||
jerry-mbedos
|
|
||||||
+ jerryscript
|
|
||||||
| + targets
|
|
||||||
| + os
|
|
||||||
| + mbedos5
|
|
||||||
+ mbed-os
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Install dependencies of the projects
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Assuming you are in jerry-mbedos folder.
|
|
||||||
jerryscript/tools/apt-get-install-deps.sh
|
|
||||||
|
|
||||||
sudo apt install stlink-tools
|
|
||||||
pip install mbed-cli
|
|
||||||
# Install Python dependencies of Mbed OS.
|
|
||||||
pip install --user -r mbed-os/requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4. Build Mbed OS (with JerryScript)
|
|
||||||
|
|
||||||
```
|
|
||||||
# Assuming you are in jerry-mbedos folder.
|
|
||||||
make -C jerryscript/targets/os/mbedos5 MBED_OS_DIR=${PWD}/mbed-os
|
|
||||||
```
|
|
||||||
|
|
||||||
The created binary is a `mbed-os.bin` named file located in `jerryscript/build/mbed-os` folder.
|
|
||||||
|
|
||||||
#### 5. Flash
|
|
||||||
|
|
||||||
Connect Mini-USB for charging and flashing the device.
|
|
||||||
|
|
||||||
```
|
|
||||||
# Assuming you are in jerry-riot folder.
|
|
||||||
sudo st-flash write jerryscript/build/mbed-os/mbed-os.bin 0x8000000
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6. Connect to the device
|
|
||||||
|
|
||||||
Use `USB To TTL Serial Converter` for serial communication. STM32F4-Discovery pins are mapped by Mbed OS as follows:
|
|
||||||
|
|
||||||
```
|
|
||||||
STM32f4-Discovery PA2 pin is configured for TX.
|
|
||||||
STM32f4-Discovery PA3 pin is configured for RX.
|
|
||||||
```
|
|
||||||
|
|
||||||
* Connect `STM32f4-Discovery` **PA2** pin to **RX** pin of `USB To TTL Serial Converter`
|
|
||||||
* Connect `STM32f4-Discovery` **PA3** pin to **TX** pin of `USB To TTL Serial Converter`
|
|
||||||
* Connect `STM32f4-Discovery` **GND** pin to **GND** pin of `USB To TTL Serial Converter`
|
|
||||||
|
|
||||||
The device should be visible as `/dev/ttyUSB0`. Use `minicom` communication program with `115200`.
|
|
||||||
|
|
||||||
* In `minicom`, set `Add Carriage Ret` to `off` in by `CTRL-A -> Z -> U` key combinations.
|
|
||||||
* In `minicom`, set `Hardware Flow Control` to `no` by `CTRL-A -> Z -> O -> Serial port setup -> F` key combinations.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo minicom --device=/dev/ttyUSB0 --baud=115200
|
|
||||||
```
|
|
||||||
|
|
||||||
Press `RESET` on the board to get the output of JerryScript application:
|
|
||||||
|
|
||||||
```
|
|
||||||
This test run the following script code: [print ('Hello, World!');]
|
|
||||||
|
|
||||||
Hello, World!
|
|
||||||
```
|
|
||||||
Reference in New Issue
Block a user