element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Andy Clark's Blog Cross Compiling Micropython on WSL for STM32
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Workshopshed
  • Date Created: 5 Aug 2021 9:19 AM Date Created
  • Views 1958 views
  • Likes 5 likes
  • Comments 0 comments
Related
Recommended

Cross Compiling Micropython on WSL for STM32

Workshopshed
Workshopshed
5 Aug 2021

Following on from my posts looking at the Portenta H7 Vision Shield I wanted to see if I could get the dual boot working with Micropython running on the M7 core and C running on the M4 core. So I posted in a bunch of forums and got some help from Ibrahim Abdelkader over on the OpenMV forums.

 

https://forums.openmv.io/t/portenta-micropython-on-m7-core-c-on-m4-core/6201

 

Ibrahim pointed me at some suitable code and advised me that I'd need to compile it from source but reminded me that they don't support this kind of custom firmware development. So I thought I'd first start by building the standard micropython firmware and then move across to the OpenMV one and finally add the custom tweaks.

 

I was building on WSL running a clean image of Ubuntu. After a few false starts took advice from the micropython docs and installed the build essentials package.

 

sudo apt-get install build-essential

 

I then cloned the repo, this is essential as the make commands rely on some of the git files to build properly.

 

git clone https://github.com/micropython/micropython.git
cd micropython

 

Then I build the cross compile tools and the unix variant.

 

cd mpy-cross
make

 

cd ports/unix
make submodules
make

 

To build the STM32 variant you need to have an arm compiler installed. This doesn't seem to be in the apt-get repos so again a few false starts. I followed the advice at https://codelv.com/blog/2021/1/installing-arm-embedded-toolchain-on-ubuntu-20-04 and downloaded and extracted the latest image for my platform. Then updated ~/.bashrc to contain a path to the binaries.

 

wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.07/gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2
tar -xf gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2

 

So then I could build the STM32 variant.

 

cd ports/stm32
make submodules
make

 

That successfully generated some binary images so now over to https://github.com/openmv/micropython to see if I can repeat the process using their fork.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube