diff --git a/.github/workflows/deploy_zola.yml b/.github/workflows/deploy_zola.yml deleted file mode 100644 index e3fa6d95..00000000 --- a/.github/workflows/deploy_zola.yml +++ /dev/null @@ -1,22 +0,0 @@ -# adopted from https://www.getzola.org/documentation/deployment/github-pages/ -on: push -name: Build and deploy GH Pages -jobs: - build: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - steps: - - name: checkout - uses: actions/checkout@v6 - with: - submodules: recursive - - name: build and deploy - uses: shalzz/zola-deploy-action@master - env: - # Target branch - PAGES_BRANCH: gh-pages - # Provide personal access token - # TOKEN: ${{ secrets.TOKEN }} - # Or if publishing to the same repo, use the automatic token - TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 87174b68..00000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/public/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e3f5fb11..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "themes/zola-bearblog"] - path = themes/zola-bearblog - url = https://codeberg.org/alanpearce/zola-bearblog diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..722fbf2e --- /dev/null +++ b/404.html @@ -0,0 +1,299 @@ + + + + + + 404 + + + + + + +
+ + +

+ Rust Embedded Working Group + Logo +

+
+ +
+ +

404

+

ʕノ•ᴥ•ʔノ ︵ ┻━┻

+ + + + + + diff --git a/_headers b/_headers new file mode 100644 index 00000000..cb39cfe3 --- /dev/null +++ b/_headers @@ -0,0 +1,13 @@ +# This _headers file is used to set headers on cloudflare pages: https://developers.cloudflare.com/pages/configuration/headers/ +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy (disabled everything except autoplay, local-fonts, screen-wake-lock, speaker-selection) +# opt out of Federated Learning of Cohorts (aka "FLoC") - https://amifloced.org/ +/* + X-Frame-Options: DENY + X-Content-Type-Options: nosniff + X-XSS-Protection: 1; mode=block + Referrer-Policy: strict-origin-when-cross-origin + Strict-Transport-Security: max-age=63072000; includeSubdomains + Permissions-Policy: interest-cohort=(), accelerometer=(), ambient-light-sensor=(), battery=(), bluetooth=(), browsing-topics=(), camera=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), identity-credentials-get=(), idle-detection=(), magnetometer=(), microphone=(), midi=(), otp-credentials=(), payment=(), picture-in-picture=(), publickey-credentials-create=(), publickey-credentials-get=(), serial=(), storage-access=(), sync-xhr=(), usb=(), web-share=(), window-management=(), xr-spatial-tracking=() + Content-Security-Policy: default-src 'none'; img-src 'self'; object-src 'none'; script-src 'none'; style-src 'sha256-PKsAyc2CAbvt1axikIx7gOr3bSn047az3mVPNOp94EA='; form-action 'none'; base-uri 'self'; frame-ancestors 'none' + Cross-Origin-Resource-Policy: same-site + Cache-Control: max-age=300, s-maxage=86400, stale-while-revalidate diff --git a/bookshelf/index.html b/bookshelf/index.html new file mode 100644 index 00000000..cfe7184f --- /dev/null +++ b/bookshelf/index.html @@ -0,0 +1,397 @@ + + + + + + Embedded Rust documentation | Rust Embedded Working Group + + + + + + +
+ + +

+ Rust Embedded Working Group + Logo +

+
+ +
+

Embedded Rust documentation

+
+ Table of contents + +
+
+

Welcome to an overview of the documentation provided by the embedded Working +Group. All of these projects are managed by the resources team.

+

Many of these resources take the form of "books"; we collectively call these +"The embedded Rust Bookshelf". Some are large, some are small.

+

All these resources assume that you have done some Rust programming before.

+

Learn about embedded development

+

If you are familiar with Rust but not with embedded development, this is the +spot for you! All of these resources assume that you have done some Rust +programming on the desktop, but that you have not done any embedded development +before.

+

The Discovery book

+

The Discovery book will teach you about microcontrollers, +peripherals, sensors and bare metal programming through a series of small, fun +projects that you'll develop in Rust.

+

Learn embedded Rust

+

If you are familiar with embedded development and familiar with Rust but have +not used Rust for embedded development then these resources are for you. All +these resources assume that you have done embedded development before, but not +in any specific language.

+

The embedded Rust book

+

Also known as "the book" by the embedded Rust community. The embedded Rust +book will get you up to speed with embedded Rust development and then +teach you how to effectively use the language (AKA patterns) to build more +correct embedded software.

+

Operating System development tutorials in Rust on the Raspberry Pi

+

Operating System development tutorials in Rust on the Raspberry Pi is a +tutorial series for hobby OS developers who are new to ARM's 64 bit ARMv8-A +architecture. The tutorials will give a guided, step-by-step tour of how to +write a monolithic Operating System kernel for an embedded system from +scratch. They cover implementation of common Operating Systems tasks, like +writing to the serial console, setting up virtual memory and handling hardware +exceptions. All while leveraging Rust's unique features to provide for safety +and speed.

+

Other Training Materials

+

The Awesome embedded Rust resource includes a list of other books, blogs, and +training materials for learning embedded Rust, including complete from-scratch +project examples and quickstart templates: Books, blogs and training materials.

+

Frequently Asked Questions

+

You can find our list of FAQ here.

+

Write embedded Rust

+

Once you have learned the basics these resources will make writing embedded +programs easier.

+ +

Master embedded Rust

+

Once you're quite familiar with embedded Rust development, you may find these +advanced resources useful.

+

The embedonomicon

+

For those that want to dive into the implementation of the foundational crates +of the embedded ecosystem. The embedonomicon will guide you through the abyss +of linker scripts, symbols and ABIs. You'll learn about linker script and the +language features that let you control the ABI of crates by creating a no_std +program for the ARM Cortex-M architecture from scratch.

+ +
+

+

+ + + + + + diff --git a/config.toml b/config.toml deleted file mode 100644 index 4199be44..00000000 --- a/config.toml +++ /dev/null @@ -1,80 +0,0 @@ -# The URL the site will be built for -base_url = "https://rust-embedded.org" - -title = "Rust Embedded Working Group" -description = """ -Rust Embedded Working Group -""" - - -# Whether to automatically compile all Sass files in the sass directory -compile_sass = false - -# Whether to build a search index to be used later on by a JavaScript library -build_search_index = false - -theme = "zola-bearblog" - -generate_feeds = false -feed_filenames = ["rss.xml"] - -# Whether to do syntax highlighting -[markdown] -highlight_code = true -highlight_theme = "dracula" - -taxonomies = [ - { name = "tags", feed = true }, -] - -default_language = "en" - -[translations] -no_posts = "No posts yet" -remove_filter = "Remove filter" -filtering_for = "Filtering for" -made_with = "Made with" -table_of_contents = "Table of contents" -language = "language" -site = "site" - -[extra] -# header_logo = "ewg-logo-blue-white-on-transparent-256x256.png" -header_logo = "ewg-logo-blue-white-on-transparent.svg" -date_format = "%Y-%m-%d" -hide_made_with_line = true -webserver_sends_csp_headers = true -language_switcher = true -translations = [ - { code = "en", name = "English" }, -] - -[extra.social] -github = "https://github.com/rust-embedded" -matrix = "https://matrix.to/#/#rust-embedded:matrix.org" -# bluesky = "url_to_bluesky_profile" -mastodon = "https://hachyderm.io/@rustembedded" - -[extra.table_of_contents] -show = true -max_level = 2 -visible_on_load = true - -[[extra.main_menu]] -name = "Home" -url = "@/_index.md" - -[[extra.main_menu]] -name = "Bookshelf" -url = "@/bookshelf.md" - -[[extra.main_menu]] -name = "Blog" -url = "https://blog.rust-embedded.org/" -new_tab = true - -[[extra.main_menu]] -name = "Showcase" -url = "http://showcase.rust-embedded.org/" -new_tab = true - diff --git a/content/_index.md b/content/_index.md deleted file mode 100644 index 3751e469..00000000 --- a/content/_index.md +++ /dev/null @@ -1,57 +0,0 @@ -+++ -+++ -# Rust on Embedded Devices Working Group - -We do Embedded Rust, defined broadly as Rust for resource-constrained environments and platforms where hardware-level work is critical. Our job is to work with the community to improve the embedded ecosystem, maintain and develop core crates used for Embedded Rust, and coordinate community communication. - -We try to make Rust embedded development easier and better end-to-end, from targeting a piece of hardware to providing higher-level APIs and application solutions. Embedded tooling and documentation are critical here, so we work on that as well. - -We are an [official working group][gov] of the Rust language. - -## Check out what's going on! - -- The [Embedded Rust Showcase][showcase] is a place to check out some of the amazing successes of embedded Rustaceans. The projects there demonstrate some of the best that Embedded Rust has to offer. -- Join our ongoing discussion on Matrix <[#rust-embedded:matrix.org][chat]>! We have a weekly open meeting there every Tuesday 2000 (8PM) CET (Berlin Time) — folks are welcome to come see what we are up to. -- Our meeting [agenda/minutes][agenda] is a series of Github Discussions pages documenting what we are doing. It's a great place to nominate an existing Github Issue or PR, or any other topic that you think would benefit from a synchronous discussion. -- Our curated list of [Awesome Embedded Rust][aer] resources is a grab-bag of great stuff. -- Our [REWG coordination repository][wg] is the place to go for "official" information: REWG structure and leadership, RFCs, meeting minutes, etc. - -## Learn Some Embedded Rust! - -- The [MB2 Discovery Book][discovery] is a complete walkthrough of Rust development for Embedded Rust beginners, targeted to a platform and filled with examples. -- The [Embedded Rust Book][book] is our entry point for developers experienced in Rust and embedded. -- The [Embedonomicon][embedonomicon] covers important "under the hood" topics for advanced Embedded Rust. An appendix provides instructions to vendors wishing to bring their targets into the Embedded Rust ecosystem. -- We have an entire ["bookshelf"](@/bookshelf.md) of embedded Rust documents. Some are a bit out of date, but we encourage you to check there for other things you might want to know. - - -## Want to help? - -Everyone can contribute to the Rust Embedded WG efforts! There are several ways to help out: - -- We offer a Github repo where you can file [REWG Issues][wg-issues]: let us know where the gaps are! If you think the language, the compiler, the tooling, the documentation or the crate ecosystem is lacking some feature, information or library to build embedded software, let us know. We'll bring it up to the Rust teams or help organize the community to build crates or tools to fill gaps. -- We encourage you to participate in our [RFC (Request For Comments)][rfc] process. We are always looking into ways to improve. This may involve things like changing how we run the WG or making major breaking changes in core crates. To ensure we are *actually* making things better we need your input! That's why all these changes are preceded by an "RFC", a discussion thread (which may or may not be backed by a proper RFC document) where we evaluate the pros and cons of a proposal and explore alternatives. Only after there's consensus on accepting the proposal is the proposal made effective. -- There's always a pile of [help-wanted issues][open-issues], but the WG members only have so much free time. You can help us fixing bugs, implementing features, writing tests, trying out examples and tutorials, writing documentation, fixing typos, etc. We can often mentor you through these tasks and review your work. In some cases you may not even need previous embedded experience or access to embedded hardware to help us out so don't let that discourage you from checking out our help-wanted issues. -- We have several teams focused on different areas: tooling, Cortex-M crates, etc. Each team maintains several projects (crates, docs and / or tools) that live under the REWG Github organization. You can help with these projects informally. You may subsequently be invited to join a team. - -## Our Vision - -- To improve the absolute quality (functionality, safety, performance) of embedded software in the wild. -- To improve the productivity of embedded software development teams, by reducing the tangible and intangible costs of achieving a level of quality. -- To improve the experience for programmers developing for embedded systems. -- To make embedded systems programming more accessible for people that are not already embedded systems developers. - -[aer]: https://github.com/rust-embedded/awesome-embedded-rust -[agenda]: https://github.com/rust-embedded/wg/discussions -[blog]: https://blog.rust-embedded.org/ -[book]: https://docs.rust-embedded.org/book -[chat]: https://matrix.to/#/#rust-embedded:matrix.org -[discovery]: https://docs.rust-embedded.org/discovery-mb2/ -[embedonomicon]: https://docs.rust-embedded.org/embedonomicon/ -[gov]: https://rust-lang.org/governance/teams/launching-pad/#team-wg-embedded -[joining]: https://github.com/rust-embedded/wg/blob/master/rfcs/0136-teams.md#adding-new-members -[newsletter]: https://rust-embedded.github.io/blog/ -[open-issues]: https://github.com/search?q=org%3Arust-embedded+is%3Aopen+label%3A%22help+wanted%22&type=Issues -[rfc]: https://github.com/search?q=org%3Arust-embedded+is%3Aopen+label%3Arfc&type=Issues -[showcase]: https://showcase.rust-embedded.org/ -[wg]: https://github.com/rust-embedded/wg -[wg-issues]: https://github.com/rust-embedded/wg/issues diff --git a/content/bookshelf.md b/content/bookshelf.md deleted file mode 100644 index ddd23926..00000000 --- a/content/bookshelf.md +++ /dev/null @@ -1,96 +0,0 @@ -+++ -title = "Embedded Rust documentation" -template = "page.html" -+++ - -Welcome to an overview of the documentation provided by the [embedded Working -Group][wg]. All of these projects are managed by [the resources team][team]. - -Many of these resources take the form of "books"; we collectively call these -"The embedded Rust Bookshelf". Some are large, some are small. - -[wg]: https://github.com/rust-embedded/wg -[team]: https://github.com/rust-embedded/wg#the-resources-team - -All these resources assume that you have done some Rust programming before. - -# Learn about embedded development - -If you are familiar with Rust but not with embedded development, this is the -spot for you! All of these resources assume that you have done some Rust -programming on the desktop, but that you have not done any embedded development -before. - -## The Discovery book - -[The Discovery book][discovery] will teach you about microcontrollers, -peripherals, sensors and bare metal programming through a series of small, fun -projects that you'll develop in Rust. - -[discovery]: https://docs.rust-embedded.org/discovery/index.html - -# Learn embedded Rust - -If you are familiar with embedded development and familiar with Rust but have -not used Rust for embedded development then these resources are for you. All -these resources assume that you have done embedded development before, but not -in any specific language. - -## The embedded Rust book - -Also known as "the book" by the embedded Rust community. [The embedded Rust -book][book] will get you up to speed with embedded Rust development and then -teach you how to effectively use the language (AKA patterns) to build more -correct embedded software. - -[book]: https://docs.rust-embedded.org/book/index.html - -## Operating System development tutorials in Rust on the Raspberry Pi - -[Operating System development tutorials in Rust on the Raspberry Pi] is a -tutorial series for hobby OS developers who are new to ARM's 64 bit ARMv8-A -architecture. The tutorials will give a guided, step-by-step tour of how to -write a monolithic Operating System kernel for an embedded system from -scratch. They cover implementation of common Operating Systems tasks, like -writing to the serial console, setting up virtual memory and handling hardware -exceptions. All while leveraging Rust's unique features to provide for safety -and speed. - -[Operating System development tutorials in Rust on the Raspberry Pi]: https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials - -## Other Training Materials - -The [Awesome embedded Rust] resource includes a list of other books, blogs, and -training materials for learning embedded Rust, including complete from-scratch -project examples and quickstart templates: [Books, blogs and training materials]. - -[Books, blogs and training materials]: https://github.com/rust-embedded/awesome-embedded-rust#books-blogs-and-training-materials - -## Frequently Asked Questions - -You can find our list of FAQ [here](@/faq.md). - -# Write embedded Rust - -Once you have learned the basics these resources will make writing embedded -programs easier. - -- [Awesome embedded Rust], a curated list of embedded and no-std crates. - -[Awesome embedded Rust]: https://github.com/rust-embedded/awesome-embedded-rust - -# Master embedded Rust - -Once you're quite familiar with embedded Rust development, you may find these -advanced resources useful. - -## The embedonomicon - -For those that want to dive into the implementation of the foundational crates -of the embedded ecosystem. [The embedonomicon] will guide you through the abyss -of linker scripts, symbols and ABIs. You'll learn about linker script and the -language features that let you control the ABI of crates by creating a `no_std` -program for the ARM Cortex-M architecture from scratch. - -[The embedonomicon]: https://docs.rust-embedded.org/embedonomicon/index.html - diff --git a/content/faq.md b/content/faq.md deleted file mode 100644 index 2ffd6ab6..00000000 --- a/content/faq.md +++ /dev/null @@ -1,326 +0,0 @@ -+++ -title = "Frequently Asked Questions" -+++ - -# Does Rust support my device? - -## Short answer - -As of 2018-09-18 the Rust compiler supports cross compiling to these embedded -architectures (see `rustup target list`): - -- ARM Cortex-M (since 1.27) - - `thumbv6m-none-eabi`, Cortex-M0 - - `thumbv7m-none-eabi`, Cortex-M3 - - `thumbv7em-none-eabi`, Cortex-M4 and Cortex-M7 - - `thumbv7em-none-eabihf`, Cortex-M4F and Cortex-M7F -- ARM Cortex-R (1.30-beta) - - `armebv7r-none-eabi`, big endian Cortex-R4 and Cortex-R5 - - `armebv7r-none-eabihf`, big endian Cortex-R4F and Cortex-R5F - - `armv7r-none-eabi`, little endian Cortex-R4 and Cortex-R5 - - `armv7r-none-eabihf`, little endian Cortex-R4F and Cortex-R5F -- ARM Linux - - ARMv5TE (e.g. ARM926EJ-S), - - ARMv6 (e.g. ARM11 as found in the Raspberry Pi 1 / Zero), - - ARMv7-A (e.g. Cortex-A8 as found in the Beaglebones), - - and ARMv8 (e.g. Cortex-A53 as found in the ODROID-C2) ... - - ... in GNU and MUSL flavors and in soft float and hard float variants; - - notably, support for ARMv4T (e.g. ARM7) and older versions is missing. -- RISCV (1.30-beta) - - `riscv32imac-unknown-none-elf`, RV32I base instruction set with M, A and C - extensions - - `riscv32imc-unknown-none-elf`, RV32I base instruction set with M, and C - extensions - -`rustc` also supports code generation for the MSP430 architecture (see `rustc ---print target-list`). - -In general, ARM Cortex-M and ARM Linux have the most mature ecosystems whereas -the ARM Cortex-R, MSP430 and RISCV ecosystems are in early stages or not as -mature. - -For specific device support check [awesome-embedded-rust]. - -[awesome-embedded-rust]: https://github.com/rust-embedded/awesome-embedded-rust - -## Long answer - -We can talk about support at different levels: does the compiler support my -device? does the crate ecosystem support my device? - -Let's start with compiler support. The compiler supports architectures or ISA -(Instruction Set Architectures) rather than specific devices. Compiler support -can be further divided in two levels: compilation target support and -architecture support. - -### Compilation target support - -By compilation target support we mean that you can readily cross compile a crate -for a certain *compilation target* using Cargo. To keep the default installation -slim only the native compilation target is installed and other targets have to -be installed using the `rustup target` subcommand. If `rustup target list` lists -a compilation target that matches your device then Cargo supports cross -compiling to your device. - -For example, let's say we want to know if `rustc` supports cross compiling to -32-bit RISCV. We check `rustup target list` - -``` bash -$ rustup default 1.29.0 -$ rustup target list | grep -i riscv || echo not supported -not supported - -$ rustup default nightly-2018-09-18 # this date is just an example -$ rustc -V -rustc 1.30.0-nightly (2224a42c3 2018-09-17) -$ rustup target list | grep -i riscv || echo not supported -riscv32imac-unknown-none-elf -riscv32imc-unknown-none-elf -``` - -This indicates that 1.29 doesn't support 32-bit RISCV but that 1.30 will. - -Once you have installed a compilation target using `rustup target add $T` you'll -be able to cross compile crates to it using `cargo build --target $T`. - -``` bash -$ rustup target add riscv32imac-unknown-none-elf -$ cargo build --target riscv32imac-unknown-none-elf -``` - -### Architecture support - -If your device doesn't appear in `rustup target list` that doesn't mean that -`rustc` doesn't support your device at all. It could still support code -generation for your device *architecture*. `rustc` uses LLVM to generate machine -code; if the LLVM backend for your device architecture is enabled in `rustc` -then `rustc` can produce assembly and/or object files for that architecture. - -The easiest way to list the architectures that LLVM supports is to run -`cargo objdump -- -version` where `cargo-objdump` is one of [`cargo-binutils`] -subcommands. - -[`cargo-binutils`]: https://github.com/rust-embedded/cargo-binutils - -``` bash -$ rustup default nightly-2018-09-18 # this date is just an example -$ rustup component add llvm-tools -$ cargo install cargo-binutils - -$ cargo objdump -- -version -LLVM (http://llvm.org/): - LLVM version 8.0.0svn - Optimized build. - Default target: x86_64-unknown-linux-gnu - Host CPU: skylake - - Registered Targets: - aarch64 - AArch64 (little endian) - aarch64_be - AArch64 (big endian) - arm - ARM - arm64 - ARM64 (little endian) - armeb - ARM (big endian) - hexagon - Hexagon - mips - Mips - mips64 - Mips64 [experimental] - mips64el - Mips64el [experimental] - mipsel - Mipsel - msp430 - MSP430 [experimental] - nvptx - NVIDIA PTX 32-bit - nvptx64 - NVIDIA PTX 64-bit - ppc32 - PowerPC 32 - ppc64 - PowerPC 64 - ppc64le - PowerPC 64 LE - riscv32 - 32-bit RISC-V - riscv64 - 64-bit RISC-V - sparc - Sparc - sparcel - Sparc LE - sparcv9 - Sparc V9 - systemz - SystemZ - thumb - Thumb - thumbeb - Thumb (big endian) - wasm32 - WebAssembly 32-bit - wasm64 - WebAssembly 64-bit - x86 - 32-bit X86: Pentium-Pro and above - x86-64 - 64-bit X86: EM64T and AMD64 -``` - -If your device architecture is not there that means `rustc` doesn't support your -device. It could be that LLVM doesn't support the architecture (e.g. Xtensa, -ESP8266's architecture) or that LLVM's support for the architecture is not -considered stable enough and has not been enabled in `rustc` (e.g. AVR, the -architecture most commonly found in Arduino microcontrollers). - -If your device architecture is there then that means that, in principle, `rustc` -supports your device. However, an architecture like ARM can be very broad -covering several ISAs and extensions. Instead, you'll want to work with a -compilation target tailored to your device. Custom compilation targets are out -of scope for this document; you should refer to the [embedonomicon] for more -information. - -[embedonomicon]: https://rust-embedded.github.io/embedonomicon/compiler-support.html - -### Crate ecosystem support - -Crate ecosystem support can range from generic support for the architecture to -device-specific support. We recommend that you search on crates.io for the -architecture (e.g. ARM or Cortex-M), for the microcontroller vendor (e.g. -STM32), for the target device (e.g. STM32F103) and the target development board -(e.g. STM32F3DISCOVERY). We also suggest that you check the -[awesome-embedded-rust] list and [the crates maintained by the embedded Working -Group][wg-crates]. - -[wg-crates]: https://github.com/rust-embedded/wg#organization - -# (When) will Rust support the AVR architecture? - -As of 2020-07-24 the support for AVR have been merged into the nightly version of -the official Rust compiler, `rustc`. See the RFC for merging the [avr-rust fork]. - -[avr-rust fork]: https://github.com/rust-lang/rust/issues/44052#issuecomment-663394401]. - -# (When) will Rust support the Xtensa architecture? - -As of 2020-08-24 the official Rust compiler, `rustc`, relies on LLVM for -generating machine code. It's a requirement that LLVM supports an architecture -for `rustc` to support it. - -There is no support for the Xtensa architecture in LLVM proper. You may be able -to find several forks of LLVM with varying levels of support for the Xtensa -architecture but `rustc` will not be able to use any of those forks due to the -maintenance and infrastructure costs of developing `rustc` against different -versions of LLVM. - -TL;DR `rustc` will support the Xtensa architecture when the official LLVM gains -support for the Xtensa architecture. As LLVM is a project independent of the -Rust project we can't give you any estimate on when that might happen. A list of -submitted patches can be found on this [LLVM dashboard][llvm-xtensa-tracker]. - -[llvm-xtensa-tracker]: https://reviews.llvm.org/W486 - -# My embedded Rust program is too big! - -We sometimes get questions like this one: "My Rust program is 500 KB but my -microcontroller only has 16 KB of Flash; how can I make it fit?". - -The first thing to confirm is that correctly measuring the size of your program. -`rustc` produces ELF files for most embedded targets. ELF files have metadata -and contain debug information so measuring their size on disk with e.g. `ls -l` -will give you the wrong number. - -``` bash -$ # 500 KB? -$ ls -hl target/thumbv7m-none-eabi/debug/app --rwxr-xr-x 2 japaric japaric 554K Sep 19 13:37 target/thumbv7m-none-eabi/debug/app -``` - -The correct way to measure the size of an embedded program is to use the `size` -program or the [`cargo size`] subcommand. - -[`cargo size`]: https://github.com/rust-embedded/cargo-binutils - -``` bash -$ # ~ 2 KB of Flash -$ cargo size --bin app -- -A - Finished dev [unoptimized + debuginfo] target(s) in 0.01s -app : -section size addr -.vector_table 1024 0x8000000 -.text 776 0x8000400 -.rodata 208 0x8000708 -.data 0 0x20000000 -.bss 0 0x20000000 -.debug_str 145354 0x0 -.debug_abbrev 11264 0x0 -.debug_info 139259 0x0 -.debug_macinfo 33 0x0 -.debug_pubnames 40901 0x0 -.debug_pubtypes 14326 0x0 -.ARM.attributes 50 0x0 -.debug_frame 21224 0x0 -.debug_line 117666 0x0 -.debug_ranges 63800 0x0 -.comment 75 0x0 -Total 555960 -``` - -Of the standard sections, `.vector_table`, `.text`, `.rodata` and `.data` will -occupy Flash / ROM; `.bss` and `.data` will occupy RAM; `.debug_*`, -`.ARM.attributes` and `.comments` can be ignored as they won't be loaded into -the target device memory. (`.data` is initially placed in -Flash / ROM, but copied to RAM during startup to make it writable.) For the other sections you'll have to check your -dependencies' docs. - -In this example the uploaded software will occupy `2008` bytes of Flash. - -Note that most (all?) runtime crates, like `cortex-m-rt`, will check at link -time that the program fits in the target device memory. If it doesn't fit you'll -get a linker error and no output binary. So, provided that you correctly entered -the size of the memory regions of your device then if it links it should fit in -the target device! - -If you are measuring size using the right method and your program is still too -big then check out our section on optimizations. - -> **TODO**(resources team) add link to the optimizations section - -# I'm trying to follow the book but my program won't flash - -It is quite common that by oversight the linker configuration is not suitable -for the target device. Indications for such a problem are loading errors in `gdb`: - -``` -(gdb) load -Loading section .vector_table, size 0x400 lma 0x0 -Loading section .text, size 0x2064 lma 0x400 -Load failed -``` - -Please note the `lma` which is the loading address and needs to match up with the -start address of the flash. - -Similarly `openocd` will indicate such a problem: - -``` -... -auto erase enabled -Info : device id = 0x10036422 -Info : flash size = 256kbytes -Warn : no flash bank found for address 0 -wrote 0 bytes from file target/thumbv7em-none-eabihf/debug/examples/hello in 0.001434s (0.000 KiB/s) -``` - -If you see such a message you will need to check your linker configuration, usually in -`memory.x` for the correct addresses (and ideally also sizes). Please also note that -after a change you will need to `cargo clean` and rebuild to use the changed addresses. - -# My program just halts without connected debugger. What am I doing wrong? - -## Short answer - -If you're using `semihosting`, switch to a different input / output mechanism. - -## Long answer - -An embedded MCU will typically stop working if exceptions (which is the MCUs way -of signalling special or abnormal events) occur which are not handled and cleared, -either by an exception handler or a connected debugger. The latter case is especially -interesting because there's a method of interacting with a connected computer -dubbed `semihosting` which will work iff a debugger is properly connected -and debugging software running and correctly set up. This method uses special -processor instructions (e.g. a service or breakpoint call) to alert the connected -system about input and/or output requests from the device. If no debugger is -available to handle such a situation, the system either wait indefinitely or -generate an even stronger exception which can only be cleared by a reset. - -There're two common scenarios which cause such a lockup unintentionally: -- The use of semihosting as input / output channel, e.g. via `cortex-m-semihosting` crate -- A `panic` in the program with the `panic-semihosting` crate in use, however the - occurence of a `panic` means that the program is defunct anyway - -Please note that examples may make use of the `semihosting` concept but this -should not be used in production setups due to the lack of connected debugger and -a host running appropriate debugging software. The use of a serial interface is -often a better choice. However if you just would like to see your example running -please make sure your setup is ready to deal with the `semihosting` requirements. - diff --git a/static/ewg-logo-blue-white-on-transparent-256x256.png b/ewg-logo-blue-white-on-transparent-256x256.png similarity index 100% rename from static/ewg-logo-blue-white-on-transparent-256x256.png rename to ewg-logo-blue-white-on-transparent-256x256.png diff --git a/static/ewg-logo-blue-white-on-transparent.svg b/ewg-logo-blue-white-on-transparent.svg similarity index 100% rename from static/ewg-logo-blue-white-on-transparent.svg rename to ewg-logo-blue-white-on-transparent.svg diff --git a/faq/index.html b/faq/index.html new file mode 100644 index 00000000..ebe272e4 --- /dev/null +++ b/faq/index.html @@ -0,0 +1,603 @@ + + + + + + Frequently Asked Questions | Rust Embedded Working Group + + + + + + +
+ + +

+ Rust Embedded Working Group + Logo +

+
+ +
+

Frequently Asked Questions

+
+ Table of contents + +
+
+

Does Rust support my device?

+

Short answer

+

As of 2018-09-18 the Rust compiler supports cross compiling to these embedded +architectures (see rustup target list):

+ +

rustc also supports code generation for the MSP430 architecture (see rustc --print target-list).

+

In general, ARM Cortex-M and ARM Linux have the most mature ecosystems whereas +the ARM Cortex-R, MSP430 and RISCV ecosystems are in early stages or not as +mature.

+

For specific device support check awesome-embedded-rust.

+

Long answer

+

We can talk about support at different levels: does the compiler support my +device? does the crate ecosystem support my device?

+

Let's start with compiler support. The compiler supports architectures or ISA +(Instruction Set Architectures) rather than specific devices. Compiler support +can be further divided in two levels: compilation target support and +architecture support.

+

Compilation target support

+

By compilation target support we mean that you can readily cross compile a crate +for a certain compilation target using Cargo. To keep the default installation +slim only the native compilation target is installed and other targets have to +be installed using the rustup target subcommand. If rustup target list lists +a compilation target that matches your device then Cargo supports cross +compiling to your device.

+

For example, let's say we want to know if rustc supports cross compiling to +32-bit RISCV. We check rustup target list

+
$ rustup default 1.29.0
+$ rustup target list | grep -i riscv || echo not supported
+not supported
+
+$ rustup default nightly-2018-09-18 # this date is just an example
+$ rustc -V
+rustc 1.30.0-nightly (2224a42c3 2018-09-17)
+$ rustup target list | grep -i riscv || echo not supported
+riscv32imac-unknown-none-elf
+riscv32imc-unknown-none-elf
+
+

This indicates that 1.29 doesn't support 32-bit RISCV but that 1.30 will.

+

Once you have installed a compilation target using rustup target add $T you'll +be able to cross compile crates to it using cargo build --target $T.

+
$ rustup target add riscv32imac-unknown-none-elf
+$ cargo build --target riscv32imac-unknown-none-elf
+
+

Architecture support

+

If your device doesn't appear in rustup target list that doesn't mean that +rustc doesn't support your device at all. It could still support code +generation for your device architecture. rustc uses LLVM to generate machine +code; if the LLVM backend for your device architecture is enabled in rustc +then rustc can produce assembly and/or object files for that architecture.

+

The easiest way to list the architectures that LLVM supports is to run +cargo objdump -- -version where cargo-objdump is one of cargo-binutils +subcommands.

+
$ rustup default nightly-2018-09-18 # this date is just an example
+$ rustup component add llvm-tools
+$ cargo install cargo-binutils
+
+$ cargo objdump -- -version
+LLVM (http://llvm.org/):
+  LLVM version 8.0.0svn
+  Optimized build.
+  Default target: x86_64-unknown-linux-gnu
+  Host CPU: skylake
+
+  Registered Targets:
+    aarch64    - AArch64 (little endian)
+    aarch64_be - AArch64 (big endian)
+    arm        - ARM
+    arm64      - ARM64 (little endian)
+    armeb      - ARM (big endian)
+    hexagon    - Hexagon
+    mips       - Mips
+    mips64     - Mips64 [experimental]
+    mips64el   - Mips64el [experimental]
+    mipsel     - Mipsel
+    msp430     - MSP430 [experimental]
+    nvptx      - NVIDIA PTX 32-bit
+    nvptx64    - NVIDIA PTX 64-bit
+    ppc32      - PowerPC 32
+    ppc64      - PowerPC 64
+    ppc64le    - PowerPC 64 LE
+    riscv32    - 32-bit RISC-V
+    riscv64    - 64-bit RISC-V
+    sparc      - Sparc
+    sparcel    - Sparc LE
+    sparcv9    - Sparc V9
+    systemz    - SystemZ
+    thumb      - Thumb
+    thumbeb    - Thumb (big endian)
+    wasm32     - WebAssembly 32-bit
+    wasm64     - WebAssembly 64-bit
+    x86        - 32-bit X86: Pentium-Pro and above
+    x86-64     - 64-bit X86: EM64T and AMD64
+
+

If your device architecture is not there that means rustc doesn't support your +device. It could be that LLVM doesn't support the architecture (e.g. Xtensa, +ESP8266's architecture) or that LLVM's support for the architecture is not +considered stable enough and has not been enabled in rustc (e.g. AVR, the +architecture most commonly found in Arduino microcontrollers).

+

If your device architecture is there then that means that, in principle, rustc +supports your device. However, an architecture like ARM can be very broad +covering several ISAs and extensions. Instead, you'll want to work with a +compilation target tailored to your device. Custom compilation targets are out +of scope for this document; you should refer to the embedonomicon for more +information.

+

Crate ecosystem support

+

Crate ecosystem support can range from generic support for the architecture to +device-specific support. We recommend that you search on crates.io for the +architecture (e.g. ARM or Cortex-M), for the microcontroller vendor (e.g. +STM32), for the target device (e.g. STM32F103) and the target development board +(e.g. STM32F3DISCOVERY). We also suggest that you check the +awesome-embedded-rust list and the crates maintained by the embedded Working +Group.

+

(When) will Rust support the AVR architecture?

+

As of 2020-07-24 the support for AVR have been merged into the nightly version of +the official Rust compiler, rustc. See the RFC for merging the avr-rust fork.

+

(When) will Rust support the Xtensa architecture?

+

As of 2020-08-24 the official Rust compiler, rustc, relies on LLVM for +generating machine code. It's a requirement that LLVM supports an architecture +for rustc to support it.

+

There is no support for the Xtensa architecture in LLVM proper. You may be able +to find several forks of LLVM with varying levels of support for the Xtensa +architecture but rustc will not be able to use any of those forks due to the +maintenance and infrastructure costs of developing rustc against different +versions of LLVM.

+

TL;DR rustc will support the Xtensa architecture when the official LLVM gains +support for the Xtensa architecture. As LLVM is a project independent of the +Rust project we can't give you any estimate on when that might happen. A list of +submitted patches can be found on this LLVM dashboard.

+

My embedded Rust program is too big!

+

We sometimes get questions like this one: "My Rust program is 500 KB but my +microcontroller only has 16 KB of Flash; how can I make it fit?".

+

The first thing to confirm is that correctly measuring the size of your program. +rustc produces ELF files for most embedded targets. ELF files have metadata +and contain debug information so measuring their size on disk with e.g. ls -l +will give you the wrong number.

+
$ # 500 KB?
+$ ls -hl target/thumbv7m-none-eabi/debug/app
+-rwxr-xr-x 2 japaric japaric 554K Sep 19 13:37 target/thumbv7m-none-eabi/debug/app
+
+

The correct way to measure the size of an embedded program is to use the size +program or the cargo size subcommand.

+
$ # ~ 2 KB of Flash
+$ cargo size --bin app -- -A
+    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
+app  :
+section               size        addr
+.vector_table         1024   0x8000000
+.text                  776   0x8000400
+.rodata                208   0x8000708
+.data                    0  0x20000000
+.bss                     0  0x20000000
+.debug_str          145354         0x0
+.debug_abbrev        11264         0x0
+.debug_info         139259         0x0
+.debug_macinfo          33         0x0
+.debug_pubnames      40901         0x0
+.debug_pubtypes      14326         0x0
+.ARM.attributes         50         0x0
+.debug_frame         21224         0x0
+.debug_line         117666         0x0
+.debug_ranges        63800         0x0
+.comment                75         0x0
+Total               555960
+
+

Of the standard sections, .vector_table, .text, .rodata and .data will +occupy Flash / ROM; .bss and .data will occupy RAM; .debug_*, +.ARM.attributes and .comments can be ignored as they won't be loaded into +the target device memory. (.data is initially placed in +Flash / ROM, but copied to RAM during startup to make it writable.) For the other sections you'll have to check your +dependencies' docs.

+

In this example the uploaded software will occupy 2008 bytes of Flash.

+

Note that most (all?) runtime crates, like cortex-m-rt, will check at link +time that the program fits in the target device memory. If it doesn't fit you'll +get a linker error and no output binary. So, provided that you correctly entered +the size of the memory regions of your device then if it links it should fit in +the target device!

+

If you are measuring size using the right method and your program is still too +big then check out our section on optimizations.

+
+

TODO(resources team) add link to the optimizations section

+
+

I'm trying to follow the book but my program won't flash

+

It is quite common that by oversight the linker configuration is not suitable +for the target device. Indications for such a problem are loading errors in gdb:

+
(gdb) load
+Loading section .vector_table, size 0x400 lma 0x0
+Loading section .text, size 0x2064 lma 0x400
+Load failed
+
+

Please note the lma which is the loading address and needs to match up with the +start address of the flash.

+

Similarly openocd will indicate such a problem:

+
...
+auto erase enabled
+Info : device id = 0x10036422
+Info : flash size = 256kbytes
+Warn : no flash bank found for address 0
+wrote 0 bytes from file target/thumbv7em-none-eabihf/debug/examples/hello in 0.001434s (0.000 KiB/s)
+
+

If you see such a message you will need to check your linker configuration, usually in +memory.x for the correct addresses (and ideally also sizes). Please also note that +after a change you will need to cargo clean and rebuild to use the changed addresses.

+

My program just halts without connected debugger. What am I doing wrong?

+

Short answer

+

If you're using semihosting, switch to a different input / output mechanism.

+

Long answer

+

An embedded MCU will typically stop working if exceptions (which is the MCUs way +of signalling special or abnormal events) occur which are not handled and cleared, +either by an exception handler or a connected debugger. The latter case is especially +interesting because there's a method of interacting with a connected computer +dubbed semihosting which will work iff a debugger is properly connected +and debugging software running and correctly set up. This method uses special +processor instructions (e.g. a service or breakpoint call) to alert the connected +system about input and/or output requests from the device. If no debugger is +available to handle such a situation, the system either wait indefinitely or +generate an even stronger exception which can only be cleared by a reset.

+

There're two common scenarios which cause such a lockup unintentionally:

+ +

Please note that examples may make use of the semihosting concept but this +should not be used in production setups due to the lack of connected debugger and +a host running appropriate debugging software. The use of a serial interface is +often a better choice. However if you just would like to see your example running +please make sure your setup is ready to deal with the semihosting requirements.

+ +
+

+

+ + + + + + diff --git a/static/fonts/fira_sans/FiraSans-Bold.woff2 b/fonts/fira_sans/FiraSans-Bold.woff2 similarity index 100% rename from static/fonts/fira_sans/FiraSans-Bold.woff2 rename to fonts/fira_sans/FiraSans-Bold.woff2 diff --git a/static/fonts/fira_sans/FiraSans-Regular.woff2 b/fonts/fira_sans/FiraSans-Regular.woff2 similarity index 100% rename from static/fonts/fira_sans/FiraSans-Regular.woff2 rename to fonts/fira_sans/FiraSans-Regular.woff2 diff --git a/index.html b/index.html new file mode 100644 index 00000000..cac62ac5 --- /dev/null +++ b/index.html @@ -0,0 +1,334 @@ + + + + + + Rust Embedded Working Group + + + + + + +
+ + +

+ Rust Embedded Working Group + Logo +

+
+ +
+ +
+

Rust on Embedded Devices Working Group

+

We do Embedded Rust, defined broadly as Rust for resource-constrained environments and platforms where hardware-level work is critical. Our job is to work with the community to improve the embedded ecosystem, maintain and develop core crates used for Embedded Rust, and coordinate community communication.

+

We try to make Rust embedded development easier and better end-to-end, from targeting a piece of hardware to providing higher-level APIs and application solutions. Embedded tooling and documentation are critical here, so we work on that as well.

+

We are an official working group of the Rust language.

+

Check out what's going on!

+ +

Learn Some Embedded Rust!

+ +

Want to help?

+

Everyone can contribute to the Rust Embedded WG efforts! There are several ways to help out:

+ +

Our Vision

+ + +
+ + + + + + diff --git a/robots.txt b/robots.txt new file mode 100644 index 00000000..8c4cf81c --- /dev/null +++ b/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: +Allow: / +Sitemap: https://rust-embedded.org/sitemap.xml diff --git a/static/screenshot-cortex-a.png b/screenshot-cortex-a.png similarity index 100% rename from static/screenshot-cortex-a.png rename to screenshot-cortex-a.png diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 00000000..12306ec0 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,12 @@ + + + + https://rust-embedded.org/ + + + https://rust-embedded.org/bookshelf/ + + + https://rust-embedded.org/faq/ + + diff --git a/templates/footer.html b/templates/footer.html deleted file mode 100644 index 937f2384..00000000 --- a/templates/footer.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - diff --git a/templates/header.html b/templates/header.html deleted file mode 100644 index 9676f025..00000000 --- a/templates/header.html +++ /dev/null @@ -1,16 +0,0 @@ -
- - - {%- if config.extra.header_logo %} -

- {{ config.title }} - Logo -

- {%- else %} -

{{ config.title }}

- {%- endif %} -
- -
diff --git a/templates/nav.html b/templates/nav.html deleted file mode 100644 index 62a5f850..00000000 --- a/templates/nav.html +++ /dev/null @@ -1,25 +0,0 @@ -{%- set current_lang = config.default_language %} -{%- if page %} - {%- set current_lang = page.lang %} -{%- elif section %} - {%- set current_lang = section.lang %} -{%- endif %} -{%- if config.extra.main_menu %} - {%- for item in config.extra.main_menu %} - {%- if current_lang == config.default_language %} - {%- set title = item.name %} - {%- else %} - {%- set language_key = 'name_' ~ current_lang %} - {%- set title = item[language_key] %} - {%- endif %} - {%- if item.url is matching("https?://") %} - {%- if item.new_tab == true %} - {{ title }} - {%- else %} - {{ title }} - {%- endif %} - {%- else %} - {{ title }} - {%- endif %} - {%- endfor %} -{%- endif -%} diff --git a/templates/section.html b/templates/section.html deleted file mode 100644 index 53704821..00000000 --- a/templates/section.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "base.html" %} - -{%- block main -%} -
- {%- if taxonomy.term %} -

{{ trans(key="filtering_for",lang=lang)}} "{{ section.title }}"

- - {{ trans(key="remove_filter", lang=lang) }} - - {%- endif %} - - {%- if taxonomy.term %} -
- {%- set taxonomy_group = section.extra.taxonomy_group | default(value="tags") %} - {%- set tags = get_taxonomy(kind=taxonomy_group, lang=lang) %} - {%- for post in tags.items %} - #{{ post.name }}  - {%- endfor %} -
- {%- endif %} -
-{% endblock %} diff --git a/templates/style.css.html b/templates/style.css.html deleted file mode 100644 index cb190b55..00000000 --- a/templates/style.css.html +++ /dev/null @@ -1,206 +0,0 @@ -@font-face { - font-family: "FiraSans"; - src: url("{{ get_url(path="fonts/fira_sans/FiraSans-Regular.woff2", trailing_slash=false) }}") format("woff2"); - font-weight: 400; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: "FiraSans"; - src: url("{{ get_url(path="fonts/fira_sans/FiraSans-Bold.woff2", trailing_slash=false) }}") format("woff2"); - font-weight: 700; - font-style: normal; - font-display: swap; -} - -:root { - --width: 800px; - --font-main: "FiraSans", Helvetica, Arial, sans-serif; - --font-secondary: "FiraSans", Helvetica, Arial, sans-serif; - --font-scale: 1em; - --background-color: #fff; - --heading-color: #202020; - --text-color: #000000; - --link-color: #1a78c0; - --visited-color: #1a78c0; - --blockquote-color: #222; -} - -@media (prefers-color-scheme: dark) { - :root { - --background-color: #202020; - --heading-color: #EEEEEE; - --text-color: #FFFFFF; - --link-color: #6ACFF6; - --visited-color: #6ACFF6; - --blockquote-color: #ccc; - } -} - -body { - font-family: var(--font-secondary); - font-size: var(--font-scale); - margin: auto; - padding: 20px; - max-width: var(--width); - text-align: left; - background-color: var(--background-color); - word-wrap: break-word; - overflow-wrap: break-word; - line-height: 1.5; - color: var(--text-color); -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-family: var(--font-main); - color: var(--heading-color); -} - -a { - color: var(--link-color); - cursor: pointer; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -nav a { - margin-right: 8px; -} - -nav span.active { - font-weight: bold; - margin-right: 10px; -} -strong, -b { - color: var(--heading-color); -} - -button { - margin: 0; - cursor: pointer; -} - -main { - line-height: 1.6; -} - -table { - width: 100%; -} - -hr { - border: 0; - border-top: 1px dashed; -} - -img { - max-width: 100%; -} - -pre code { - background-color: var(--code-background-color); - color: var(--code-color); - display: block; - padding: 20px; - white-space: pre-wrap; - font-size: 0.875rem; - overflow-x: auto; -} - -code { - font-family: monospace; - padding: 2px; - background-color: var(--code-background-color); - color: var(--code-color); - border-radius: 3px; -} - -blockquote { - border-left: 1px solid #999; - color: var(--code-color); - padding-left: 20px; - font-style: italic; -} - -footer { - padding: 25px 0; - text-align: center; -} - -.title:hover { - text-decoration: none; -} - -.title h1 { - font-size: 1.5em; -} - -.inline { - width: auto !important; -} - -.highlight, -.code { - padding: 1px 15px; - background-color: var(--code-background-color); - color: var(--code-color); - border-radius: 3px; - margin-block-start: 1em; - margin-block-end: 1em; - overflow-x: auto; -} - -/* blog post list */ -ul.blog-posts { - list-style-type: none; - padding: unset; -} - -ul.blog-posts li { - display: flex; -} - -ul.blog-posts li span { - flex: 0 0 130px; -} - -ul.blog-posts li a:visited { - color: var(--visited-color); -} - -.icon { - width: 1.5em; - height: 1.5em; - vertical-align: middle; - color: var(--text-color); -} - -.tags { - font-size: smaller; -} - -.footnote-definition { - display: flex; - margin-top: 1em; -} -.footnote-definition-label { - margin-left: 1rem; - margin-right: 0.5rem; - vertical-align: baseline; -} -.footnote-definition-label::after { - content: "." -} -.footnote-definition > p { - margin: 0; -} diff --git a/themes/zola-bearblog b/themes/zola-bearblog deleted file mode 160000 index 9ed15e4c..00000000 --- a/themes/zola-bearblog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ed15e4cad7b745625c9b7d56300066ba1725850