{"id":13632326,"url":"https://github.com/rust-embedded/cortex-m-quickstart","last_synced_at":"2025-05-14T21:07:55.435Z","repository":{"id":40213339,"uuid":"84746074","full_name":"rust-embedded/cortex-m-quickstart","owner":"rust-embedded","description":"Template to develop bare metal applications for Cortex-M microcontrollers","archived":false,"fork":false,"pushed_at":"2024-12-15T16:59:23.000Z","size":1286,"stargazers_count":859,"open_issues_count":21,"forks_count":175,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-05-08T22:33:59.729Z","etag":null,"topics":["arm","bare-metal","cargo-template","cortex-m","microcontroller","no-std","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-embedded.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-12T18:03:22.000Z","updated_at":"2025-05-06T14:00:19.000Z","dependencies_parsed_at":"2024-01-14T07:04:56.995Z","dependency_job_id":"4bcbae57-06aa-47a2-a50f-119686a5cfbd","html_url":"https://github.com/rust-embedded/cortex-m-quickstart","commit_stats":null,"previous_names":["japaric/cortex-m-quickstart"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Fcortex-m-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Fcortex-m-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Fcortex-m-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Fcortex-m-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-embedded","download_url":"https://codeload.github.com/rust-embedded/cortex-m-quickstart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227613,"owners_count":22035670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","bare-metal","cargo-template","cortex-m","microcontroller","no-std","rust"],"created_at":"2024-08-01T22:02:59.887Z","updated_at":"2025-05-14T21:07:50.423Z","avatar_url":"https://github.com/rust-embedded.png","language":"Rust","readme":"# `cortex-m-quickstart`\n\n\u003e A template for building applications for ARM Cortex-M microcontrollers\n\nThis project is developed and maintained by the [Cortex-M team][team].\n\n## Dependencies\n\nTo build embedded programs using this template you'll need:\n\n- Rust 1.31, 1.30-beta, nightly-2018-09-13 or a newer toolchain. e.g. `rustup\n  default beta`\n\n- The `cargo generate` subcommand. [Installation\n  instructions](https://github.com/ashleygwilliams/cargo-generate#installation).\n\n- `rust-std` components (pre-compiled `core` crate) for the ARM Cortex-M\n  targets. Run:\n\n``` console\n$ rustup target add thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf\n```\n\n## Using this template\n\n**NOTE**: This is the very short version that only covers building programs. For\nthe long version, which additionally covers flashing, running and debugging\nprograms, check [the embedded Rust book][book].\n\n[book]: https://rust-embedded.github.io/book\n\n0. Before we begin you need to identify some characteristics of the target\n  device as these will be used to configure the project:\n\n- The ARM core. e.g. Cortex-M3.\n\n- Does the ARM core include an FPU? Cortex-M4**F** and Cortex-M7**F** cores do.\n\n- How much Flash memory and RAM does the target device has? e.g. 256 KiB of\n  Flash and 32 KiB of RAM.\n\n- Where are Flash memory and RAM mapped in the address space? e.g. RAM is\n  commonly located at address `0x2000_0000`.\n\nYou can find this information in the data sheet or the reference manual of your\ndevice.\n\nIn this example we'll be using the STM32F3DISCOVERY. This board contains an\nSTM32F303VCT6 microcontroller. This microcontroller has:\n\n- A Cortex-M4F core that includes a single precision FPU\n\n- 256 KiB of Flash located at address 0x0800_0000.\n\n- 40 KiB of RAM located at address 0x2000_0000. (There's another RAM region but\n  for simplicity we'll ignore it).\n\n1. Instantiate the template.\n\n``` console\n$ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart\n Project Name: app\n Creating project called `app`...\n Done! New project created /tmp/app\n\n$ cd app\n```\n\n2. Set a default compilation target. There are four options as mentioned at the\n   bottom of `.cargo/config`. For the STM32F303VCT6, which has a Cortex-M4F\n   core, we'll pick the `thumbv7em-none-eabihf` target.\n\n``` console\n$ tail -n9 .cargo/config.toml\n```\n\n``` toml\n[build]\n# Pick ONE of these compilation targets\n# target = \"thumbv6m-none-eabi\"    # Cortex-M0 and Cortex-M0+\n# target = \"thumbv7m-none-eabi\"    # Cortex-M3\n# target = \"thumbv7em-none-eabi\"   # Cortex-M4 and Cortex-M7 (no FPU)\ntarget = \"thumbv7em-none-eabihf\" # Cortex-M4F and Cortex-M7F (with FPU)\n# target = \"thumbv8m.base-none-eabi\"   # Cortex-M23\n# target = \"thumbv8m.main-none-eabi\"   # Cortex-M33 (no FPU)\n# target = \"thumbv8m.main-none-eabihf\" # Cortex-M33 (with FPU)\n```\n\n3. Enter the memory region information into the `memory.x` file.\n\n``` console\n$ cat memory.x\n/* Linker script for the STM32F303VCT6 */\nMEMORY\n{\n  /* NOTE 1 K = 1 KiBi = 1024 bytes */\n  FLASH : ORIGIN = 0x08000000, LENGTH = 256K\n  RAM : ORIGIN = 0x20000000, LENGTH = 40K\n}\n```\n\n4. Build the template application or one of the examples.\n\n``` console\n$ cargo build\n```\n\n## VS Code\n\nThis template includes launch configurations for debugging CortexM programs with Visual Studio Code located in the `.vscode/` directory.  \nSee [.vscode/README.md](./.vscode/README.md) for more information.  \nIf you're not using VS Code, you can safely delete the directory from the generated project.\n\n# License\n\nThis template is licensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], the maintainer of this crate, the [Cortex-M team][team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: https://www.rust-lang.org/policies/code-of-conduct\n[team]: https://github.com/rust-embedded/wg#the-cortex-m-team\n","funding_links":[],"categories":["Rust","Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded%2Fcortex-m-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-embedded%2Fcortex-m-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded%2Fcortex-m-quickstart/lists"}