--- tags: 活動共筆 --- # 20211101 Intro to MicroPython (MP) - The porting guide #1 ## Q&A: gcc & make :::info :information_source: 60% users havn't heard about gcc/make before ::: ## Introduction **Founder**: Demin George, AUS *Intro video* ## Principle ![](https://i.imgur.com/gX4FlAT.png) Dotted Line area: happended in MCU hardware User input into Serial COM that controls `REPL(Read Evaluate Print Loop)`, which is able to convert `Byteode` to `Machine Code` that is executable in Hardware ## Internla Architecutre ![](https://i.imgur.com/NggMbok.png) left portion: translate code right portion: execute machine code on MCU ## Keywords 1. **Bytecode** ![](https://i.imgur.com/ugvhOH2.png) 2. **QSTR (uniQue STRing)** ![](https://i.imgur.com/7eTKr23.png) q string is similar to machine code, but with light weight and faster execution 3. **REPL (Read Eval Print Loop)** ![](https://i.imgur.com/ET9cdOp.png) 4. **Frozen Module** ![](https://i.imgur.com/huZiDGt.png) object code = machine code frozon module = byte code (between Python & machine code) ## Example Script ![](https://i.imgur.com/2QyVcid.png) ## How to develop a MP Project ![](https://i.imgur.com/P8TdAlT.png) ## Agenda ![](https://i.imgur.com/evZuLtg.png) 1. Realtek & MP SDK have different build system, ### Environment Setup #### Keywords - GCC: GNU Compiler Collection - GNU: GNU Not Unix - Popular Toolchain for GCC, etc, keychain that contains multiple keys to solve compilation problems - Make -- GNU Make - manage and generate executable (.exe) files - What is Makefile? #### Software Related - Cygwin - POSIX-compatible programming and runtime environemtn that urns natively on Microsoft Windows - apt-get packages - make + bc (mathematical tool) - Python 3 #### Example Code ![](https://i.imgur.com/Ghi5W0f.png) - Makefile + xm.c + hy.c + lib.h - `make` vs `make all` https://blog.csdn.net/tfcy694/article/details/91898114 `make` will execute the 1st item in the list ### Ameba Offcial SDK ![](https://i.imgur.com/80UtF3f.png) ### MP Official SDK ![](https://i.imgur.com/rqD3wOV.png) ![](https://i.imgur.com/HoQkcEP.png)