|
| 1 | +MicroPython port to STM32 MCUs |
| 2 | +============================== |
| 3 | + |
| 4 | +This directory contains the port of MicroPython to ST's line of STM32Fxxx |
| 5 | +microcontrollers. It is based on the STM32Cube HAL library and currently |
| 6 | +supports: STM32F401, STM32F405, STM32F411, STM32F429, STM32F746. |
| 7 | + |
| 8 | +The officially supported boards are the line of pyboards: PYBv1.0 and PYBv1.1 |
| 9 | +(both with STM32F405), and PYBLITEv1.0 (with STM32F411). See |
| 10 | +[micropython.org/pyboard](http://www.micropython.org/pyboard/) for further |
| 11 | +details. |
| 12 | + |
| 13 | +Other boards that are supported include ST Discovery and Nucleo boards. |
| 14 | +See the boards/ subdirectory, which contains the configuration files used |
| 15 | +to build each individual board. |
| 16 | + |
| 17 | +Build instructions |
| 18 | +------------------ |
| 19 | + |
| 20 | +An ARM compiler is required for the build, along with the associated binary |
| 21 | +utilities. The default compiler is `arm-none-eabi-gcc`, which is available for |
| 22 | +Arch Linux via the package `arm-none-eabi-gcc`, for Ubuntu via instructions |
| 23 | +[here](https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa), or |
| 24 | +see [here](https://launchpad.net/gcc-arm-embedded) for the main GCC ARM |
| 25 | +Embedded page. The compiler can be changed using the `CROSS_COMPILE` variable |
| 26 | +when invoking `make`. |
| 27 | + |
| 28 | +To build for a given board, run: |
| 29 | + |
| 30 | + $ make BOARD=PYBV11 |
| 31 | + |
| 32 | +The default board is PYBV10 but any of the names of the subdirectories in the |
| 33 | +`boards/` directory can be passed as the argument to `BOARD=`. The above command |
| 34 | +should produce binary images in the `build-PYBV11/` subdirectory (or the |
| 35 | +equivalent directory for the board specified). |
| 36 | + |
| 37 | +You must then get your board/microcontroller into DFU mode. On the pyboard |
| 38 | +connect the 3V3 pin to the P1/DFU pin with a wire (they are next to each |
| 39 | +other on the bottom left of the board, second row from the bottom) and then |
| 40 | +reset (by pressing the RST button) or power on the board. Then flash the |
| 41 | +firmware using the command: |
| 42 | + |
| 43 | + $ make BOARD=PYBV11 deploy |
| 44 | + |
| 45 | +This will use the included `tools/pydfu.py` script. You can use instead the |
| 46 | +`dfu-util` program (available [here](http://dfu-util.sourceforge.net/)) by |
| 47 | +passing `USE_PYDFU=0`: |
| 48 | + |
| 49 | + $ make BOARD=PYBV11 USE_PYDFU=0 deploy |
| 50 | + |
| 51 | +If flashing the firmware does not work it may be because you don't have the |
| 52 | +correct permissions. Try then: |
| 53 | + |
| 54 | + $ sudo make BOARD=PYBV11 deploy |
| 55 | + |
| 56 | +Or using `dfu-util` directly: |
| 57 | + |
| 58 | + $ sudo dfu-util -a 0 -d 0483:df11 -D build-PYBV11/firmware.dfu |
| 59 | + |
| 60 | +Accessing the board |
| 61 | +------------------- |
| 62 | + |
| 63 | +Once built and deployed, access the MicroPython REPL (the Python prompt) via USB |
| 64 | +serial or UART, depending on the board. For the pyboard you can try: |
| 65 | + |
| 66 | + $ picocom /dev/ttyACM0 |
0 commit comments