1425bb815Sopenharmony_ci### About 2425bb815Sopenharmony_ci 3425bb815Sopenharmony_ciThis folder contains files to run JerryScript on RIOT-OS with STM32F4-Discovery board. 4425bb815Sopenharmony_ci 5425bb815Sopenharmony_ci### How to build 6425bb815Sopenharmony_ci 7425bb815Sopenharmony_ci#### 1. Preface 8425bb815Sopenharmony_ci 9425bb815Sopenharmony_ci1, Directory structure 10425bb815Sopenharmony_ci 11425bb815Sopenharmony_ciAssume `harmony` as the path to the projects to build. 12425bb815Sopenharmony_ciThe folder tree related would look like this. 13425bb815Sopenharmony_ci 14425bb815Sopenharmony_ci``` 15425bb815Sopenharmony_ciharmony 16425bb815Sopenharmony_ci + jerryscript 17425bb815Sopenharmony_ci | + targets 18425bb815Sopenharmony_ci | + riot-stm32f4 19425bb815Sopenharmony_ci + RIOT 20425bb815Sopenharmony_ci``` 21425bb815Sopenharmony_ci 22425bb815Sopenharmony_ci2, Target board 23425bb815Sopenharmony_ci 24425bb815Sopenharmony_ciAssume [STM32F4-Discovery with BB](http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/LN1199/PF255417) 25425bb815Sopenharmony_cias the target board. 26425bb815Sopenharmony_ci 27425bb815Sopenharmony_ci#### 2. Prepare RIOT-OS 28425bb815Sopenharmony_ci 29425bb815Sopenharmony_ciFollow [this](https://www.riot-os.org/#download) page to get the RIOT-OS source. 30425bb815Sopenharmony_ci 31425bb815Sopenharmony_ciFollow the [Inroduction](https://github.com/RIOT-OS/RIOT/wiki/Introduction) wiki site and also check that you can flash the stm32f4-board. 32425bb815Sopenharmony_ci 33425bb815Sopenharmony_ci 34425bb815Sopenharmony_ci#### 3. Build JerryScript for RIOT-OS 35425bb815Sopenharmony_ci 36425bb815Sopenharmony_ci``` 37425bb815Sopenharmony_ci# assume you are in harmony folder 38425bb815Sopenharmony_cicd jerryscript 39425bb815Sopenharmony_cimake -f ./targets/riot-stm32f4/Makefile.riot 40425bb815Sopenharmony_ci``` 41425bb815Sopenharmony_ci 42425bb815Sopenharmony_ciThis will generate the following libraries: 43425bb815Sopenharmony_ci``` 44425bb815Sopenharmony_ci/build/bin/release.riotstm32f4/librelease.jerry-core.a 45425bb815Sopenharmony_ci/build/bin/release.riotstm32f4/librelease.jerry-libm.lib.a 46425bb815Sopenharmony_ci``` 47425bb815Sopenharmony_ci 48425bb815Sopenharmony_ciThis will copy one library files to `targets/riot-stm32f4/bin` folder: 49425bb815Sopenharmony_ci``` 50425bb815Sopenharmony_cilibjerrycore.a 51425bb815Sopenharmony_ci``` 52425bb815Sopenharmony_ci 53425bb815Sopenharmony_ciThis will create a hex file in the `targets/riot-stm32f4/bin` folder: 54425bb815Sopenharmony_ci``` 55425bb815Sopenharmony_ciriot_jerry.elf 56425bb815Sopenharmony_ci``` 57425bb815Sopenharmony_ci 58425bb815Sopenharmony_ci#### 4. Flashing 59425bb815Sopenharmony_ci 60425bb815Sopenharmony_ci``` 61425bb815Sopenharmony_cimake -f ./targets/riot-stm32f4/Makefile.riot flash 62425bb815Sopenharmony_ci``` 63425bb815Sopenharmony_ci 64425bb815Sopenharmony_ciFor how to flash the image with other alternative way can be found here: 65425bb815Sopenharmony_ci[Alternative way to flash](https://github.com/RIOT-OS/RIOT/wiki/Board:-STM32F4discovery#alternative-way-to-flash) 66425bb815Sopenharmony_ci 67425bb815Sopenharmony_ci#### 5. Cleaning 68425bb815Sopenharmony_ci 69425bb815Sopenharmony_ciTo clean the build result: 70425bb815Sopenharmony_ci``` 71425bb815Sopenharmony_cimake -f ./targets/riot-stm32f4/Makefile.riot clean 72425bb815Sopenharmony_ci``` 73425bb815Sopenharmony_ci 74425bb815Sopenharmony_ci 75425bb815Sopenharmony_ci### 5. Running JerryScript Hello World! example 76425bb815Sopenharmony_ci 77425bb815Sopenharmony_ciYou may have to press `RESET` on the board after the flash. 78425bb815Sopenharmony_ci 79425bb815Sopenharmony_ciYou can use `minicom` for terminal program, and if the prompt shows like this: 80425bb815Sopenharmony_ci``` 81425bb815Sopenharmony_cimain(): This is RIOT! (Version: ****) 82425bb815Sopenharmony_ci You are running RIOT on a(n) stm32f4discovery board. 83425bb815Sopenharmony_ci This board features a(n) stm32f4 MCU. 84425bb815Sopenharmony_ci``` 85425bb815Sopenharmony_ciplease set `Add Carriage Ret` option by `CTRL-A` > `Z` > `U` at the console, if you're using `minicom`. 86425bb815Sopenharmony_ci 87425bb815Sopenharmony_ci 88425bb815Sopenharmony_ciHelp will provide a list of commands: 89425bb815Sopenharmony_ci``` 90425bb815Sopenharmony_ci> help 91425bb815Sopenharmony_ci``` 92425bb815Sopenharmony_ci 93425bb815Sopenharmony_ciThe `test` command will run the test example, which contains the following script code: 94425bb815Sopenharmony_ci``` 95425bb815Sopenharmony_ciprint ('Hello, World!'); 96425bb815Sopenharmony_ci``` 97