Getting Started with STM32

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Talash
Posts: 2
Joined: Fri Jul 10, 2020 8:23 pm

Getting Started with STM32

Post by Talash » Fri Jul 10, 2020 11:10 pm

Hello everyone! New to the forum, starting to touch MicroPython for the first time and looking into how it could potentially replace our use of MBED for simpler embedded systems while still keeping the simplicity of code updates over USB.

I was hoping to get some advice on setting up my build environment for the STM32 port. I have a pyboard 1.1 handy.

Thanks to current working-from-home rules I am stuck using a Windows 10 laptop for which I am unable to set up WSL. I expect that building micropython within a Linux environment might go the smoothest as then I'm simply following the documentation, but if anyone has any pointers I should follow I'd be happy to hear them. I have seen some people mentioning using Docker which I am comfortable with so that's the first path I was thinking of attempting.

My first goal is just to make sure I'm building the STM32 port and able to flash my pyboard properly without issues. After that I'll be attempting to compile a third-party C library (also built for STM32) into micropython with a wrapper to make it available as a package to be imported and used in python, to talk to an external UART device. The official documentation on this process looks straight forward, but I expect there will be a few complications along the way as there always is.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Getting Started with STM32

Post by jimmo » Mon Jul 13, 2020 2:12 am

Talash wrote:
Fri Jul 10, 2020 11:10 pm
Thanks to current working-from-home rules I am stuck using a Windows 10 laptop for which I am unable to set up WSL. I expect that building micropython within a Linux environment might go the smoothest as then I'm simply following the documentation, but if anyone has any pointers I should follow I'd be happy to hear them. I have seen some people mentioning using Docker which I am comfortable with so that's the first path I was thinking of attempting.
Hi there,

It is possible to build on Windows, but if you're comfortable with Docker then that's definitely the way to go. Once you have a Ubuntu container ready, then you don't need much more than just arm-none-eabi-gcc (which I think is the gcc-arm-none-eabi package on Ubuntu).

Then the instructions are here -- https://github.com/micropython/micropyt ... structions

Once the build completes, you'll end up with a .dfu file that you can copy back out to Windows and use any DFU programmer (it seems that the official ST tools are the easiest, dfu-util might need some stuffing around with Zadig to enable the libusb driver, see https://www.hanselman.com/blog/HowToFix ... ndows.aspx).

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Getting Started with STM32

Post by OutoftheBOTS_ » Mon Jul 13, 2020 6:50 am

I use dfusedemo from ST to flash .DFU files to STM32 boards under windows

Talash
Posts: 2
Joined: Fri Jul 10, 2020 8:23 pm

Re: Getting Started with STM32

Post by Talash » Mon Jul 13, 2020 5:20 pm

Thank you jimmo and OutoftheBOTS_, it's good to know I was at least starting down the right path. I'll check out dfusedemo when I get to that point!

fredb
Posts: 7
Joined: Mon Apr 27, 2020 2:30 pm

Re: Getting Started with STM32

Post by fredb » Fri Jul 24, 2020 12:39 pm

Hi, Talash,
To build Micropython for STM32 on Linux machine, make sure to have the right version of Ubuntu.
Currently I'm working with Mint 19.3 Tricia (based on Ubuntu 18.04 Bionic Beaver) to compile Micropython sources with the tools : team-gcc-arm-embedded for STM32.
I tried the latest version released this spring (Mint 20 based on Ubuntu 20.04 Focal Fossa) but unfortunately, there is not yet a repository PPA of team-gcc-arm-embedded to allow a correct installation.

HarryOz
Posts: 18
Joined: Thu May 19, 2016 6:02 am

Re: Getting Started with STM32

Post by HarryOz » Thu Oct 08, 2020 11:30 pm

I have been having all sorts of trouble trying to get the build to work. Can you share a brief guid on how you did it with Ubuntu 18?

Post Reply