{"id":23714375,"url":"https://github.com/calinradoni/rust-stm32-container","last_synced_at":"2026-04-20T09:33:53.119Z","repository":{"id":182075733,"uuid":"272270688","full_name":"CalinRadoni/rust-stm32-container","owner":"CalinRadoni","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-14T21:11:08.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-07T15:50:54.265Z","etag":null,"topics":["docker","dockerfile","podman","rust","stm32"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CalinRadoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-06-14T19:36:25.000Z","updated_at":"2021-02-14T21:11:10.000Z","dependencies_parsed_at":"2023-07-18T16:52:37.933Z","dependency_job_id":null,"html_url":"https://github.com/CalinRadoni/rust-stm32-container","commit_stats":null,"previous_names":["calinradoni/rust-stm32-container"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CalinRadoni/rust-stm32-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2Frust-stm32-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2Frust-stm32-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2Frust-stm32-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2Frust-stm32-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CalinRadoni","download_url":"https://codeload.github.com/CalinRadoni/rust-stm32-container/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2Frust-stm32-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32041518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","dockerfile","podman","rust","stm32"],"created_at":"2024-12-30T20:19:15.553Z","updated_at":"2026-04-20T09:33:53.100Z","avatar_url":"https://github.com/CalinRadoni.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-stm32-container\n\nThis container is for programming STM32 controllers in Rust.\n\nThe variants are:\n\n- `rust-stm32:buster`\n- `rust-stm32:slim`\n- `rust-stm32:alpine` is removed until the `segfault` from `cargo generate` is solved\n\nfrom `docker.io/library/rust` alpine, buster and slim tags.\n\nIt adds to the official Rust image:\n\n- gdb-multiarch\n- openocd\n- cargo-binutils\n- cargo-generate\n- cargo-flash\n- llvm-tools-preview rustup component\n\nand these rustup targets:\n\n- `thumbv6m-none-eabi` for Cortex-M0 and Cortex-M0+\n- `thumbv7m-none-eabi` for Cortex-M3\n- `thumbv7em-none-eabi` for Cortex-M4 and Cortex-M7 (no FPU)\n- `thumbv7em-none-eabihf` for Cortex-M4F and Cortex-M7F (with FPU)\n\n## Builder\n\nYou need `buildah` or `docker` to build them.\n\nBuild the containers locally with the `create-variants.sh` script:\n\n- run `create-variants.sh` without parameters to create the Dockerfiles\n- run `create-variants.sh -b` to build them\n- run `create-variants.sh -l` to list generated containers\n\nTo build a single container call `buildah` or `podman` directly:\n\n```sh\n# for Docker use:\ndocker build --tag calinradoni/rust-stm32:buster buster\n\n# for Podman use:\nbuildah build-using-dockerfile --tag calinradoni/rust-stm32:buster buster\n```\n\nYou can also get them from [Docker Hub](https://hub.docker.com/r/calinradoni/rust-stm32) .\n\n## Usage\n\n- For flashing or debugging software use [With connected board](#with-connected-board)\n- For building only use [Without connected board](#without-connected-board) or [With connected board](#with-connected-board)\n- Use [Simple usage](#simple-usage) for testing this image. It can also be used for building, if you wish.\n\nRead about `CARGO HOME` environment variable: [CARGO HOME](https://doc.rust-lang.org/cargo/guide/cargo-home.html) functions as a download and source cache. When building a crate, Cargo stores downloaded build \ndependencies in the Cargo home.\n\n**Note:** I use [Podman](https://podman.io/). To use [Docker](https://www.docker.com/) just replace\n`podman` with `docker` in examples.\n\n### Simple usage\n\nThe following code will mount current directory as the `/source` directory in the container.\n\nGo to your project directory then start the container:\n\n```sh\npodman run --rm -it \\\n    --env USER=$USER \\\n    --volume $PWD:/source \\\n    --workdir /source \\\n    calinradoni/rust-stm32:buster\n```\n\nIn this case `CARGO HOME` is inside the container and is not persistent.\nAfter every start of the container, to build the crates, `cargo build` will have to download and compile build dependencies.\n\n### Without connected board\n\nTo persist the `CARGO HOME`, rust's download and source cache, I use the `~/.cargo` directory on the host.\nMake sure you have this directory or create it:\n\n```sh\nmkdir -p ~/.cargo\n```\n\nbefore starting the container with:\n\n```sh\npodman run --rm -it \\\n    --env USER=$USER \\\n    --env CARGO_HOME=/cargo \\\n    --volume $PWD:/source \\\n    --volume $HOME/.cargo:/cargo \\\n    --workdir /source \\\n    calinradoni/rust-stm32:buster\n```\n\n### With connected board\n\n#### ST-LINK access permissions\n\nYou need to set some udev permissions to be able to access the ST-LINK from a non-root account.\n\nSee the better approach from my [Non-root access for ST-LINK and USB-to-serial devices](https://calinradoni.github.io/pages/200616-non-root-access-usb.html) article or use the *quick* procedure from this section.\n\nOn the host, create and execute this script:\n\n```sh\n#!/bin/bash\n\nsudo tee /etc/udev/rules.d/70-st-link.rules \u003e /dev/null \u003c\u003c'EOF'\n# ST-LINK V2\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"3748\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv2_%n\"\n\n# ST-LINK V2.1\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"374b\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv2-1_%n\"\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"3752\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv2-1_%n\"\n\n# ST-LINK V3\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"374d\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv3loader_%n\"\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"374e\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv3_%n\"\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"374f\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv3_%n\"\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"3753\", MODE=\"600\", TAG+=\"uaccess\", SYMLINK+=\"stlinkv3_%n\"\nEOF\n\nsudo udevadm control --reload-rules\n```\n\nIf a ST-LINK board was plugged, unplug it then plug it again.\n\n#### Usage\n\nWith a board connected through a ST-LINK interface, run `ls /dev/stlink*` to find the corresponding\ndevice then start the container with the `--device` option.\n\n**Example** for a ST-LINK V2 interface:\n\n```bash\n$ ls /dev/stlink*\n/dev/stlinkv2_5\n```\n\nstart the container with:\n\n```sh\npodman run --rm -it \\\n    --env USER=$USER \\\n    --env CARGO_HOME=/cargo \\\n    --volume $PWD:/source \\\n    --volume $HOME/.cargo:/cargo \\\n    --workdir /source \\\n    --device=/dev/stlinkv2_5 \\\n    calinradoni/rust-stm32:buster\n```\n\n## License\n\nThis is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalinradoni%2Frust-stm32-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalinradoni%2Frust-stm32-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalinradoni%2Frust-stm32-container/lists"}