Building for STM32 on Linux
Building for STM32 on Linux
Hi, So I'm new to micropython and was wondering exactly what I need to do to set up a build system on Linux to build firmware for STM32.
I want to set up a VirtualBox Linux guest OS on a Windows 10 host and was wondering what the easiest Linux distribution to work with would be? Does it need to be 32bit, 64bit or does it not matter?
Much of the (terse) documentation on the subject seems to be out of date (still referring to the stmhal directory when this has been moved and renamed ports\stm32 in the latest source).
Exactly which toolchains are needed to accomplish this?
Any advice would be much appreciated!
Phil
I want to set up a VirtualBox Linux guest OS on a Windows 10 host and was wondering what the easiest Linux distribution to work with would be? Does it need to be 32bit, 64bit or does it not matter?
Much of the (terse) documentation on the subject seems to be out of date (still referring to the stmhal directory when this has been moved and renamed ports\stm32 in the latest source).
Exactly which toolchains are needed to accomplish this?
Any advice would be much appreciated!
Phil
Re: Building for STM32 on Linux
It should work under either 32-bit or 64-bit, although recent distros are typically only offered in 64-bit. I use 64-bit native.
I use the launchpad gcc from here: https://launchpad.net/gcc-arm-embedded
Any version should work. I tend to use am older version and Damien tends to use a really new version.
I use the launchpad gcc from here: https://launchpad.net/gcc-arm-embedded
Any version should work. I tend to use am older version and Damien tends to use a really new version.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Building for STM32 on Linux
For an easy Linux distro I recommend (and currently use) Mint 64 bit.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Building for STM32 on Linux
Hi All
Thankyou so much for your support, it is much appreciated!
For the record, I have this building now. This is what I did, in baby steps, just in case anyone else wants to tread a similar path!
Installed Oracle VM VirtualBox 5.2.12 on Windows 10
Installed Raspberry Pi Desktop (32-bit Debian 9 (Stretch) with Pixel)
into a new virtual machine with 2Gb RAM and 32Gb Disk
( !!! git clone https://github.com/micropython/micropython.git does NOT work for me !!! --
LWIP folder seems to be empty)
downloaded micropython-1.9.4.tar.xz from https://micropython.org/download using Ras Pi web browser
open terminal session:
cd /home/pi/Downloads
uncompress using:
tar xf micropython-1.9.4.tar.xz
using Ras Pi file manager:
move micropython-1.9.4 from /home/pi/Downloads to /home/pi
in terminal session:
cd /home/pi
rename the micropython folder:
mv micropython-1.9.4 micropython
install the toolchain:
sudo apt-get install gcc-arm-none-eabi
try to build micropython cross-compiler tools:
cd /home/pi/micropython/mpy-cross
make
try to build micropython for ST32F4DISC board:
cd /home/pi/micropython/ports/stm32
make BOARD=STM32F4DISC
output is in /home/pi/micropython/ports/stm32/build-STM32F4DISC and is called firmware.hex
Best Regards
philcl
Thankyou so much for your support, it is much appreciated!
For the record, I have this building now. This is what I did, in baby steps, just in case anyone else wants to tread a similar path!
Installed Oracle VM VirtualBox 5.2.12 on Windows 10
Installed Raspberry Pi Desktop (32-bit Debian 9 (Stretch) with Pixel)
into a new virtual machine with 2Gb RAM and 32Gb Disk
( !!! git clone https://github.com/micropython/micropython.git does NOT work for me !!! --
LWIP folder seems to be empty)
downloaded micropython-1.9.4.tar.xz from https://micropython.org/download using Ras Pi web browser
open terminal session:
cd /home/pi/Downloads
uncompress using:
tar xf micropython-1.9.4.tar.xz
using Ras Pi file manager:
move micropython-1.9.4 from /home/pi/Downloads to /home/pi
in terminal session:
cd /home/pi
rename the micropython folder:
mv micropython-1.9.4 micropython
install the toolchain:
sudo apt-get install gcc-arm-none-eabi
try to build micropython cross-compiler tools:
cd /home/pi/micropython/mpy-cross
make
try to build micropython for ST32F4DISC board:
cd /home/pi/micropython/ports/stm32
make BOARD=STM32F4DISC
output is in /home/pi/micropython/ports/stm32/build-STM32F4DISC and is called firmware.hex
Best Regards
philcl
Re: Building for STM32 on Linux
That's because the lwip directory is actually from another git repository.philcl wrote: ↑Mon Jun 18, 2018 3:07 pm( !!! git clone https://github.com/micropython/micropython.git does NOT work for me !!! --
LWIP folder seems to be empty)
When you execute this command:
Code: Select all
git submodule update --init
Code: Select all
$ git submodule status
43a6e6bd3bbc03dc501e16b89fba0ef042ed3ea0 lib/axtls (remotes/origin/micropython-2.1.3)
35aaec4418ad78628a3b935885dd189d41ce779b lib/berkeley-db-1.xx (remotes/origin/embedded)
e9de7e35f2339598b16cbb375f9992643ed81209 lib/libffi (v3.2.1-146-ge9de7e3)
92f23d6ca0971a32f2085b9480e738d34174417b lib/lwip (STABLE-2_0_3_RELEASE)
1fe30d1446f2eba3730dc4b05e9ac0cf03bcf9bf lib/stm32lib (F0-1.9.0+F4-1.16.0+F7-1.7.0+H7-1.2.0+L4-1.8.1-10-g1fe30d1)
Re: Building for STM32 on Linux
Thanks for clearing that mystery up Dave, I'll give it another try when I get a minute!
Best Regards
Phil
Best Regards
Phil
Re: Building for STM32 on Linux
This is all working as advertised now, thanks again.
Now, time to dig in and get to grips with MicroPython properly!
Best Regards
Phil
Now, time to dig in and get to grips with MicroPython properly!
Best Regards
Phil
Re: Building for STM32 on Linux
I think these are better than the launchpad cross compilers : https://developer.arm.com/open-source/g ... /downloads
Then set the CROSS_COMPILE variable :
make BOARD=B_L475E_IOT01A CROSS_COMPILE=mumble/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-
Then set the CROSS_COMPILE variable :
make BOARD=B_L475E_IOT01A CROSS_COMPILE=mumble/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-
Re: Building for STM32 on Linux
Hi, I am also a newbie in MicroPython and I am wondering do you know what IDE can I use to compile and debug MicroPython for STM32, for instance Visual Studio Code? Can use the IDE also for debugging (I have ST-LINK v2 and BMP probes)?
Thank you in advance for any help
Tuckata
Thank you in advance for any help
Tuckata
Re: Building for STM32 on Linux
about a year ago we got mPy to build on Windows using the WSL - which gets you a Linux compatible shell where you can then follow the instructions for building on Linux.
I have also vetted some docs for building things (FPGA tools) using native windows tools, I can see the advantages, but it was way more effort to gather all the pieces in place.
installing WSL is well documented and pretty easy, and then the "build mPy on Linux" is also well documented and somewhat straight forward. I think you will get more help with this path than trying to use native Windows tools.
I have also vetted some docs for building things (FPGA tools) using native windows tools, I can see the advantages, but it was way more effort to gather all the pieces in place.
installing WSL is well documented and pretty easy, and then the "build mPy on Linux" is also well documented and somewhat straight forward. I think you will get more help with this path than trying to use native Windows tools.