Skip to content

Commit 8b6343d

Browse files
committed
deploy: a8a16ac
0 parents  commit 8b6343d

218 files changed

Lines changed: 36147 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file makes sure that Github Pages doesn't process mdBook's output.

01-background/index.html

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.

02-requirements/index.html

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en" class="light sidebar-visible" dir="ltr">
3+
<head>
4+
<!-- Book generated using mdBook -->
5+
<meta charset="UTF-8">
6+
<title>Hardware/knowledge requirements - Rust Embedded MB2 Discovery Book</title>
7+
8+
9+
<!-- Custom HTML head -->
10+
11+
<meta name="description" content="Discover the world of microcontrollers through Rust with the BB2 micro:bit v2">
12+
<meta name="viewport" content="width=device-width, initial-scale=1">
13+
<meta name="theme-color" content="#ffffff">
14+
15+
<link rel="icon" href="../favicon.svg">
16+
<link rel="shortcut icon" href="../favicon.png">
17+
<link rel="stylesheet" href="../css/variables.css">
18+
<link rel="stylesheet" href="../css/general.css">
19+
<link rel="stylesheet" href="../css/chrome.css">
20+
<link rel="stylesheet" href="../css/print.css" media="print">
21+
22+
<!-- Fonts -->
23+
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
24+
<link rel="stylesheet" href="../fonts/fonts.css">
25+
26+
<!-- Highlight.js Stylesheets -->
27+
<link rel="stylesheet" id="highlight-css" href="../highlight.css">
28+
<link rel="stylesheet" id="tomorrow-night-css" href="../tomorrow-night.css">
29+
<link rel="stylesheet" id="ayu-highlight-css" href="../ayu-highlight.css">
30+
31+
<!-- Custom theme stylesheets -->
32+
33+
34+
<!-- Provide site root and default themes to javascript -->
35+
<script>
36+
const path_to_root = "../";
37+
const default_light_theme = "light";
38+
const default_dark_theme = "navy";
39+
</script>
40+
<!-- Start loading toc.js asap -->
41+
<script src="../toc.js"></script>
42+
</head>
43+
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
55+
<div id="body-container">
56+
<!-- Work around some values being stored in localStorage wrapped in quotes -->
57+
<script>
58+
try {
59+
let theme = localStorage.getItem('mdbook-theme');
60+
let sidebar = localStorage.getItem('mdbook-sidebar');
61+
62+
if (theme.startsWith('"') && theme.endsWith('"')) {
63+
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
64+
}
65+
66+
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
67+
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
68+
}
69+
} catch (e) { }
70+
</script>
71+
72+
<!-- Set the theme before any content is loaded, prevents flash -->
73+
<script>
74+
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
75+
let theme;
76+
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
77+
if (theme === null || theme === undefined) { theme = default_theme; }
78+
const html = document.documentElement;
79+
html.classList.remove('light')
80+
html.classList.add(theme);
81+
html.classList.add("js");
82+
</script>
83+
84+
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
85+
86+
<!-- Hide / unhide sidebar before it is displayed -->
87+
<script>
88+
let sidebar = null;
89+
const sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
90+
if (document.body.clientWidth >= 1080) {
91+
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
92+
sidebar = sidebar || 'visible';
93+
} else {
94+
sidebar = 'hidden';
95+
}
96+
sidebar_toggle.checked = sidebar === 'visible';
97+
html.classList.remove('sidebar-visible');
98+
html.classList.add("sidebar-" + sidebar);
99+
</script>
100+
101+
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
102+
<!-- populated by js -->
103+
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
104+
<noscript>
105+
<iframe class="sidebar-iframe-outer" src="../toc.html"></iframe>
106+
</noscript>
107+
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
108+
<div class="sidebar-resize-indicator"></div>
109+
</div>
110+
</nav>
111+
112+
<div id="page-wrapper" class="page-wrapper">
113+
114+
<div class="page">
115+
<div id="menu-bar-hover-placeholder"></div>
116+
<div id="menu-bar" class="menu-bar sticky">
117+
<div class="left-buttons">
118+
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
119+
<i class="fa fa-bars"></i>
120+
</label>
121+
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
122+
<i class="fa fa-paint-brush"></i>
123+
</button>
124+
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
125+
<li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li>
126+
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
127+
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
128+
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
129+
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
130+
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
131+
</ul>
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
133+
<i class="fa fa-search"></i>
134+
</button>
135+
</div>
136+
137+
<h1 class="menu-title">Rust Embedded MB2 Discovery Book</h1>
138+
139+
<div class="right-buttons">
140+
<a href="../print.html" title="Print this book" aria-label="Print this book">
141+
<i id="print-button" class="fa fa-print"></i>
142+
</a>
143+
<a href="https://github.com/rust-embedded/discovery-mb2/" title="Git repository" aria-label="Git repository">
144+
<i id="git-repository-button" class="fa fa-github"></i>
145+
</a>
146+
147+
</div>
148+
</div>
149+
150+
<div id="search-wrapper" class="hidden">
151+
<form id="searchbar-outer" class="searchbar-outer">
152+
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
153+
</form>
154+
<div id="searchresults-outer" class="searchresults-outer hidden">
155+
<div id="searchresults-header" class="searchresults-header"></div>
156+
<ul id="searchresults">
157+
</ul>
158+
</div>
159+
</div>
160+
161+
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
162+
<script>
163+
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
164+
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
165+
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
166+
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
167+
});
168+
</script>
169+
170+
<div id="content" class="content">
171+
<main>
172+
<h1 id="hardwareknowledge-requirements"><a class="header" href="#hardwareknowledge-requirements">Hardware/knowledge requirements</a></h1>
173+
<p>The primary knowledge requirement to read this book is to know <em>some</em> Rust. It's hard for me to
174+
quantify <em>some</em>. Being familiar with the basics of generics and traits is quite helpful. You do need
175+
to know how to <em>use</em> closures. You also need to be familiar with the idioms of the current Rust
176+
<a href="https://rust-lang-nursery.github.io/edition-guide/">edition</a>.</p>
177+
<p>Also, to follow this material you'll need:</p>
178+
<ul>
179+
<li>
180+
<p>A <a href="https://tech.microbit.org/hardware/">Micro:Bit v2</a> (MB2) board.</p>
181+
<p>You can purchase this board from many suppliers, including
182+
Amazon and Ali Baba. You can get a <a href="https://microbit.org/buy/">list</a> of suppliers
183+
directly from the BBC, the manufacturers of MB2.</p>
184+
<p align="center">
185+
<img title="micro:bit" src="../assets/microbit-v2.jpg" width="500" />
186+
</p>
187+
<p>There are several versions of the <code>V2</code> board
188+
available. While the material here was written for <code>V2.00</code>,
189+
things should work fine with with any <code>V2</code> board.</p>
190+
</li>
191+
<li>
192+
<p>A micro-B USB cable (nothing special — you probably have many of these). This is required
193+
to power the micro:bit board when not on battery, and to communicate with it. Make sure
194+
that the cable supports data transfer, as some cables only support charging devices.</p>
195+
<p align="center">
196+
<img title="micro-B USB cable" src="../assets/usb-cable.jpg" width="500" />
197+
</p>
198+
<blockquote>
199+
<p><strong>NOTE</strong> Some micro:bit kits ship with such cables. USB cables used with other mobile
200+
devices should work, if they are micro-B and have the capability to transmit data.</p>
201+
</blockquote>
202+
<p>The official <code>micro:bit Go</code> kit provides both the USB cable and a nifty battery pack for powering
203+
the MB2 without USB.</p>
204+
</li>
205+
</ul>
206+
<blockquote>
207+
<p><strong>FAQ</strong>: Wait, why do I need this specific hardware?</p>
208+
</blockquote>
209+
<p>It makes my life and yours much easier.</p>
210+
<p>The material is much, much more approachable if we don't have to worry about hardware differences.
211+
Trust me on this one.</p>
212+
<blockquote>
213+
<p><strong>FAQ</strong>: Can I follow this material with a different development board?</p>
214+
</blockquote>
215+
<p>Maybe? It depends mainly on two things: your previous experience with microcontrollers and/or
216+
whether a high level crate already exists for your development board somewhere. You probably want at
217+
least a HAL crate, like <a href="https://docs.rs/nrf52-hal"><code>nrf52-hal</code></a> used here. You may prefer a board with a Board Support crate,
218+
like [<code>microbit-v2</code>] used here. If you intend to use a different microcontroller, you can look
219+
through <a href="https://github.com/rust-embedded/awesome-embedded-rust">Awesome Embedded Rust</a> or just search the web to find supported crates.</p>
220+
<p>With a different development board, this text loses most if not all its beginner friendliness and
221+
"easy to follow"-ness, in my opinion: you have been warned.</p>
222+
<p>If you have a different Arm-based development board and you don't consider yourself a total
223+
beginner, you might consider starting with the <a href="https://rust-embedded.github.io/cortex-m-quickstart/cortex_m_quickstart/">quickstart</a> project template.</p>
224+
225+
</main>
226+
227+
<nav class="nav-wrapper" aria-label="Page navigation">
228+
<!-- Mobile navigation buttons -->
229+
<a rel="prev" href="../01-background/index.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
230+
<i class="fa fa-angle-left"></i>
231+
</a>
232+
233+
<a rel="next prefetch" href="../03-setup/index.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
234+
<i class="fa fa-angle-right"></i>
235+
</a>
236+
237+
<div style="clear: both"></div>
238+
</nav>
239+
</div>
240+
</div>
241+
242+
<nav class="nav-wide-wrapper" aria-label="Page navigation">
243+
<a rel="prev" href="../01-background/index.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
244+
<i class="fa fa-angle-left"></i>
245+
</a>
246+
247+
<a rel="next prefetch" href="../03-setup/index.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
248+
<i class="fa fa-angle-right"></i>
249+
</a>
250+
</nav>
251+
252+
</div>
253+
254+
255+
256+
257+
<script>
258+
window.playground_copyable = true;
259+
</script>
260+
261+
262+
<script src="../elasticlunr.min.js"></script>
263+
<script src="../mark.min.js"></script>
264+
<script src="../searcher.js"></script>
265+
266+
<script src="../clipboard.min.js"></script>
267+
<script src="../highlight.js"></script>
268+
<script src="../book.js"></script>
269+
270+
<!-- Custom JS scripts -->
271+
<script src="../epub-link.js"></script>
272+
273+
274+
</div>
275+
</body>
276+
</html>

03-setup/.cargo/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
target = "thumbv7em-none-eabihf"
3+
4+
[target.thumbv7em-none-eabihf]
5+
runner = "probe-rs run --chip nRF52833_xxAA"
6+
rustflags = [
7+
"-C", "linker=rust-lld",
8+
]

03-setup/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "rtt-check"
3+
version = "0.1.0"
4+
authors = ["Henrik Böving <hargonix@gmail.com>"]
5+
edition = "2021"
6+
7+
[dependencies]
8+
cortex-m-rt = "0.7.5"
9+
panic-rtt-target = "0.2.0"
10+
rtt-target = "0.6.1"
11+
12+
[dependencies.nrf52833-pac]
13+
version = "0.12.2"
14+
features = ["cortex-m-rt"]
15+
16+
[dependencies.cortex-m]
17+
version = "0.7.7"
18+
features = ["inline-asm", "critical-section-single-core"]

03-setup/Embed.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[default.probe]
2+
protocol = "Swd"
3+
4+
[default.general]
5+
chip = "nrf52833_xxAA"
6+
7+
[default.rtt]
8+
enabled = true
9+
10+
[default.gdb]
11+
enabled = false

0 commit comments

Comments
 (0)