[NUCLEO-F401RE] procedure to upload the MicroPython image

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
rino
Posts: 1
Joined: Sat Nov 03, 2018 8:54 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by rino » Sat Nov 03, 2018 9:05 am

I just wrote an article about how to flash a Nucleo-64 STM32F401 board starting from the .dfu binary and using the ST morpho pins:

http://www.perlatecnica.it/tutorial/stm ... stm32f401/

Sorry it's in Italian

User avatar
boochow
Posts: 28
Joined: Sat Dec 16, 2017 9:36 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by boochow » Mon Dec 03, 2018 1:26 pm

The easiest way to deploy MicroPython to Mbed-ready boards is to drag and drop a firmware binary onto Mbed filesystem folder.
I made an archive page which has firmware binaries built on December 1, 2018 from MicroPython mainline source code.

https://blog.boochow.com/micropython-fi ... bed-boards
(I have tested only 3 boards: 401RE, L432KC, and IOT01A.)

They are zipped files so you should download the file for your board then unzip it to get the binary file.
Drag and drop the binary file onto the folder which would open when you connect the board to your PC with USB.

These binary files are simply converted from ELF files using objdump like this:

Code: Select all

arm-none-eabi-objcopy -O binary build-STM32F769DISC/firmware.elf upy-f746disco.bin
What this method is inferior to the official deploy method is that this method will erase all of the internal files saved in flash memory area.
This is unavoidable because the internal filesystem block is placed between ISR and TEXT area and the format of raw binary file provides no means to skip writing the specific memory area.

nilo
Posts: 2
Joined: Tue Jan 08, 2019 12:13 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by nilo » Tue Jan 08, 2019 7:28 pm

boochow,
thanks for creating the "bin" file for the iot1a, you make life easier.
I got the REPL working. since I just downloaded your binary files
I do not have the "boot.py" and "main.py". how do I run a script?
like writing a script inside main.py, reset the board to run the script.
any comments will be highly appreciated, sorry for bothering you I'm a newbie.

User avatar
boochow
Posts: 28
Joined: Sat Dec 16, 2017 9:36 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by boochow » Wed Jan 09, 2019 11:55 am

@nilo the IoT1A board has two USB ports, USB-STLink on the top right corner and USB-OTG on the top center.
You can access the files through USB-OTG port only. USB-STLink port is dedicated to Mbed.

Please note that ( i ) you always have to connect the USB-STLink port to power your board and ( ii ) the USB-OTG port is a micro USB connector which is soldered in upside-down position.

nilo
Posts: 2
Joined: Tue Jan 08, 2019 12:13 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by nilo » Mon Jan 14, 2019 6:15 pm

@boochow,
thanks a lot, everything is working now (using 2 microUSB's). This is the quickest MicroPython implementation on the IOT1A.
now I just have have to find drivers for all the sensors on this board. I got the VL53L0X drivers from desiphu working too.

blipton
Posts: 7
Joined: Mon Dec 15, 2014 3:11 am

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by blipton » Mon Jan 27, 2020 4:19 pm

Sorry to bring up an old thread, but I've got a sort of similar issue.. I have a nucleo board with the built-in stlink, however, it doesn't come with 'mbed' installed, so programming via the mass-data-storage is not possible. However, since the st-link (and st-flash) utility seem to support the .bin format, I'm curious why the st-link can't be used to program the bin instead of via the dfu. The dfu seems trickier as you have to connect directly to the main cpu's usb pins, reset to the boot0 bootloader, then flash with the dfu programming software and/or stm32-versprog?

BTW, assuming I can get micropython flashed, I would then use the usb otg connector to upload py files so that it executes it automatically at power-on? How do you specify which files or order it should execute?

User avatar
dhylands
Posts: 3261
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [NUCLEO-F401RE] procedure to upload the MicroPython image

Post by dhylands » Mon Jan 27, 2020 4:36 pm

You should be able to use st-flash to program the NUCLEO-F401RE. The Makefile has a deploy-stlink rule which will do the appropriate flashing steps:

Code: Select all

make BOARD=NUCLEO_F401RE deploy-stlink
This assumes that you have the stlink tools installed and setup.

Post Reply