{"id":28535102,"url":"https://github.com/hexdae/bazel-rust-embedded","last_synced_at":"2026-04-18T14:03:50.572Z","repository":{"id":49128495,"uuid":"378542068","full_name":"hexdae/bazel-rust-embedded","owner":"hexdae","description":"A collection of Bazel tools for embedded rust","archived":false,"fork":false,"pushed_at":"2021-06-27T19:27:54.000Z","size":1052,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-31T14:40:46.248Z","etag":null,"topics":["arm","bazel","bazel-examples","bazel-rules","embedded","microcontroller","rust"],"latest_commit_sha":null,"homepage":"","language":"Starlark","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/hexdae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-20T02:26:59.000Z","updated_at":"2024-11-14T06:39:23.000Z","dependencies_parsed_at":"2022-09-16T17:52:19.903Z","dependency_job_id":null,"html_url":"https://github.com/hexdae/bazel-rust-embedded","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hexdae/bazel-rust-embedded","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Fbazel-rust-embedded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Fbazel-rust-embedded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Fbazel-rust-embedded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Fbazel-rust-embedded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexdae","download_url":"https://codeload.github.com/hexdae/bazel-rust-embedded/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Fbazel-rust-embedded/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31971493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["arm","bazel","bazel-examples","bazel-rules","embedded","microcontroller","rust"],"created_at":"2025-06-09T17:14:01.530Z","updated_at":"2026-04-18T14:03:47.771Z","avatar_url":"https://github.com/hexdae.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"GitHub license\" src=\"https://img.shields.io/github/license/d-asnaghi/bazel-rust-embedded?color=success\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/stargazers\"\u003e\n    \u003cimg alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/d-asnaghi/bazel-rust-embedded?color=success\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/issues\"\u003e\n    \u003cimg alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/d-asnaghi/bazel-rust-embedded\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/actions\"\u003e\n    \u003cimg alt=\"Linux\" src=\"https://github.com/d-asnaghi/bazel-rust-embedded/workflows/Linux/badge.svg\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/actions\"\u003e\n    \u003cimg alt=\"macOS\" src=\"https://github.com/d-asnaghi/bazel-rust-embedded/workflows/macOS/badge.svg\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/d-asnaghi/bazel-rust-embedded/actions\"\u003e\n    \u003cimg alt=\"Widnows\" src=\"https://github.com/d-asnaghi/bazel-rust-embedded/workflows/Windows/badge.svg\"\u003e\n\u003c/a\u003e\n\n\u003c/p\u003e\n\n# Rust Embedded Tools\n\nThis repository contains useful, cross-platform embedded tools that work out of the box in any Bazel project.\n\nIf this project was useful to you, give it a ⭐️ and I'll keep improving it!\n\n## Install in your workspace\n\nTo import the `Bazel Rust Embedded` repo in your `WORKSPACE` make just add the following lines:\n\n```python\n\nhttp_archive(\n    name = \"rust_embedded\",\n    sha256 = \"\u003csha256\",\n    strip_prefix = \"bazel-rust-embedded-\u003cversion\u003e\",\n    url = \"https://github.com/d-asnaghi/bazel-rust-embedded/archive/refs/tags/\u003cversion\u003e.tar.gz\",\n)\n\nload(\"@rust_embedded//:repositories.bzl\", \"rust_embedded_repositories\")\n\nrust_embedded_repositories()\n\nload(\"@rust_embedded//:deps.bzl\", \"rust_embedded_deps\")\n\nrust_embedded_deps()\n\n```\n\nHead to the [Releases](https://github.com/d-asnaghi/bazel-rust-embedded/releases) page for more specific `WORKSPACE` settings\n\n## Dependencies\n\nAt the moment, this is still a pre-release project. The build is not completely hermetic (it will be in the future) and requires to install the following dependencies based on your operating system\n\n### Linux\n\n`sudo apt install -y pkg-config libusb-1.0-0-dev libftdi1-dev`\n### Windows\n\n`vcpkg install libftdi1:x64-windows-static-md libusb:x64-windows-static-md`\n\n## Examples\n\nHead to the [examples](examples) directory where you can see how to use the rules in this repo to flash and debug ARM firmware targets using a custom toolchain.\n\n## [Cargo Flash](https://crates.io/crates/cargo-flash)\n\nYou can use cargo flash to load binaries or elf files to any target that uses a supported probe (JLink, STLink, Etc).\n\nYou can invoke the tool directly from the command line with `bazel run @rust_embedded//:cargo-flash -- --chip CHIP --elf ELF` or use the target in your bazel rules.\n\nYou can also use the built in rules, as the following example shows\n\n```python\n# package/BUILD\n\nload(\"@rust_embedded//:rules.bzl\", \"cargo_flash\")\n\ncc_binary(\n    name = \"firmware_elf\",\n    ...\n)\n\ncc_binary(\n    name = \"firmware_bin\",\n    ...\n)\n\ncargo_flash(\n    name = \"flash_elf\",\n    file = \":firmware_elf\",\n    chip = \"STM32F103C8\",\n)\n\ncargo_flash(\n    name = \"flash_bin\",\n    file = \":firmware_bin\",\n    chip = \"STM32F103C8\",\n    bin = True,\n)\n```\n\nThen `bazel run //package:flash_elf` and `bazel run //package:flash_bin` will load the file to the target\n## [Cargo Embed](https://crates.io/crates/cargo-embed)\n\nCargo embed is a more powerful version of cargo-flash. It can be used to start a gdb server after flashing the probe. You have an option to specify a custom config to feed into cargo flash for maximum configurability.\n\nThat config can also be an actual `.toml` file if you would rather have even more options.\n\n```python\n# package/BUILD\n\nload(\"@rust_embedded//:rules.bzl\", \"cargo_embed_config\", \"cargo_embed\")\n\ncc_binary(\n    name = \"firmware_elf\",\n    ...\n)\n\ncargo_emebd_config(\n    name = \"config\",\n    flash = \"true\",\n    halt = \"true\",\n    gdb_enabled = \"true\",\n)\n\ncargo_embed(\n    name = \"flash_debug\",\n    file = \":firmware_elf\",\n    chip = \"STM32F103C8\",\n    custom_config = \":config\",\n)\n```\n\n# GDB targets\n\nCargo embed exposes a GDB server, which can be connected to. For convenience, there are rules that specifically instantiate a GDB server and even launch the console for you.\n\n```python\n# package/BUILD\n\nload(\"@rust_embedded//:rules.bzl\", \"gdb_server\", \"gdb_console\")\n\ncc_binary(\n    name = \"firmware_elf\",\n    ...\n)\n\ngdb_server(\n    name = \"gdb-server\",\n    file = \":firmware\",\n    chip = \"STM32F103C8\",\n)\n\ngdb_console(\n    name = \"gdb-console\",\n    file = \":firmware_elf\",\n    chip = \"STM32F103C8\",\n    gdb = \"\u003clabel to gdb binary\u003e\",\n    gdb_commands = [\n        \"b main\",\n    ]\n)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdae%2Fbazel-rust-embedded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexdae%2Fbazel-rust-embedded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdae%2Fbazel-rust-embedded/lists"}