Code Monkey home page Code Monkey logo

rust-esp-container's Introduction

Rust ESP compiler container Repository on Quay

This is a container which can be used to build a Rust project for the ESP32.

Note: I recently noticed an issue compiling the compiler_builtins. It looks like some newly introduced issue. The workaround is to switch back to an older version of compiler_builtins in Xargo.toml:

[dependencies]
compiler_builtins = { version = "=0.1.16" }

Pre-requisites

Usage

This container image provides a few tools which can be run like this:

docker run -ti -v $PWD:/home/project:z quay.io/ctron/rust-esp:latest

Volume mapping

The -v $PWD:/home/project:z will map the current directory into the location /home/project inside the container. This is required so that the tools inside the container can work with the project.

The $PWD part uses the current directory. This will only work in a Bourne like shell. You can replace this with the absolute path to your project instead.

You can drop the :z suffix, if you don't have SElinux on the host system.

All following example assue that you use $PWD:/home/project:z.

Default command

This will run the default command build-project. You can run other commands, e.g. bash like this:

docker run -ti -v $PWD:/home/project:z quay.io/ctron/rust-esp:latest bash

Labels

The master branch of this repository will build into the latest label, which is also the default if you omit the :latest suffix in the container name.

Each git tag will also be build into a container image tag, so e.g. git tag 0.0.1, will be built into the container tag :0.0.1.

So should the latest image break, it should always be possible to switch to a previous version.

Bootstrapping

Initially a few files need to be set up. The ESP-IDF components need to be configured and compiled. Run the following command to create an initial setup:

docker run -ti -v $PWD:/home/project:z quay.io/ctron/rust-esp:latest create-project

This will create (overwrite) as few files which are required to build the project. Next run:

docker run -ti -v $PWD:/home/project:z quay.io/ctron/rust-esp:latest make menuconfig

Which will start the ESP-IDF build and shows you the menu config tool for configuring your ESP project. Be sure to save when you exit.

Building

In order to build the project, run the following command:

docker run -ti -v $PWD:/home/project:z quay.io/ctron/rust-esp:latest

This will compile the ESP-IDF part, the rust part and finally convert it to an image which you can upload to your ESP.

Uploading

You can then upload the image using the flash-project executable:

docker run -ti --device=/dev/ttyUSB0 -v $PWD:/home/project:z rust-esp32:latest flash-project

If this doesn't work or you need to use differnt tool it might be easier to upload the image via esptool from the host machine. To do this call:

esptool write_flash 0x10000 esp-app.bin

Building the container

You can also build the container image yourself, by cloning this repository and executing:

docker build . -t rust-esp

Notes

  • Use this at your own risk. No guarantees.
  • Contributions are welcome.
  • This /should/ work on MacOS the same way. But I haven't tested it.
  • A test on Windows shows that, yes it works. But with some quirks:
    • The menu make menuconfig renders a bit weird. Maybe the new Windows terminal will fix this.
    • The first make app will run just fine, but after that it fails to compile. Maybe some issue with the Windows CIFS mapping in Docker. However, you can skip this step and run xbuild-project instead. That will only compile the rust part.
  • In theory this should work also with with the ESP8266. A few tweaks for the build files will be required, and I didn't test this.
  • I put this on quay.io as Docker Hub continously failed to build this image. After several hours, the build times out. On quay.io it still takes around two hours but never times out.

Also see

This work is built upn the work of others. Please see:

rust-esp-container's People

Contributors

0ndorio avatar ctron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.