NuMicroPy is Nuvoton microcontroller porting for MicroPython. MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments. See MicroPython
- M480BSP/ -- NuMicro M480 series BSP
- M261BSP/ -- NuMicro M261 series BSP
- build/ -- Prebuilt frimware
- patch/ -- BSP/MicroPython patch files
- M48x/ -- M480 series porting of MicroPython
- M26x/ -- M261 series porting of MicroPython
- micropython/ -- MicroPython official release(v1.10)
- ThirdParty/ -- Third party library
Board | MCU | Required ROM size | Required RAM size |
---|---|---|---|
NuMaker-PFM-M487 | M487 | 383KB/660KB(W/lvgl) | 92KB/128KB(W/lvgl) |
NuMaker-IOT-M487 | M487 | 351KB | 64KB |
NuMaker-M263KI | M263 | 266KB | 35KB |
LittlevGL required RAM size 128KB = 96KB + 32KB(SPIM cache)
- Download and install Nu-Link Command Tool
- Hardware setup steps
a. Turn on ICE function switch pin 1,2,3 and 4
b. Connect USB ICE to PC - Burn firmware
Nu-Link-Me exported a "NuMicro MCU" disk, just Copy and Paste prebuilt firmware.bin into "NuMicro MCU" disk.
- Python code update steps
a. Connected USB1.1 to PC. For windows 7, you must install VCOM driver from "M480BSP/SampleCode/StdDriver/USBD_VCOM_And_Mass_Storage/Windows Dirver" folder.
b. Setup your terminal program
c. Press the RESET button. Firmware will export a PYBFLASH disk.
d. Update your python code to boot.py or main.py
e. Press the RESET button.
The development of MicroPython firmware is in Unix-like environment. The description as below will be using Ubuntu 16.04.
-
Packages Requirement
The following packages will need to be installed before you can compile and run MicroPython- build-essential
- libreadline-dev
- libffi-dev
- git
- pkg-config
To install these packages using the following command.
sudo apt-get install build-essential libreadline-dev libffi-dev git pkg-config
- Install GNU Arm Toolchain
Download GNU Arm toolchain linux 64-bit version 7-2018-q2 update from Arm Developer. Next use the tar command to extract the file to your favor directory (ex. /usr/local)
mv gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 /usr/local/
cd /usr/local
tar -xjvf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
Now, modify your PATH environment variable to access the bin directory of toolchain
- Build firmware
To build MicroPython firmware for M487, use the following command.
git clone --recursive https://github.com/OpenNuvoton/NuMicroPy.git
cd patch
./run_patch.sh
For M480 series
cd ../M48x
#For NuMaker-PFM-M487 board
make V=1
#For NuMaker-IOT-M487 board
make BOARD=NuMaker-IOT-M487 V=1
For M261 series
cd ../M26x
#For NuMaker-M263KI board
make V=1
How to run LittlevGL
- Hardware requirement: NuMaker-PFM-M487 + M487 Advance Ver 4.0
- Burn firmware.bin (build/NuMaker-PFM-M487/WithLittlevGL/) to APROM and firmware_spim.bin (build/NuMaker-PFM-M487/WithLittlevGL) to SPI flash
a. Execute NuMicro ICP programming tool and connect to target chip(M480 Series)
b. Check SPIM multi-function pin select to PC2/PC3/PC1/PC0
c. Programming config setting first
e. Programming APROM(firmware.bin) and SPI flash(firmware_spim.bin)
f. ICP tool disconnect target chip and press NuMaker-PFM-M487 RESET button
- Please follow "How to start NuMicroPy" section 4. Copy example code(M48x/example/LittlevGL.py) to main.py