Related to #4186. Some notable changes: - The term 'Error' now strictly refers to native Error objects defined in the ECMA standard, which are ordinary objects. All other uses of 'error' or 'error reference' where the term refers to a thrown value is now called 'exception'. - Simplified the naming scheme of many String API functions. These functions will now also take an 'encoding' argument to specify the desired encoding in which to operate. - Removed the substring-copy-to-buffer functions. These functions behaved awkwardly, as they use character index to specify the start/end positions, and were mostly used incorrectly with byte offsets instead. The functionality can still be replicated with other functions if necessary. - String-to-buffer functions will no longer fail if the buffer is not sufficiently large, the string will instead be cropped. - Fixed the usage of the '_sz' prefix in many API functions. The term 'sz' means zero-terminated string in hungarian notation, this was used incorrectly in many cases. - Renamed most of the public API functions to have shorter, more on-point names, rather than the often too long descriptive names. Functions are now also grouped by the type of value they operate on, where this makes sense. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
About
This folder contains files to run JerryScript on STM32F4-Discovery board with RIOT. The document had been validated on Ubuntu 20.04 operating system.
How to build
1. Setup the build environment for STM32F4-Discovery board
Clone the necessary projects into a jerry-riot directory.
The latest tested working version of RIOT is 2021.10.
# Create a base folder for all the projects.
mkdir jerry-riot && cd jerry-riot
git clone https://github.com/jerryscript-project/jerryscript.git
git clone https://github.com/RIOT-OS/RIOT.git -b 2021.10
2. Install dependencies of the projects
# Assuming you are in jerry-riot folder.
jerryscript/tools/apt-get-install-deps.sh
sudo apt install gcc-arm-none-eabi openocd minicom
The following directory structure has been created:
jerry-riot
+ jerryscript
| + targets
| + riot-stm32f4
+ RIOT
3. Build RIOT (with JerryScript)
# Assuming you are in jerry-riot folder.
make BOARD=stm32f4discovery -f jerryscript/targets/riot-stm32f4/Makefile
The created binary is a riot_jerryscript.elf named file located in jerryscript/build/riot-stm32f4/bin/ folder.
4. Flash the device
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
Note: ST-LINK also can be used that is described at this page.
5. Connect to the device
Use USB To TTL Serial Converter for serial communication. STM32F4-Discovery pins are mapped by RIOT 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
RIOT prompt looks like as follows:
main(): This is RIOT! (Version: 2021.10)
You are running RIOT on a(n) stm32f4discovery board.
This board features a(n) stm32 MCU.
>
You may have to press RESET on the board and press Enter key on the console several times to make RIOT prompt visible.
6. Run JerrySript
Type help to list shell commands:
> help
Command Description
---------------------------------------
test Jerryscript Hello World test
reboot Reboot the node
version Prints current RIOT_VERSION
pm interact with layered PM subsystem
Type test to execute JerryScript:
> test
This test run the following script code: [print ('Hello, World!');]
Hello, World!