7. Start with RT-Thread package
PikaScript has been added to the RT-Thread package. Under the programming language category, you can quickly use PikaScript by directly adding packages.
The PikaScript package supports full RT-Thread BSP. If you encounter compatibility problems during use, you can file an issue at gitee, github or Forum to ask questions.
7.1. Install
Import the pikascript package
image
image
image
image
Add RT_WEAK before rt_vsnprintf in rt-thread/src/kservice.c (only for rt_thread version 4.1.0 and below)
Delete the static (only for rt_thread version 4.1.0 and below) of finsh_getchar in rt-thread/components/finsh/shell.c
7.2. start pikascript
Option 1: Start with msh (default mode)
Use the pikaRTThread module in packages/pikascript-latest/requestment.txt (included by default).
The latest default requestment.txt can be viewed here.
Type “pika” in msh to start PikaScript in a thread.
The initial startup will execute the /pikascript-latest/main.py initialization script. After execution, enter pika interactive running mode, Enter “exit()” to return to msh, enter “pika” again to enter pikascript, and enter directly into interactive mode. Option 2: Automatically start at boot
Enter the package detailed configuration
Check Enable auto-running PikaScript
3 After setting, it will automatically start PikaScript, run the main.py script, and then go back to msh
Enter pika in msh to run interactively.
Option 3: Manual start
If you need custom start, you can use the following methods to start manually.
Import header file:
#include "pikaScript.h"
Start PikaScript:
PikaObj * pikaMain = pikaScriptInit();
run interactively
Refer to the Support Interactive Run section of the documentation.
Serial download Python script
Refer to the Support Serial Port Download Python part of the document.
7.2.1. Using the PikaScript module and package manager
Modify pikascript-latest/requestment.txt, then right-click the project, Sconscripts Update, you can install the module/modify the module version, and precompile.
For more usage, please refer to the package manager, module usage, module development part of the documentation.