mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
* Removed hardware specific implementations * Added simple 'hello world' demo code to be aligned to other targets * Added ability to use external resources from outside JerryScript folder JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
About
This folder contains files to run JerryScript on STM32F4-Discovery board with Mbed OS 5. 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.
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
# 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-DiscoveryPA2 pin to RX pin ofUSB To TTL Serial Converter - Connect
STM32f4-DiscoveryPA3 pin to TX pin ofUSB To TTL Serial Converter - Connect
STM32f4-DiscoveryGND pin to GND pin ofUSB To TTL Serial Converter
The device should be visible as /dev/ttyUSB0. Use minicom communication program with 115200.
- In
minicom, setAdd Carriage Rettooffin byCTRL-A -> Z -> Ukey combinations. - In
minicom, setHardware Flow ControltonobyCTRL-A -> Z -> O -> Serial port setup -> Fkey combinations.
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!