2021-12-01 18:45:41 +08:00
< p align = "center" >
2022-02-20 07:44:38 +08:00
< img alt = "logo" src = "document/image/144221063-a85b2cb0-0416-493f-9afb-56cff31e977d.jpg" width = "300" >
2021-12-01 18:45:41 +08:00
< / p >
< h1 align = "center" style = "margin: 30px 0 30px; font-weight: bold;" > PikaScript< / h1 >
< h4 align = "center" > Cross platform ultra lightweight embedded Python engine< / h4 >
< p align = "center" >
< a href = "https://gitee.com/lyon1998/pikascript/stargazers" > < img src = "https://gitee.com/lyon1998/pikascript/badge/star.svg?theme=gvp" > < / a >
< a href = "https://gitee.com/lyon1998/pikascript/members" > < img src = "https://gitee.com/lyon1998/pikascript/badge/fork.svg?theme=gvp" > < / a >
< a href = "https://github.com/pikastech/pikascript/stargazers" > < img src = "https://img.shields.io/github/stars/pikastech/pikascript?style=flat-square&logo=GitHub" > < / a >
< a href = "https://github.com/pikastech/pikascript/network/members" > < img src = "https://img.shields.io/github/forks/pikastech/pikascript?style=flat-square&logo=GitHub" > < / a >
< a href = "https://github.com/pikastech/pikascript/watchers" > < img src = "https://img.shields.io/github/watchers/pikastech/pikascript?style=flat-square&logo=GitHub" > < / a >
< a href = "https://github.com/pikastech/pikascript/issues" > < img src = "https://img.shields.io/github/issues/pikastech/pikascript.svg?style=flat-square&logo=GitHub" > < / a >
< a href = "https://github.com/pikastech/pikascript/blob/master/LICENSE" > < img src = "https://img.shields.io/github/license/pikastech/pikascript.svg?style=flat-square" > < / a >
< a href = "https://github.com/pikasTech/pikascript/actions/workflows/CI.yml" > < img src = "https://github.com/pikasTech/pikascript/actions/workflows/CI.yml/badge.svg" > < / a >
< / p >
2021-11-17 17:32:48 +08:00
2021-12-01 18:45:41 +08:00
< p align = "center" >
2021-12-03 09:01:25 +08:00
< a href = "README_zh.md" > 中文页< / a > |
< a href = "https://whycan.com/f_55.html" > Forum< / a > |
2022-04-09 13:56:09 +08:00
< a href = "https://pikadoc.readthedocs.io/en/latest/index.html" > Documents< / a > |
2021-12-03 09:10:21 +08:00
< a href = "https://space.bilibili.com/5365336/channel/detail?cid=202329" > Videos< / a > |
2021-12-14 04:24:41 +00:00
< a href = "../../tree/master/bsp #platform -support" > BSP</ a > |
2022-04-09 13:56:09 +08:00
< a href = "https://pikadoc.readthedocs.io/en/latest/%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8%E4%B8%8E%E6%A8%A1%E5%9D%97%E7%AE%A1%E7%90%86.html" > Package Manager< / a > |
< a href = "https://pikadoc.readthedocs.io/en/latest/%E4%BB%8E%20RT-Thread%20%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%BC%80%E5%A7%8B.html" > RT-Thread package< / a > |
< a href = "https://pikadoc.readthedocs.io/en/latest/%E5%A6%82%E4%BD%95%E5%8F%82%E4%B8%8E%E7%A4%BE%E5%8C%BA%E8%B4%A1%E7%8C%AE.html" > Contribute< / a > |
< a href = "https://pikadoc.readthedocs.io/en/latest/%E5%95%86%E4%B8%9A%E5%90%88%E4%BD%9C%E6%96%B9%E5%BC%8F.html" > Business< / a >
2021-12-01 18:45:41 +08:00
< / p >
2021-10-21 07:33:12 +08:00
2022-02-20 07:44:38 +08:00
[![image ](document/image/147997370-ff37b6e7-25b2-4174-aa64-c1fb92cede04.png )](https://pikastech.github.io/pikascript/dev/bench/)
2022-01-04 09:22:21 +08:00
2021-10-20 10:29:40 +08:00
# 1. Abstract
2021-10-20 10:33:13 +08:00
PikaScript is an ultra-lightweight Python engine with zero dependencies and zero-configuration, that can run with 4KB of RAM and 32KB of flash (such as STM32G030C8 and STM32F103C8).
2021-12-31 10:33:48 +08:00
< img src = "https://user-images.githubusercontent.com/88232613/147799704-d79345da-a2b9-4593-b1eb-ff9de127429a.png" width = "500" / >
2021-10-20 10:29:40 +08:00
2021-10-20 11:22:14 +08:00
It's very easy to bind C function to python module with the help of Pika Pre-compiler.
2022-04-12 22:48:15 +08:00
Only write the API of python in `.py` and the bindings are autoly generated by Pre-compiler.
2021-10-20 11:19:54 +08:00
2022-02-20 07:44:38 +08:00
< img src = "document/image/138021445-13643518-b0a3-4872-a290-5dec27697837.png" width = "700" / >
2021-10-20 11:04:30 +08:00
2021-10-20 11:19:54 +08:00
# [【Video】PikaScript hand by hand](https://www.bilibili.com/video/BV1mg411L72e)
2021-10-19 20:04:41 +08:00
# Get PikaScript:
2021-10-19 19:50:14 +08:00
2022-02-05 15:20:50 +08:00
## Use Online Project Generator
Generator url:
http://pikascript.com
2022-02-20 07:44:38 +08:00
< img src = "document/image/152632673-019a7f92-7b7f-4fb5-92b7-4ae4c26ec865.png" width = "500" / >
2022-02-05 15:20:50 +08:00
2021-12-23 03:40:56 +00:00
## Use Pika package manager [PikaPackage.exe](https://gitee.com/Lyon1998/pikascript/attach_files/907478/download)
2021-10-19 19:50:14 +08:00
2021-12-23 03:40:56 +00:00
1. Run the [PikaPackage.exe ](https://gitee.com/Lyon1998/pikascript/attach_files/907478/download ) directly, then the pikascript repo would be downloaded auto in the /tmp/pikascript folder of your current disc partition.
2021-10-19 20:40:51 +08:00
2021-10-21 07:56:30 +08:00
2. Add [requestment.txt ](/bsp/stm32g030c8/pikascript/requestment.txt ) to the same folder of PikaPackage.exe then run [PikaPackage.exe ](../../raw/master/tools/pikaPackageManager/pikaPackage.exe ). The [run-time core ](../../tree/master/src ), [pre-compiler ](../../tree/master/tools/pikaCompiler ) and [moudles ](../../tree/master/package ) would be installed in the current folder.
2021-10-19 20:40:51 +08:00
2021-10-21 07:57:07 +08:00
3. Released modules: [packages.toml ](packages.toml )
2021-10-19 20:40:51 +08:00
2021-11-11 15:10:11 +08:00
# Quick Start
2022-04-12 22:50:31 +08:00
You can use [simulation project ](https://pikadoc.readthedocs.io/en/latest/Keil%20%E4%BB%BF%E7%9C%9F%E5%B7%A5%E7%A8%8B.html ) to quick start without hardware, or use the out-of-the-box develop board [Pika-Pi—Zero ](https://item.taobao.com/item.htm?spm=a2126o.success.result.1.76224831Y0X1gO&id=654947372034 ).
2021-11-11 15:10:11 +08:00
![image ](https://user-images.githubusercontent.com/88232613/141252834-93011ca7-f84b-4192-8e61-0e242796f62c.png )
The board based on STM32G030C8T6 MCU, only 64kB Flash, 8kB RAM can run PikaScript with total peripheral device (GPIO、TIME、IIC、RGB、KEY、LCD、RGB).
CH340 is deployed to support USB to serial with Type-C USB, support download python script py serial, there are 4 RGB on the board and support the [LCD ](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-23991764791.12.16f97c58fsLjVk&id=660745643102 ).
2021-11-09 13:33:37 +08:00
# Document
2022-04-09 13:56:09 +08:00
https://pikadoc.readthedocs.io/en/latest/index.html
2021-11-09 13:33:37 +08:00
2021-10-19 20:04:41 +08:00
## Folders
[src ](../../tree/master/src ) - core code
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[bsp ](../../tree/master/bsp ) - mcu/board support
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[port ](../../tree/master/port ) - OS support
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[document ](../../tree/master/document ) - developt document
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[examples ](../../tree/master/examples ) - example scripts
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[package ](../../tree/master/package ) - packages and moudles
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[pikaCompiler ](../../tree/master/tools/pikaCompiler ) - pre-compiler write by Rust, used to bind C function to python moudle.
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
[pikaPackageManager ](../../tree/master/tools/pikaPackageManager ) - pacakge manager
2021-10-19 19:50:14 +08:00
2021-12-02 23:24:24 +08:00
# 2.Platform support
2021-12-14 19:06:49 +08:00
## MCU support
|MCU|bsp|gpio|uart|pwm|adc|i2c|
|---|---|---|---|---|---|---|
|stm32g030c8|√|√|√|√|√|√|
|stm32g070cB|√|√|√|√|√|√|
|stm32f103c8|√|√|√|√|√|√|
|stm32f103rb|√|√|√|√|√|√|
2022-02-22 15:45:52 +08:00
|stm32f103ze|√|√|√|√|√|√|
2021-12-14 19:06:49 +08:00
|stm32f103rc|√|√|√|√|√|√|
2022-02-27 23:43:41 +08:00
|stm32f401cc|√|√|√|√|√|√|
2022-02-27 19:56:24 +08:00
|stm32f411ce|√|√|√|√|√|√|
2022-01-18 15:57:24 +08:00
|stm32f407ze|√| | | | | |
2022-02-22 17:01:59 +08:00
|stm32f407zg|√| | | | | |
2022-03-26 21:29:37 +08:00
|stm32h750vb|√| | | | | |
2022-01-25 13:35:23 +08:00
|stm32f051r8|√| | | | | |
2022-03-26 21:14:39 +08:00
|ch582|√|√|√| |√|√|
2021-12-14 19:06:49 +08:00
|ch32v103r8t6|√|√| | | | |
|cm32m101a|√| | | | | |
2022-03-28 17:29:34 +08:00
|w801|√| | | | | |
2022-02-18 03:36:40 +00:00
|w806|√|√|√|√|√|√|
2021-12-14 19:06:49 +08:00
|apm32f030r8|√| | | | | |
|apm32e103vb|√| | | | | |
|bl-706|√| | | | | |
2021-12-27 19:09:51 +08:00
|Raspberry Pico|√| | | | | |
|ESP32C3|√| | | | | |
2022-01-18 07:16:31 +00:00
|TC264D|√| | | | | |
|devc|√| | | | | |
2021-12-14 19:06:49 +08:00
## Board support
|Board|bsp|gpio|uart|pwm|adc|i2c|rgb|lcd|arm-2d|
|---|---|---|---|---|---|---|---|---|---|
|[Pika-Pi-Zero ](https://item.taobao.com/item.htm?spm=a230r.1.14.1.4f2e27a8R0qWJn&id=654947372034&ns=1&abbucket=15#detail )|√|√|√|√|√|√|√|√|√|
2021-12-21 15:54:47 +00:00
|Board|bsp|arm-2d|
|---|---|---|
|QEMU-arm2d|√|√|
|Board|bsp|LED|KEY|
|---|---|---|---|
|SmartLoong|√|√|√|√|
2021-12-02 16:01:41 +08:00
2021-12-21 16:16:45 +00:00
## OS support
2022-02-28 20:49:22 +08:00
|OS|port|GPIO|TIME|PWM|
|---|---|---|---|---|
|RT-Thread|√|√|√|√|
|vsf|√|√| | |
2021-12-21 16:16:45 +00:00
2021-12-23 02:49:15 +00:00
|OS|port|Google Test|Benchmark|
2021-12-21 16:16:45 +00:00
|---|---|---|---|
|linux|√|√|√|
2022-04-09 22:04:15 +08:00
## Related Projects
### PikaScript Bluepill Demo In PlatformIO — Python-like REPL 🐍🔌
https://github.com/maxgerhardt/pikascript-pio-bluepill
2021-10-19 20:04:41 +08:00
# 3.Characteristic
### (1)Run environment
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
Support run in mcu without OS or file system. Can run in everywhere with **RAM ≥ 4kB** and **FLASH ≥ 32kB** , such as stm32g030, stm32f103c8t6, esp8266.
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
### (2)Develop enviroment
Support run and program python scripts by serial.
2021-10-19 19:50:14 +08:00
2022-02-20 07:44:38 +08:00
< img src = "document/image/134841230-85de6734-8467-4245-93a5-d452b5022b42.gif" width = "400" alt = "微信交流群" / > < br / >
2021-10-19 19:50:14 +08:00
2022-01-06 09:54:33 -05:00
Support IDEs like Keil, IAR, RT-Thread studio and segger embedded studio to develop C moudle.
2021-10-19 19:50:14 +08:00
2021-10-19 20:04:41 +08:00
Support build tools like CMake, makeFile and Scons.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Zero dependencies, zero configuration, out-of-the-box, easy to integrated into privious C projcet.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Eazy to extern customized C moudles.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Support linux.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
### (3)Syntax
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Support subaggregate of python 3 standard syntax.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Support class and method define, encapsulation-inheritance-polymorphism and moudles in compile time - Based on [Pika Pre-compiler ](../../tree/master/tools/pikaCompiler ).
2021-10-19 19:50:14 +08:00
2021-10-22 07:26:24 +08:00
Support method invoke, argument define, new object, free object, control flow(if\while) and operator ( + - * / < == > ). - Based on [Pika Runtime Core ](../../tree/master/src/package/pikascript/pikascript-core ).
2021-10-19 19:50:14 +08:00
2022-04-09 08:52:01 +08:00
|Syntax|Compile-Time|Run-Time|Shell|
|---|---|---|---|
|Module Define |√|-|-|
|Module Import |√|-|-|
2022-04-11 22:58:12 +08:00
|Class Define |√|√|√|
|Class Inherit |√|√|√|
|Method Define |√|√|√|
|Method Override |√|√|√|
2022-04-09 08:52:01 +08:00
|Method Invoke |√|√|√|
|Argument Define |√|√|√|
|Argument Assignment |√|√|√|
|Object New |√|√|√|
|Object Free |√|√|√|
|Object Nest |√|√|√|
|Control flow |√|√|√|
2021-10-25 16:07:09 +08:00
#### Operator
2021-11-28 17:42:56 +08:00
| + | - | * | / | == | > | < | >= | <= | % | * * | // | != | & | >> | << | and | or | not | += | -= | *= | /= |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-03-31 15:40:09 +08:00
|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|
2021-10-25 16:07:09 +08:00
#### Control flow
2021-12-02 11:17:07 +08:00
| if | while | for | else | elif | break | continue |
| --- | --- | --- | --- | --- | --- | --- |
2021-12-29 22:53:27 +08:00
|√|√|√|√|√|√|√|
2021-10-19 20:25:26 +08:00
### (4)Develop standard.
2021-10-19 19:50:14 +08:00
2021-10-21 10:26:35 +08:00
Readability first, nearly never use macro function and global argument.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
Complete unit testes based on google test.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
# 4.Both talk and show the code:
2021-10-19 19:50:14 +08:00
2022-04-12 22:34:11 +08:00
## Telegram
< img alt = "tg" src = "https://user-images.githubusercontent.com/88232613/158211488-0c27a35b-8ae4-4012-9954-f13cc374fdf7.jpg" width = "300" >
https://t.me/+JL3TZ9k-Lfg2OWE1
2021-10-21 07:34:26 +08:00
## E-mail: liang6516@outlook.com
2021-10-19 19:50:14 +08:00
## Tencent QQ: 645275593
2022-04-19 17:09:45 +00:00
# 5.Demo
2021-10-21 07:36:51 +08:00
2021-10-21 07:38:50 +08:00
The scripts in demos are in the [examples ](examples ) folder.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Demo 01 GPIO
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
``` python
import PikaStdLib
import STM32G0
mem = PikaStdLib.MemChecker()
io1 = STM32G0.GPIO()
time = STM32G0.Time()
io1.init()
io1.setPin('PA8')
io1.setMode('out')
io1.enable()
io1.low()
print('hello pikascript')
print('mem.max :')
mem.max()
print('mem.now :')
mem.now()
while True:
io1.low()
time.sleep_ms(500)
io1.high()
time.sleep_ms(500)
```
2021-10-19 19:50:14 +08:00
2022-02-20 07:44:38 +08:00
![Hnet-image (2) ](document/image/132943428-f2b365ca-140e-42f4-936c-db6a7d9f8dee.gif )
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Demo 02 USART
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
``` python
import PikaStdLib
import STM32G0
time = STM32G0.Time()
uart = STM32G0.UART()
uart.init()
uart.setId(1)
uart.setBaudRate(115200)
uart.enable()
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
while True:
time.sleep_ms(500)
readBuff = uart.read(2)
print('read 2 char:')
print(readBuff)
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
```
2022-02-20 07:44:38 +08:00
![Hnet-image (3) ](document/image/132943365-0f7059b3-4f9d-4989-a5ec-2cce72b0cc96.gif )
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Demo 03 ADC
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
``` python
import PikaStdLib
import STM32G0
time = STM32G0.Time()
adc1 = STM32G0.ADC()
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
adc1.init()
adc1.setPin('PA1')
adc1.enable()
while True:
val = adc1.read()
print('adc1 value:')
print(val)
time.sleep_ms(500)
```
2021-10-19 19:50:14 +08:00
2022-02-20 07:44:38 +08:00
![mmexport1631351523907 ](document/image/132944185-0a01b1ba-8cf7-4f9f-9d73-fe9cbcd52f0b.png )
2021-10-19 19:50:14 +08:00
2021-10-21 08:07:45 +08:00
## Demo 04 PWM output
2021-10-19 19:50:14 +08:00
2022-01-10 23:06:49 +08:00
``` python
2022-01-10 08:41:42 +00:00
import PikaStdLib
import STM32G0
time = STM32G0.Time()
pwm = STM32G0.PWM()
pwm.setPin('PA8')
pwm.setFrequency(2000)
pwm.setDuty(0.5)
pwm.enable()
while True:
time.sleep_ms(500)
pwm.setDuty(0.5)
time.sleep_ms(500)
pwm.setDuty(0.001)
```
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Demo 05 RGB
2021-10-19 19:50:14 +08:00
2022-01-10 08:41:42 +00:00
``` python
import STM32G0
import PikaPiZero
import PikaStdLib
rgb = PikaPiZero.RGB()
mem = PikaStdLib.MemChecker()
rgb.init()
rgb.enable()
print('hello 2')
print('mem used max:')
mem.max()
while True:
print('flowing')
rgb.flow()
```
## Demo 06 Snake(Need LCD)
``` python
from PikaObj import *
import PikaStdLib
import PikaPiZero
import STM32G0
2022-01-10 16:49:51 +08:00
# hardware init
lcd = PikaPiZero.LCD()
lcd.init()
lcd.clear('white')
key = PikaPiZero.KEY()
key.init()
time = STM32G0.Time()
x_max = 120
y_max = 150
# snake init
s = PikaPiZero.Point()
w = 9
h = 9
s.x = 50
s.y = 10
len = 0
while len < 3:
b = s
2022-01-10 08:41:42 +00:00
i = 0
2022-01-10 16:49:51 +08:00
while i < len:
b = b.next
2022-01-10 08:41:42 +00:00
i = i + 1
2022-01-10 16:49:51 +08:00
b.next = PikaPiZero.Point()
b.next.x = b.x - 10
b.next.y = b.y
b.next.prev = b
len = len + 1
# ring link
b.next = s
s.prev = b
i = 0
b = s
while i < len:
lcd.fill(b.x, b.y, w, h, 'blue')
b = b.next
i = i + 1
print('snake lengh')
print(len)
# fruit init
f = PikaPiZero.Point()
f.x = 30
f.y = 20
lcd.fill(f.x, f.y, w, h, 'green')
# memory check
2022-01-10 08:41:42 +00:00
mem = PikaStdLib.MemChecker()
print('mem used max:')
mem.max()
2022-01-10 16:49:51 +08:00
# main loop
d = 0
2022-01-10 08:41:42 +00:00
isUpdate = 1
2022-01-10 16:49:51 +08:00
isEat = 0
2022-01-10 08:41:42 +00:00
while True:
if isUpdate:
2022-01-10 16:49:51 +08:00
# isUpdate = 0
# check eat fruit
if f.x == s.x and f.y == s.y:
# have eat fruit
isEat = 1
f.x = f.x + 30
if f.x > x_max:
f.x = f.x - x_max
f.y = f.y + 30
if f.y > y_max:
f.y = f.y - y_max
lcd.fill(f.x, f.y, w, h, 'green')
# move snake by the direction
if d == 0:
x_new = s.x + 10
y_new = s.y
if x_new > x_max:
x_new = 0
elif d == 1:
x_new = s.x
y_new = s.y - 10
if y_new < 0:
y_new = y_max
elif d == 2:
x_new = s.x
y_new = s.y + 10
if y_new > y_max:
y_new = 0
elif d == 3:
x_new = s.x - 10
y_new = s.y
if x_new < 0:
x_new = x_max
if isEat:
isEat = 0
b_new = PikaPiZero.Point()
b_new.x = x_new
b_new.y = y_new
b_new.prev = s.prev
b_new.next = s
s.prev.next = b_new
s.prev = b_new
s = b_new
len = len + 1
print('snake lengh')
print(len)
print('mem used max:')
mem.max()
# drow the snake and fruit
# clear last body
lcd.fill(s.prev.x, s.prev.y, w, h, 'white')
# new body
s.prev.x = x_new
s.prev.y = y_new
# head is last body
s = s.prev
lcd.fill(s.x, s.y, w, h, 'blue')
b = s
2022-01-10 08:41:42 +00:00
i = 0
2022-01-10 16:49:51 +08:00
# scan key
key_val = key.get()
if key_val == 0:
d = 0
2022-01-10 08:41:42 +00:00
isUpdate = 1
2022-01-10 16:49:51 +08:00
elif key_val == 1:
d = 1
2022-01-10 08:41:42 +00:00
isUpdate = 1
2022-01-10 16:49:51 +08:00
elif key_val == 2:
d = 2
2022-01-10 08:41:42 +00:00
isUpdate = 1
2022-01-10 16:49:51 +08:00
elif key_val == 3:
d = 3
2022-01-10 08:41:42 +00:00
isUpdate = 1
2022-01-10 16:49:51 +08:00
2022-01-10 08:41:42 +00:00
```
2022-01-20 11:38:50 +08:00
![image ](https://user-images.githubusercontent.com/88232613/150269059-1fe3d62d-0c1b-40f4-9298-0d787f476a20.png )
2021-10-19 19:50:14 +08:00
2021-10-21 07:43:25 +08:00
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. Refer to 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.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## RAM resource comparison
2022-02-20 07:44:38 +08:00
![image ](document/image/132944731-a55ece1d-061f-4b91-ba87-bd6547be96a7.png )
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Flash Resource Comparison
2022-02-20 07:44:38 +08:00
![image ](document/image/132944745-e9cf598d-e75f-40bb-873e-911819d535b7.png )
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Reference price comparison (take the selling price of 10 pieces in Lichuang Mall on September 11, 2021 as reference)
2022-02-20 07:44:38 +08:00
![image ](document/image/132944757-2b5cfda8-f93f-4456-8d7f-4e4767954056.png )
2021-10-19 19:50:14 +08:00
2021-10-21 07:45:47 +08:00
## About the custom extern module ?
2021-10-19 19:50:14 +08:00
2021-10-21 07:46:58 +08:00
In addition to device drivers, developing custom Python modules for MCU is very easy. The following two demos are extensions of the custom module, which developed python interfaces for the ARM-2D image driver library.
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Boxes~
2022-02-20 07:44:38 +08:00
![Hnet-image (7) ](document/image/132945282-bfd310df-8063-456d-b90c-6b798a2c8ed5.gif )
2021-10-19 19:50:14 +08:00
2021-10-19 20:25:26 +08:00
## Rotating suns~
2022-02-20 07:44:38 +08:00
![Hnet-image (6) ](document/image/132945107-e473a2cc-9fbc-47f9-aaed-a28d3ad1048c.gif )
2021-10-19 19:50:14 +08:00
2022-04-19 17:09:45 +00:00
# 6.Test and develop Core
## Test core in linux(ubuntu20.04 is recommend):
step1: Clone the repo
``` shell
git clone https://github.com/pikastech/pikascript
cd pikascript/port/linux
```
step2: Compile the project
```
sh install_dependency.sh # install dependency
sh pull-core.sh
sh init.sh # Only nedded in the first time.
sh make.sh # Compile the project.
```
step3: Run the unit tests.
``` shell
sh gtest.sh
```
step4: Run the banchmark
``` shell
sh ci_benchmark.sh
```
# 7.Contribute
| Content | Contributer |
| --- | --- |
| fix linux install script | [Maximilian Gerhardt ](https://github.com/maxgerhardt ) |
| ch582 package | [梦程MI ](https://gitee.com/dreamcmi ) |
| ch582 BSP | [梦程MI ](https://gitee.com/dreamcmi ) |
| Donate: EC600X QuecPython 开发板 | 移远模块 武加玉 |
| Performance Point: 900->1400 | [GorgonMeducer ](https://github.com/GorgonMeducer ) |
| stm32f051r8 BSP |[unsigned ](https://gitee.com/unsigned0 )|
| stm32f407ze BSP |[unsigned ](https://gitee.com/unsigned0 )|
| devc BSP |[unsigned ](https://gitee.com/unsigned0 )|
| TC264D BSP |[unsigned ](https://gitee.com/unsigned0 )|
| PikaVM improvement | [GorgonMeducer ](https://github.com/GorgonMeducer ) |
| W801Device package | 刘延(微信名) |
| W806 bsp | 刘延(微信名) |
| Donate: ESP32C3 5pic, 调试器 |启明云端 沧御|
| Donate: LS1C101芯片10pic, LS1c101开发板, 调试器|龙芯俱乐部 石南|
| PikaVSF OS package | [versaloon ](https://github.com/versaloon ) |
| ESP32C3 BSP |沧御|
| Donate: ESP32开发板、墨水屏*4 | name(微信名) |
| Donate: 智龙开发板 | 龙芯俱乐部 石南 |
| package/STM32F1 | [sjy ](https://gitee.com/shanjiayang ) |
| package/STM32F103RBBooter | [sjy ](https://gitee.com/shanjiayang ) |
| bsp/stm32f103rb | [sjy ](https://gitee.com/shanjiayang ) |
| 基于QEMU的ARM-2D仿真工程 | [liuduanfei ](https://github.com/liuduanfei ) |
| Donate: GD32E103TB芯片2片 | 信息牛(微信名) |
| Rt-thread 支持包、适配层、模块| [Meco Jianting Man ](https://github.com/mysterywolf ) |
| Donate: 移远EC600S-CN 4G模块 | 移远模块 |
| Donate: 博流BL706 开发板|博流智能 [bouffalolab ](https://github.com/bouffalolab )|
| Donate: 中国移动CM32M101A 开发板| 孟巍(微信名) |
| Donate: APM32F030R8 开发板 | 极海半导体 陈成 |
| Donate: APM32E103VB 开发板 | 极海半导体 陈成 |
| Donate: APEX-Link仿真器 | 极海半导体 陈成 |
| 源码格式化, 增加git属性文件 | [Meco Jianting Man ](https://github.com/mysterywolf ) |
| demo/simulation-keil | 千帆(微信名) |
| demo/stm32f103zet6/demo01-led-stm32f103zet6 | [甜航 ](https://github.com/easyzoom ) |
| demo/stm32f103zet6/demo02-led-stm32f103zet6_tworoot | [甜航 ](https://github.com/easyzoom ) |
| demo/stm32f407zgt/demo01-led-stm32f407vgt | [甜航 ](https://github.com/easyzoom ) |