STM32 Nucleo-L073RZ uploading files doesn't work

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.
Post Reply
b00mb0x
Posts: 3
Joined: Fri Apr 22, 2022 10:54 am

STM32 Nucleo-L073RZ uploading files doesn't work

Post by b00mb0x » Fri Apr 22, 2022 11:28 am

Hey everyone,
I recently got a STM32 Nucleo-L073RZ board and want to run MicroPython on it.

I am using rshell and repl does work, but when I enter for example 'cp boot.py /pyboard' I get the error message: "timed out or error in transfer to remote: b'F'". Does someone of you have an idea, how I can fix this?

Here some further details:
I am using Manjaro Linux.
I installed micropython by cloning the micropython git, making the unix submodule and running the "$ make BOARD=NUCLEO_L073RZ deploy-stlink" command. Since this resulted in the error message "ValueError: No DFU device found" I installed the 'firmware.bin' file using STM32CubeProgrammer.

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

Re: STM32 Nucleo-L073RZ uploading files doesn't work

Post by dhylands » Fri Apr 22, 2022 4:58 pm

The NUCLEO-L073 only has 192K of flash, so there is only room for a stripped down version of MicroPython and no room for a filesystem.

So all of the code you want to run needs to be included as frozen files.

b00mb0x
Posts: 3
Joined: Fri Apr 22, 2022 10:54 am

Re: STM32 Nucleo-L073RZ uploading files doesn't work

Post by b00mb0x » Mon Apr 25, 2022 7:18 am

Thanks a lot for this fast answer!

Can you tell me where to put my boot.py file? I tried copying it into micropython/ports/stm32/ and then run 'make BOARD=NUCLEO_L073RZ', but this didn't seem to work.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: STM32 Nucleo-L073RZ uploading files doesn't work

Post by Roberthh » Mon Apr 25, 2022 8:52 am

You can
1. put the file into a directory of your choice like my_modules in the stm32 directory
2. create a manifest.py file with the content:
freeze("$(PORT_DIR)/my_modules")
The argument of freeze() is the path of the directory containing your modules.
3. Build you binary with
make BOARD=NUCLEO_L073RZ FROZEN_MANIFEST=<path to manifest.py>

b00mb0x
Posts: 3
Joined: Fri Apr 22, 2022 10:54 am

Re: STM32 Nucleo-L073RZ uploading files doesn't work

Post by b00mb0x » Thu Apr 28, 2022 7:31 am

Thanks for the help Roberthh!
Now I created a my_modules folder and created a function test.py, which just prints out some text.
After building the binary I can find a file called "frozen_content.c" in my "build-NUCLEO_L073RZ" folder. As I understood the docs I should be able to import the function by calling "import test" in the REPL. However that resultet in an ImportError: no module named 'test'.

Do you have any ideas how to fix that?
And is there a way to automatically start a program at boot?

Post Reply