Tutorial build micropython for WEACT_F411_BLACKPILL
  1. git clone https://github.com/micropython/micropython.git
  2. cd micropython
  3. docker run -it -v .:/micropython --name micropython ubuntu
  4. export DEBIAN_FRONTEND=noninteractive
  5. apt-get update
  6. apt-get install -y gcc g++ make automake python3 git gcc-arm-none-eabi
  7. ln -s /usr/bin/python3 /usr/bin/python
  8. cd /micropython/mpy-cross
  9. make -j
  1. cd ../ports/stm32
  2. make BOARD=WEACT_F411_BLACKPILL submodules -j
  3. make BOARD=WEACT_F411_BLACKPILL -j
  1. exit docker
  2. in mac: brew install stlink
  3. cd ports/stm32
  4. st-info --probe
  5. st-flash erase
  6. st-flash --format ihex write build-WEACT_F411_BLACKPILL/firmware.hex

using st-flash is better then dfu-util because we don't need to put the board into dfu mode

  1. pip install mpremote
  2. mpremote fs ls
  3. mpremote
  4. ctrl+] to exit

Micrpython testing example

from machine import Pin
p0 = Pin("C13", Pin.OUT)
p0.value(1)
p0.value(0)
p0.value(1)
p0.value(0)