Skip to content

Build webassembly and windows ports#70

Open
Josverl wants to merge 2 commits intomattytrentini:mainfrom
Josverl:build_sa_ports
Open

Build webassembly and windows ports#70
Josverl wants to merge 2 commits intomattytrentini:mainfrom
Josverl:build_sa_ports

Conversation

@Josverl
Copy link
Copy Markdown
Contributor

@Josverl Josverl commented Feb 17, 2025

This pull request includes several changes to add support for building MicroPython for webassembly and windows

WebAssembly is supported using the ARM_BUILD_CONTAINER :

  • The emsdk toolchain is installed during the first build using the tools/ci.sh script that is used to run the integration tests for MicroPython.
  • after the first build the emsdk toolchain is cached and used for subsequent builds.

Windows is supported using the MinGW toolchain:

  • The windows build uses the container definition micropython/build-micropython-win-mingw. It uses the same build process as the official MicroPython Docker container, but with the MinGW toolchain instead of the ARM toolchain.
  • This container is not yet published, but can be built locally from the containers/build-micropython-win-mingw directory

Build process improvements:

  • src/mpbuild/build.py: Added support for the new MinGW build container and updated the build command to handle special cases for webassembly and windows ports. This includes setting up the CI environment and adding cross-compilation arguments for Windows. [1] [2] [3] [4]

Code cleanup and refactoring:

  • src/mpbuild/board_database.py: Moved the import of Path to the top of the file for consistency and added a print statement to provide more information when a variant is not found. [1] [2]

Depends on

Never mind - merged already

@Josverl
Copy link
Copy Markdown
Contributor Author

Josverl commented Feb 17, 2025

@mattytrentini , in order to mpbuild build windows a new container needs to be published.
is that something that you can do ?
I'd rather not scatter the build images across different owners, but not sue if to host them in seperate repos ?

@Josverl Josverl marked this pull request as draft February 17, 2025 01:02
@mattytrentini
Copy link
Copy Markdown
Owner

is that something that you can do ?
I'd rather not scatter the build images across different owners, but not sue if to host them in seperate repos ?

Yes, I can do that (I can push to the MicroPython docker hub) but I would prefer to have the Dockerfile's in their own separate repositories. Currently I'm the owner for the repositories of containers to create builds (that aren't published elsewhere, like the IDF) so I'm happy to create a new repo to house the mingw build container you've listed, if that's ok with you?

Long-term, I'd like to transfer those repos to the micropython Github org.

@Josverl
Copy link
Copy Markdown
Contributor Author

Josverl commented Feb 17, 2025

I'm happy to create a new repo to house the mingw build container you've listed, if that's ok with you?

repo created - Ill invite you as a co-owner
https://github.com/Josverl/build-micropython-win-mingw

@Josverl Josverl marked this pull request as ready for review February 26, 2025 19:25
@andrewleech
Copy link
Copy Markdown
Contributor

I'm not sure if it's faster or not but there's an official emsdk image that can be used:

docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) emscripten/emsdk bash -c 'source tools/ci.sh && ci_webassembly_setup && ci_webassembly_build && ci_webassembly_run_tests'

@Josverl
Copy link
Copy Markdown
Contributor Author

Josverl commented Mar 20, 2025

From the first look That are essentially the same commands, running the CI setup scripts.

The value of Embedding them in Mpflash is that it makes building more accessible.

But I agree that the logic structure for stringing together the docker commands could use improvement

@jonnor
Copy link
Copy Markdown

jonnor commented Apr 13, 2025

This seems very useful. Especially since there are no pre-built binary images for these published on MicroPython download pages.
Is there anything blocking the windows support now?

@Josverl
Copy link
Copy Markdown
Contributor Author

Josverl commented Apr 14, 2025

It's useful to me for sure 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants