Files
jerryscript/targets/nuttx-stm32f4/README.md
T
Zsolt Borbély 1e82ae1eb5 Update the nuttx-stm32f4 target
Related issue: #1202

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-08-26 15:38:14 +02:00

116 lines
2.6 KiB
Markdown

### About
This folder contains files to run JerryScript on
[STM32F4-Discovery board](http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/stm32f4discovery.html) with [NuttX](http://nuttx.org/)
### How to build
#### 1. Setting up the build environment for STM32F4-Discovery board
Clone JerryScript and NuttX into jerry-nuttx directory
```
mkdir jerry-nuttx
cd jerry-nuttx
git clone https://github.com/Samsung/jerryscript.git
git clone https://bitbucket.org/nuttx/nuttx.git
git clone https://bitbucket.org/nuttx/apps.git
git clone https://github.com/texane/stlink.git
```
The following directory structure is created after these commands
```
jerry-nuttx
+ apps
+ jerryscript
| + targets
| + nuttx-stm32f4
+ nuttx
+ stlink
```
#### 2. Adding JerryScript as an interpreter for NuttX
```
cd apps/interpreters
mkdir jerryscript
cp ../../jerryscript/targets/nuttx-stm32f4/* ./jerryscript/
```
#### 3. Configure NuttX
```
# assuming you are in jerry-nuttx folder
cd nuttx/tools
# configure NuttX USB console shell
./configure.sh stm32f4discovery/usbnsh
cd ..
# might require to run "make menuconfig" twice
make menuconfig
```
Change "Build Setup" -> "Build Host Platform" from "Windows" to "Linux"
Enable "System Type" -> "FPU support"
Enable "Library Routines" -> "Standard Math library"
Enable "Application Configuration" -> "Interpreters->JerryScript"
#### 4. Build JerryScript for NuttX
```
# assuming you are in jerry-nuttx folder
cd nuttx/
make
```
#### 5. Flashing
Connect Mini-USB for power supply and connect Micro-USB for `NSH` console.
To configure `stlink` utility for flashing, follow the instructions [here](https://github.com/texane/stlink#build-from-sources).
To flash,
```
# assuming you are in nuttx folder
sudo ../stlink/build/st-flash write nuttx.bin 0x8000000
```
### Running JerryScript
You can use `minicom` for terminal program, or any other you may like, but set
baud rate to `115200`.
```
sudo minicom --device=/dev/ttyACM0 --baud=115200
```
You may have to press `RESET` on the board and press `Enter` keys on the console
several times to make `nsh` prompt to appear.
If the prompt shows like this,
```
NuttShell (NSH)
nsh>
nsh>
nsh>
```
please set `Add Carriage Ret` option by `CTRL-A` > `Z` > `U` at the console,
if you're using `minicom`.
Run `jerry` with javascript file(s)
```
NuttShell (NSH)
nsh> jerry full_path/any.js
```
Without argument it prints:
```
nsh> jerry
No input files, running a hello world demo:
Hello world 5 times from JerryScript
```