9.3 KiB
Star please~
【Vedio】PikaScript hand by hand
Get PikaScript:
Use Pika package manager PikaPackage.exe
-
Run the PikaPackage.exe directly, then the pikascript repo would be downloaded autoly in the /tmp/pikaSCript folder of your current disc.
-
Add requestment.txt to the same folder of PikaPackage.exe then run pikaPackage.exe, the core, pre-compiler and moudles would be installed autoly in the current folder.
-
Released moudles:packages.toml
-
Run the PikaPackage.exe directly, then the pikascript repo would be downloaded auto in the /tmp/pikaSCript folder of your current disc partition.
-
Add requestment.txt to the same folder of PikaPackage.exe then run PikaPackage.exe, core, pre-compiler and moudles would be installed actually in the current folder.
-
Released modules:packages.toml
1. Abstract
PikaScript is an ultra lightweight Python engine with zero dependencies and zero configuration, that can run with 4KB of RAM (such as STM32G030C8 and STM32F103C8), and very easy to deploy and expand.
Folders
src - core code
bsp - mcu/board support
port - OS support
document - developt document
examples - example scripts
package - packages and moudles
pikaCompiler - pre-compiler write by Rust, used to bind C function to python moudle.
pikaPackageManager - pacakge manager
2.Device driver
MCU/Board | gpio | uart | pwm | adc | rgb | i2c | spi |
---|---|---|---|---|---|---|---|
PikaPi Zero | √ | √ | √ | √ | √ | ||
stm32g030c8 | √ | √ | √ | √ | - | ||
stm32g070cB | √ | √ | √ | √ | - | ||
stm32f103c8 | √ | √ | √ | √ | - |
3.Characteristic
(1)Run environment
Support run in mcu without OS or file system. Can run in everywhere with RAM ≥ 4kB and FLASH ≥ 32kB,such as stm32g030, stm32f103c8t6,esp8266.
(2)Develop enviroment
Support run and program python scripts by serial.
Support IDEs like Keil, IAR, rt-thread studio and segger embedded studio to develop C moudle.
Support build tools like CMake, makeFile and Scons.
Zero dependencies, zero configuration, out-of-the-box, easy to integrated into privious C projcet.
Eazy to extern customized C moudles.
Support linux.
(3)Syntax
Support subaggregate of python 3 standard syntax.
Support class and method define, encapsulation-inheritance-polymorphism and moudles in compile time - Based on Pika Pre-compiler.
Support method invoke, argument define, new object, free object and control flow(if\while). - Based on Pika Runtime Core.
(4)Develop standard.
Readability first,nearly never use macro function and global argument.
Complete unit testes based on google test.
(5)Document
1. PikaScript-Quick start within 3 minutes
2. PikaScript-Architecture and principle
3. PikaScript-Deploy within 10 minutes
4. PikaScript-Standard develop workflow
4.Both talk and show the code:
Group is full. Add my qq (645275593) to invite you.
Tencent QQ: 645275593
QQ group:
E-mail: 645275593@qq.com
5.Contribute
Content | Contributer |
---|---|
Donate:GD32E103TB muc 2 pic | 信息牛(WeChat) |
Rt-thread bsp template | Meco Jianting Man |
Donate:EC600S-CN 4G module | 移远模块 |
Donate:BL706 board | 博流智能 bouffalolab |
Donate:CM32M101A board | 孟巍(WeChat) |
Donate:APM32F030R8 board | 极海半导体 陈成 |
Donate:APM32E103VB board | 极海半导体 陈成 |
Donate:APEX-Link debugger | 极海半导体 陈成 |
format code,add gitattribute | Meco Jianting Man |
demo/simulation-keil | 千帆(WeChat) |
demo/stm32f103zet6/demo01-led-stm32f103zet6 | 甜航 |
demo/stm32f103zet6/demo02-led-stm32f103zet6_tworoot | 甜航 |
demo/stm32f407zgt/demo01-led-stm32f407vgt | 甜航 |
6.Test and develop Core
Test core in linux(ubuntu20.04 is recommend):
step1: Clone the repo
git clone https://github.com/pikastech/pikascript
cd pikascript/port/linux
step2: Compile the project
sh init.sh # Only nedded in the first time.
sh make.sh # Compile the project.
step3: Run the unit tests.
sh test.sh
step4: Run the banchmark
sh test-banchmark.sh
step5: Run the demo
./build/src/boot/demo06-pikamain/pikascript_demo06-pikamain
7.Demo
Demo 01 GPIO
Demo 02 USART
Demo 03 ADC
Demo 04 OWM output
Demo 05 RGB
The maximum RAM usage of these demos is only 3.56K, which is 4.56K if the 1K stack is included, and the maximum Flash usage is 30.4K. Based on the 20K RAM and 64K Flash of STM32F103C8T6, less than 25% RAM and less than 50% Flash are used. A quick comparison can be made between the microPython chip STM32F405RG and the PikaScript chip STM32G070CB
RAM resource comparison
Flash Resource Comparison
Reference price comparison (take the selling price of 10 pieces in Lichuang Mall on September 11, 2021 as reference)
About the extern moudle ?
In addition to device drivers, developing custom Python scripts for MCU is very easy to bind to the PIkascript development framework. The following two demos are extensions of the custom C module, which develop python scripting interfaces based on the ARM-2D image driver library.