Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tools:micropython [2020/08/16 05:37]
darron [Setup]
tools:micropython [2020/08/17 11:35] (current)
darron [ESP32]
Line 5: Line 5:
 === Setup === === Setup ===
  
-Install [[:tools:esptool|ESPTool]] for ESP8266 and ESP32. Install [[:tools:stlink|st-link]] for STM32.+Install [[:tools:esptool|ESPTool]] for ESP8266 and ESP32. Install [[:tools:stlink|STLink]] for STM32.
 === ESP32 === === ESP32 ===
  
Line 116: Line 116:
 MicroPython v1.12-665-g60f5b941e on 2020-08-16; ESP32 module with ESP32 MicroPython v1.12-665-g60f5b941e on 2020-08-16; ESP32 module with ESP32
 Type "help()" for more information. Type "help()" for more information.
 +>>> help("modules")
 +__main__          gc                uasyncio/stream   upip_utarfile
 +_boot             inisetup          ubinascii         upysh
 +_onewire          machine           ubluetooth        urandom
 +_thread           math              ucollections      ure
 +_uasyncio         micropython       ucryptolib        urequests
 +_webrepl          neopixel          uctypes           uselect
 +apa106            network           uerrno            usocket
 +btree             ntptime           uhashlib          ussl
 +builtins          onewire           uhashlib          ustruct
 +cmath             sys               uheapq            utime
 +dht               uarray            uio               utimeq
 +ds18x20           uasyncio/__init__ ujson             uwebsocket
 +esp               uasyncio/core     umqtt/robust      uzlib
 +esp32             uasyncio/event    umqtt/simple      webrepl
 +flashbdev         uasyncio/funcs    uos               webrepl_setup
 +framebuf          uasyncio/lock     upip              websocket_helper
 +Plus any modules on the filesystem
 </code> </code>
  
 +===ESP8266===
 +
 +Install
 +<code>
 +esp8266-20191220-v1.12.bin
 +</code>
 +
 +Run
 +
 +<code>
 +picocom -b 115200 /dev/ttyUSB0
 +picocom v1.7
 +
 +port is        : /dev/ttyUSB0
 +flowcontrol    : none
 +baudrate is    : 115200
 +parity is      : none
 +databits are   : 8
 +escape is      : C-a
 +local echo is  : no
 +noinit is      : no
 +noreset is     : no
 +nolock is      : no
 +send_cmd is    : sz -vv
 +receive_cmd is : rz -vv
 +imap is        :
 +omap is        :
 +emap is        : crcrlf,delbs,
 +
 +Terminal ready
 +
 +MPY: soft reboot
 +MicroPython v1.12 on 2019-12-20; ESP module with ESP8266
 +Type "help()" for more information.
 +</code>
 +
 +===STM32===
 +
 +Probe
 +
 +<code>
 +st-info --probe
 +Found 1 stlink programmers
 + serial:     303636444646353135343536373037303637313733313437
 + hla-serial: "\x30\x36\x36\x44\x46\x46\x35\x31\x35\x34\x35\x36\x37\x30\x37\x30\x36\x37\x31\x37\x33\x31\x34\x37"
 + flash:      524288 (pagesize: 16384)
 + sram:       131072
 + chipid:     0x0431
 + descr:      stm32f411re
 +</code>
 +
 +
 +Install [[tools:gccarm|gccarm]]
 +
 +Checkout micropython and build mpy-cross.
 +
 +In ports directory, build stm32.
 +
 +Eg.
 +
 +<code>
 +make BOARD=NUCLEO_F411RE deploy-stlink
 +Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
 +Writing build-NUCLEO_F411RE/firmware0.bin to the board via ST-LINK
 +st-flash 1.6.1-86-gf162a5d
 +2020-08-16T06:59:50 INFO common.c: stm32f411re: 128 KiB SRAM, 512 KiB flash in at least 16 KiB pages.
 +file build-NUCLEO_F411RE/firmware0.bin md5 checksum: 1d81eee6e92c41643d7b3ae71cd4f, stlink checksum: 0x001867ec
 +2020-08-16T06:59:50 INFO common.c: Attempting to write 14780 (0x39bc) bytes to stm32 address: 134217728 (0x8000000)
 +EraseFlash - Sector:0x0 Size:0x4000 2020-08-16T06:59:51 INFO common.c: Flash page at addr: 0x08000000 erased
 +2020-08-16T06:59:51 INFO common.c: Finished erasing 1 pages of 16384 (0x4000) bytes
 +2020-08-16T06:59:51 INFO common.c: Starting Flash write for F2/F4/F7/L4
 +2020-08-16T06:59:51 INFO flash_loader.c: Successfully loaded flash loader in sram
 +enabling 32-bit flash writes
 +size: 14780
 +2020-08-16T06:59:51 INFO common.c: Starting verification of write complete
 +2020-08-16T06:59:51 INFO common.c: Flash written and verified! jolly good!
 +Writing build-NUCLEO_F411RE/firmware1.bin to the board via ST-LINK
 +st-flash 1.6.1-86-gf162a5d
 +2020-08-16T06:59:51 INFO common.c: stm32f411re: 128 KiB SRAM, 512 KiB flash in at least 16 KiB pages.
 +file build-NUCLEO_F411RE/firmware1.bin md5 checksum: 15c0323c6561a0651eed6d4a34ff33a1, stlink checksum: 0x019ebca3
 +2020-08-16T06:59:51 INFO common.c: Attempting to write 284128 (0x455e0) bytes to stm32 address: 134348800 (0x8020000)
 +EraseFlash - Sector:0x5 Size:0x20000 2020-08-16T06:59:53 INFO common.c: Flash page at addr: 0x08020000 erased
 +EraseFlash - Sector:0x6 Size:0x20000 2020-08-16T06:59:55 INFO common.c: Flash page at addr: 0x08040000 erased
 +EraseFlash - Sector:0x7 Size:0x20000 2020-08-16T06:59:57 INFO common.c: Flash page at addr: 0x08060000 erased
 +2020-08-16T06:59:57 INFO common.c: Finished erasing 3 pages of 131072 (0x20000) bytes
 +2020-08-16T06:59:57 INFO common.c: Starting Flash write for F2/F4/F7/L4
 +2020-08-16T06:59:57 INFO flash_loader.c: Successfully loaded flash loader in sram
 +enabling 32-bit flash writes
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 32768
 +size: 21984
 +2020-08-16T07:00:04 INFO common.c: Starting verification of write complete
 +2020-08-16T07:00:07 INFO common.c: Flash written and verified! jolly good!
 +</code>
 +
 +Run
 +
 +<code>
 +picocom -b 115200 /dev/ttyACM0
 +picocom v3.1
 +
 +port is        : /dev/ttyACM0
 +flowcontrol    : none
 +baudrate is    : 115200
 +parity is      : none
 +databits are   : 8
 +stopbits are   : 1
 +escape is      : C-a
 +local echo is  : no
 +noinit is      : no
 +noreset is     : no
 +hangup is      : no
 +nolock is      : no
 +send_cmd is    : sz -vv
 +receive_cmd is : rz -vv -E
 +imap is        :
 +omap is        :
 +emap is        : crcrlf,delbs,
 +logfile is     : none
 +initstring     : none
 +exit_after is  : not set
 +exit is        : no
 +
 +Type [C-a] [C-h] to see available commands
 +Terminal ready
 +
 +MPY: sync filesystems
 +MPY: soft reboot
 +MicroPython v1.12-663-g9883d8e81 on 2020-08-16; NUCLEO-F411RE with STM32F411xE
 +Type "help()" for more information.
 +</code>
 === Resources === === Resources ===
  
Line 123: Line 278:
  
 [[http://micropython.org/download/esp32/|ESP32 firmware]] [[http://micropython.org/download/esp32/|ESP32 firmware]]
 +
 +[[http://micropython.org/download/stm32/|STM32 firmware]]
 +