Update documentation
This commit is contained in:
10
cortex_m_rt/ExceptionFrame.t.html
Normal file
10
cortex_m_rt/ExceptionFrame.t.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.ExceptionFrame.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.ExceptionFrame.html">struct.ExceptionFrame.html</a>...</p>
|
||||
<script>location.replace("struct.ExceptionFrame.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
3
cortex_m_rt/all.html
Normal file
3
cortex_m_rt/all.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span>
|
||||
</span>
|
||||
<span class='in-band'>List of all items</span></h1><h3 id='Structs'>Structs</h3><ul class='structs docblock'><li><a href='struct.ExceptionFrame.html'>ExceptionFrame</a></li></ul><h3 id='Macros'>Macros</h3><ul class='macros docblock'><li><a href='macro.entry.html'>entry</a></li><li><a href='macro.exception.html'>exception</a></li><li><a href='macro.pre_init.html'>pre_init</a></li></ul><h3 id='Functions'>Functions</h3><ul class='functions docblock'><li><a href='fn.heap_start.html'>heap_start</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/entry.m.html
Normal file
10
cortex_m_rt/entry.m.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.entry.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.entry.html">macro.entry.html</a>...</p>
|
||||
<script>location.replace("macro.entry.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
10
cortex_m_rt/exception.m.html
Normal file
10
cortex_m_rt/exception.m.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.exception.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.exception.html">macro.exception.html</a>...</p>
|
||||
<script>location.replace("macro.exception.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
3
cortex_m_rt/fn.heap_start.html
Normal file
3
cortex_m_rt/fn.heap_start.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `heap_start` fn in crate `cortex_m_rt`."><meta name="keywords" content="rust, rustlang, rust-lang, heap_start"><title>cortex_m_rt::heap_start - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><div class="sidebar-elems"><p class='location'><a href='index.html'>cortex_m_rt</a></p><script>window.sidebarCurrent = {name: 'heap_start', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#459-465' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>cortex_m_rt</a>::<wbr><a class="fn" href=''>heap_start</a></span></h1><pre class='rust fn'>pub fn heap_start() -> *mut u32</pre><div class='docblock'><p>Returns a pointer to the start of the heap</p>
|
||||
<p>The returned pointer is guaranteed to be 4-byte aligned.</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/heap_start.v.html
Normal file
10
cortex_m_rt/heap_start.v.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=fn.heap_start.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="fn.heap_start.html">fn.heap_start.html</a>...</p>
|
||||
<script>location.replace("fn.heap_start.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
374
cortex_m_rt/index.html
Normal file
374
cortex_m_rt/index.html
Normal file
@@ -0,0 +1,374 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `cortex_m_rt` crate."><meta name="keywords" content="rust, rustlang, rust-lang, cortex_m_rt"><title>cortex_m_rt - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><p class='location'>Crate cortex_m_rt</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'cortex_m_rt', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#1-926' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>cortex_m_rt</a></span></h1><div class='docblock'><p>Minimal startup / runtime for Cortex-M microcontrollers</p>
|
||||
<p>This crate contains all the required parts to build a <code>no_std</code> application (binary crate) that
|
||||
targets a Cortex-M microcontroller.</p>
|
||||
<h1 id="features" class="section-header"><a href="#features">Features</a></h1>
|
||||
<p>This crates takes care of:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The memory layout of the program. In particular, it populates the vector table so the device
|
||||
can boot correctly, and properly dispatch exceptions and interrupts.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Initializing <code>static</code> variables before the program entry point.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Enabling the FPU before the program entry point if the target is <code>thumbv7em-none-eabihf</code>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>This crate also provides a mechanism to set exception handlers: see the <a href="macro.exception.html"><code>exception!</code></a> macro.</p>
|
||||
<h1 id="requirements" class="section-header"><a href="#requirements">Requirements</a></h1><h2 id="memoryx" class="section-header"><a href="#memoryx"><code>memory.x</code></a></h2>
|
||||
<p>This crate expects the user, or some other crate, to provide the memory layout of the target
|
||||
device via a linker script named <code>memory.x</code>. This section covers the contents of <code>memory.x</code></p>
|
||||
<h3 id="memory" class="section-header"><a href="#memory"><code>MEMORY</code></a></h3>
|
||||
<p>The linker script must specify the memory available in the device as, at least, two <code>MEMORY</code>
|
||||
regions: one named <code>FLASH</code> and one named <code>RAM</code>. The <code>.text</code> and <code>.rodata</code> sections of the
|
||||
program will be placed in the <code>FLASH</code> region, whereas the <code>.bss</code> and <code>.data</code> sections, as well
|
||||
as the heap,will be placed in the <code>RAM</code> region.</p>
|
||||
<pre><code class="language-text">/* Linker script for the STM32F103C8T6 */
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x08000000, LENGTH = 64K
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 20K
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="_stack_start" class="section-header"><a href="#_stack_start"><code>_stack_start</code></a></h3>
|
||||
<p>This optional symbol can be used to indicate where the call stack of the program should be
|
||||
placed. If this symbol is not used then the stack will be placed at the <em>end</em> of the <code>RAM</code>
|
||||
region -- the stack grows downwards towards smaller address. This symbol can be used to place
|
||||
the stack in a different memory region, for example:</p>
|
||||
<pre><code class="language-text">/* Linker script for the STM32F303VCT6 */
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x08000000, LENGTH = 256K
|
||||
|
||||
/* .bss, .data and the heap go in this region */
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 40K
|
||||
|
||||
/* Core coupled (faster) RAM dedicated to hold the stack */
|
||||
CCRAM : ORIGIN = 0x10000000, LENGTH = 8K
|
||||
}
|
||||
|
||||
_stack_start = ORIGIN(CCRAM) + LENGTH(CCRAM);
|
||||
</code></pre>
|
||||
<h3 id="_stext" class="section-header"><a href="#_stext"><code>_stext</code></a></h3>
|
||||
<p>This optional symbol can be used to control where the <code>.text</code> section is placed. If omitted the
|
||||
<code>.text</code> section will be placed right after the vector table, which is placed at the beginning of
|
||||
<code>FLASH</code>. Some devices store settings like Flash configuration right after the vector table;
|
||||
for these devices one must place the <code>.text</code> section after this configuration section --
|
||||
<code>_stext</code> can be used for this purpose.</p>
|
||||
<pre><code class="language-text">MEMORY
|
||||
{
|
||||
/* .. */
|
||||
}
|
||||
|
||||
/* The device stores Flash configuration in 0x400-0x40C so we place .text after that */
|
||||
_stext = ORIGIN(FLASH) + 0x40C
|
||||
</code></pre>
|
||||
<h1 id="an-example" class="section-header"><a href="#an-example">An example</a></h1>
|
||||
<p>This section presents a minimal application built on top of <code>cortex-m-rt</code>. Apart from the
|
||||
mandatory <code>memory.x</code> linker script describing the memory layout of the device, the hard fault
|
||||
handler and the default exception handler must also be defined somewhere in the dependency
|
||||
graph (cf. <a href="macro.exception.html"><code>exception!</code></a>). In this example we define them in the binary crate:</p>
|
||||
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="comment">// IMPORTANT the standard `main` interface is not used because it requires nightly</span>
|
||||
<span class="attribute">#![<span class="ident">no_main</span>]</span>
|
||||
<span class="attribute">#![<span class="ident">no_std</span>]</span>
|
||||
|
||||
<span class="attribute">#[<span class="ident">macro_use</span>(<span class="ident">entry</span>, <span class="ident">exception</span>)]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">cortex_m_rt</span> <span class="kw">as</span> <span class="ident">rt</span>;
|
||||
|
||||
<span class="comment">// makes `panic!` print messages to the host stderr using semihosting</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">panic_semihosting</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">rt</span>::<span class="ident">ExceptionFrame</span>;
|
||||
|
||||
<span class="comment">// use `main` as the entry point of this application</span>
|
||||
<span class="macro">entry</span><span class="macro">!</span>(<span class="ident">main</span>);
|
||||
|
||||
<span class="comment">// `main` is not allowed to return</span>
|
||||
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="op">!</span> {
|
||||
<span class="comment">// initialization</span>
|
||||
|
||||
<span class="kw">loop</span> {
|
||||
<span class="comment">// application logic</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="comment">// define the hard fault handler</span>
|
||||
<span class="macro">exception</span><span class="macro">!</span>(<span class="ident">HardFault</span>, <span class="ident">hard_fault</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">hard_fault</span>(<span class="ident">ef</span>: <span class="kw-2">&</span><span class="ident">ExceptionFrame</span>) <span class="op">-></span> <span class="op">!</span> {
|
||||
<span class="macro">panic</span><span class="macro">!</span>(<span class="string">"{:#?}"</span>, <span class="ident">ef</span>);
|
||||
}
|
||||
|
||||
<span class="comment">// define the default exception handler</span>
|
||||
<span class="macro">exception</span><span class="macro">!</span>(<span class="kw-2">*</span>, <span class="ident">default_handler</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">default_handler</span>(<span class="ident">irqn</span>: <span class="ident">i16</span>) {
|
||||
<span class="macro">panic</span><span class="macro">!</span>(<span class="string">"unhandled exception (IRQn={})"</span>, <span class="ident">irqn</span>);
|
||||
}</pre>
|
||||
<p>To actually build this program you need to place a <code>memory.x</code> linker script somewhere the linker
|
||||
can find it, e.g. in the current directory; and then link the program using <code>cortex-m-rt</code>'s
|
||||
linker script: <code>link.x</code>. The required steps are shown below:</p>
|
||||
<pre><code class="language-text">$ cat > memory.x <<EOF
|
||||
/* Linker script for the STM32F103C8T6 */
|
||||
MEMORY
|
||||
{
|
||||
FLASH : ORIGIN = 0x08000000, LENGTH = 64K
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 20K
|
||||
}
|
||||
EOF
|
||||
|
||||
$ cargo rustc --target thumbv7m-none-eabi -- \
|
||||
-C link-arg=-nostartfiles -C link-arg=-Tlink.x
|
||||
|
||||
$ file target/thumbv7m-none-eabi/debug/app
|
||||
app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, (..)
|
||||
</code></pre>
|
||||
<h1 id="optional-features" class="section-header"><a href="#optional-features">Optional features</a></h1><h2 id="device" class="section-header"><a href="#device"><code>device</code></a></h2>
|
||||
<p>If this feature is disabled then this crate populates the whole vector table. All the interrupts
|
||||
in the vector table, even the ones unused by the target device, will be bound to the default
|
||||
exception handler. This makes the final application device agnostic: you will be able to run it
|
||||
on any Cortex-M device -- provided that you correctly specified its memory layout in <code>memory.x</code>
|
||||
-- without hitting undefined behavior.</p>
|
||||
<p>If this feature is enabled then the interrupts section of the vector table is left unpopulated
|
||||
and some other crate, or the user, will have to populate it. This mode is meant to be used in
|
||||
conjunction with crates generated using <code>svd2rust</code>. Those <em>device crates</em> will populate the
|
||||
missing part of the vector table when their <code>"rt"</code> feature is enabled.</p>
|
||||
<h1 id="inspection" class="section-header"><a href="#inspection">Inspection</a></h1>
|
||||
<p>This section covers how to inspect a binary that builds on top of <code>cortex-m-rt</code>.</p>
|
||||
<h2 id="sections-size" class="section-header"><a href="#sections-size">Sections (<code>size</code>)</a></h2>
|
||||
<p><code>cortex-m-rt</code> uses standard sections like <code>.text</code>, <code>.rodata</code>, <code>.bss</code> and <code>.data</code> as one would
|
||||
expect. <code>cortex-m-rt</code> separates the vector table in its own section, named <code>.vector_table</code>. This
|
||||
lets you distinguish how much space is taking the vector table in Flash vs how much is being
|
||||
used by actual instructions (<code>.text</code>) and constants (<code>.rodata</code>).</p>
|
||||
|
||||
<pre class="rust rust-example-rendered">
|
||||
$ <span class="ident">size</span> <span class="op">-</span><span class="ident">Ax</span> <span class="ident">target</span><span class="op">/</span><span class="ident">thumbv7m</span><span class="op">-</span><span class="ident">none</span><span class="op">-</span><span class="ident">eabi</span><span class="op">/</span><span class="ident">examples</span><span class="op">/</span><span class="ident">app</span>
|
||||
<span class="ident">target</span><span class="op">/</span><span class="ident">thumbv7m</span><span class="op">-</span><span class="ident">none</span><span class="op">-</span><span class="ident">eabi</span><span class="op">/</span><span class="ident">release</span><span class="op">/</span><span class="ident">examples</span><span class="op">/</span><span class="ident">app</span> :
|
||||
<span class="ident">section</span> <span class="ident">size</span> <span class="ident">addr</span>
|
||||
.<span class="ident">vector_table</span> <span class="number">0x400</span> <span class="number">0x8000000</span>
|
||||
.<span class="ident">text</span> <span class="number">0x88</span> <span class="number">0x8000400</span>
|
||||
.<span class="ident">rodata</span> <span class="number">0x0</span> <span class="number">0x8000488</span>
|
||||
.<span class="ident">data</span> <span class="number">0x0</span> <span class="number">0x20000000</span>
|
||||
.<span class="ident">bss</span> <span class="number">0x0</span> <span class="number">0x20000000</span></pre>
|
||||
<p>Without the <code>-A</code> argument <code>size</code> reports the sum of the sizes of <code>.text</code>, <code>.rodata</code> and
|
||||
<code>.vector_table</code> under "text".</p>
|
||||
|
||||
<pre class="rust rust-example-rendered">
|
||||
$ <span class="ident">size</span> <span class="ident">target</span><span class="op">/</span><span class="ident">thumbv7m</span><span class="op">-</span><span class="ident">none</span><span class="op">-</span><span class="ident">eabi</span><span class="op">/</span><span class="ident">examples</span><span class="op">/</span><span class="ident">app</span>
|
||||
<span class="ident">text</span> <span class="ident">data</span> <span class="ident">bss</span> <span class="ident">dec</span> <span class="ident">hex</span> <span class="ident">filename</span>
|
||||
<span class="number">1160</span> <span class="number">0</span> <span class="number">0</span> <span class="number">1660</span> <span class="number">67c</span> <span class="ident">target</span><span class="op">/</span><span class="ident">thumbv7m</span><span class="op">-</span><span class="ident">none</span><span class="op">-</span><span class="ident">eabi</span><span class="op">/</span><span class="ident">release</span><span class="op">/</span><span class="ident">app</span></pre>
|
||||
<h2 id="symbols-objdump-nm" class="section-header"><a href="#symbols-objdump-nm">Symbols (<code>objdump</code>, <code>nm</code>)</a></h2>
|
||||
<p>One will always find the following (unmangled) symbols in <code>cortex-m-rt</code> applications:</p>
|
||||
<ul>
|
||||
<li><code>Reset</code>. This is the reset handler. The microcontroller will executed this function upon
|
||||
booting. This function will call the user program entry point (cf. <a href="macro.entry.html"><code>entry!</code></a>) using the <code>main</code>
|
||||
symbol so you may also find that symbol in your program; if you do, <code>main</code> will contain your
|
||||
application code. Some other times <code>main</code> gets inlined into <code>Reset</code> so you won't find it.</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>DefaultHandler</code>. This is the default handler. This function will contain, or call, the
|
||||
function you declared in the second argument of <code>exception!(*, ..)</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>HardFault</code>. This is the hard fault handler. This function is simply a trampoline that jumps
|
||||
into the user defined hard fault handler: <code>UserHardFault</code>. The trampoline is required to set up
|
||||
the pointer to the stacked exception frame.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>UserHardFault</code>. This is the user defined hard fault handler. This function will contain, or
|
||||
call, the function you declared in the second argument of <code>exception!(HardFault, ..)</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>__STACK_START</code>. This is the first entry in the <code>.vector_table</code> section. This symbol contains
|
||||
the initial value of the stack pointer; this is where the stack will be located -- the stack
|
||||
grows downwards towards smaller addresses.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>__RESET_VECTOR</code>. This is the reset vector, a pointer into the <code>Reset</code> handler. This vector is
|
||||
located in the <code>.vector_table</code> section after <code>__STACK_START</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>__EXCEPTIONS</code>. This is the core exceptions portion of the vector table; it's an array of 14
|
||||
exception vectors, which includes exceptions like <code>HardFault</code> and <code>SysTick</code>. This array is
|
||||
located after <code>__RESET_VECTOR</code> in the <code>.vector_table</code> section.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>__EXCEPTIONS</code>. This is the device specific interrupt portion of the vector table; its exact
|
||||
size depends on the target device but if the <code>"device"</code> feature has not been enabled it will
|
||||
have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after
|
||||
<code>__EXCEPTIONS</code> in the <code>.vector_table</code> section.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>__pre_init</code>. This is a function to be run before RAM is initialized. It defaults to an empty
|
||||
function. The function called can be changed by calling the <code>pre_init!</code> macro. The empty
|
||||
function is not optimized out by default, but if an empty function is passed to <code>pre_init!</code> the
|
||||
function call will be optimized out.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>If you override any exception handler you'll find it as an unmangled symbol, e.g. <code>SysTick</code> or
|
||||
<code>SVCall</code>, in the output of <code>objdump</code>,</p>
|
||||
<p>If you are targeting the <code>thumbv7em-none-eabihf</code> target you'll also see a <code>ResetTrampoline</code>
|
||||
symbol in the output. To avoid the compiler placing FPU instructions before the FPU has been
|
||||
enabled (cf. <code>vpush</code>) <code>Reset</code> calls the function <code>ResetTrampoline</code> which is marked as
|
||||
<code>#[inline(never)]</code> and <code>ResetTrampoline</code> calls <code>main</code>. The compiler is free to inline <code>main</code>
|
||||
into <code>ResetTrampoline</code> but it can't inline <code>ResetTrampoline</code> into <code>Reset</code> -- the FPU is enabled
|
||||
in <code>Reset</code>.</p>
|
||||
<h1 id="advanced-usage" class="section-header"><a href="#advanced-usage">Advanced usage</a></h1><h2 id="setting-the-program-entry-point" class="section-header"><a href="#setting-the-program-entry-point">Setting the program entry point</a></h2>
|
||||
<p>This section describes how <code>entry!</code> is implemented. This information is useful to developers who
|
||||
want to provide an alternative to <code>entry!</code> that provides extra guarantees.</p>
|
||||
<p>The <code>Reset</code> handler will call a symbol named <code>main</code> (unmangled) <em>after</em> initializing <code>.bss</code> and
|
||||
<code>.data</code>, and enabling the FPU (if the target is <code>thumbv7em-none-eabihf</code>). <code>entry!</code> provides this
|
||||
symbol in its expansion:</p>
|
||||
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="macro">entry</span><span class="macro">!</span>(<span class="ident">path</span>::<span class="ident">to</span>::<span class="ident">main</span>);
|
||||
|
||||
<span class="comment">// expands into</span>
|
||||
|
||||
<span class="attribute">#[<span class="ident">export_name</span> <span class="op">=</span> <span class="string">"main"</span>]</span>
|
||||
<span class="kw">pub</span> <span class="kw">extern</span> <span class="string">"C"</span> <span class="kw">fn</span> <span class="ident">__impl_main</span>() <span class="op">-></span> <span class="op">!</span> {
|
||||
<span class="comment">// validate the signature of the program entry point</span>
|
||||
<span class="kw">let</span> <span class="ident">f</span>: <span class="kw">fn</span>() <span class="op">-></span> <span class="op">!</span> <span class="op">=</span> <span class="ident">path</span>::<span class="ident">to</span>::<span class="ident">main</span>;
|
||||
|
||||
<span class="ident">f</span>()
|
||||
}</pre>
|
||||
<p>The unmangled <code>main</code> symbol must have signature <code>extern "C" fn() -> !</code> or its invocation from
|
||||
<code>Reset</code> will result in undefined behavior.</p>
|
||||
<h2 id="incorporating-device-specific-interrupts" class="section-header"><a href="#incorporating-device-specific-interrupts">Incorporating device specific interrupts</a></h2>
|
||||
<p>This section covers how an external crate can insert device specific interrupt handlers into the
|
||||
vector table. Most users don't need to concern themselves with these details, but if you are
|
||||
interested in how device crates generated using <code>svd2rust</code> integrate with <code>cortex-m-rt</code> read on.</p>
|
||||
<p>The information in this section applies when the <code>"device"</code> feature has been enabled.</p>
|
||||
<h3 id="__interrupts" class="section-header"><a href="#__interrupts"><code>__INTERRUPTS</code></a></h3>
|
||||
<p>The external crate must provide the interrupts portion of the vector table via a <code>static</code>
|
||||
variable named<code>__INTERRUPTS</code> (unmangled) that must be placed in the <code>.vector_table.interrupts</code>
|
||||
section of its object file.</p>
|
||||
<p>This <code>static</code> variable will be placed at <code>ORIGIN(FLASH) + 0x40</code>. This address corresponds to the
|
||||
spot where IRQ0 (IRQ number 0) is located.</p>
|
||||
<p>To conform to the Cortex-M ABI <code>__INTERRUPTS</code> must be an array of function pointers; some spots
|
||||
in this array may need to be set to 0 if they are marked as <em>reserved</em> in the data sheet /
|
||||
reference manual. We recommend using a <code>union</code> to set the reserved spots to <code>0</code>; <code>None</code>
|
||||
(<code>Option<fn()></code>) may also work but it's not guaranteed that the <code>None</code> variant will <em>always</em> be
|
||||
represented by the value <code>0</code>.</p>
|
||||
<p>Let's illustrate with an artificial example where a device only has two interrupt: <code>Foo</code>, with
|
||||
IRQ number = 2, and <code>Bar</code>, with IRQ number = 4.</p>
|
||||
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="ident">union</span> <span class="ident">Vector</span> {
|
||||
<span class="ident">handler</span>: <span class="kw">extern</span> <span class="string">"C"</span> <span class="kw">fn</span>(),
|
||||
<span class="ident">reserved</span>: <span class="ident">usize</span>,
|
||||
}
|
||||
|
||||
<span class="kw">extern</span> <span class="string">"C"</span> {
|
||||
<span class="kw">fn</span> <span class="ident">Foo</span>();
|
||||
<span class="kw">fn</span> <span class="ident">Bar</span>();
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">link_section</span> <span class="op">=</span> <span class="string">".vector_table.interrupts"</span>]</span>
|
||||
<span class="attribute">#[<span class="ident">no_mangle</span>]</span>
|
||||
<span class="kw">pub</span> <span class="kw">static</span> <span class="ident">__INTERRUPTS</span>: [<span class="ident">Vector</span>; <span class="number">5</span>] <span class="op">=</span> [
|
||||
<span class="comment">// 0-1: Reserved</span>
|
||||
<span class="ident">Vector</span> { <span class="ident">reserved</span>: <span class="number">0</span> },
|
||||
<span class="ident">Vector</span> { <span class="ident">reserved</span>: <span class="number">0</span> },
|
||||
|
||||
<span class="comment">// 2: Foo</span>
|
||||
<span class="ident">Vector</span> { <span class="ident">handler</span>: <span class="ident">Foo</span> },
|
||||
|
||||
<span class="comment">// 3: Reserved</span>
|
||||
<span class="ident">Vector</span> { <span class="ident">reserved</span>: <span class="number">0</span> },
|
||||
|
||||
<span class="comment">// 4: Bar</span>
|
||||
<span class="ident">Vector</span> { <span class="ident">handler</span>: <span class="ident">Bar</span> },
|
||||
];</pre>
|
||||
<h3 id="devicex" class="section-header"><a href="#devicex"><code>device.x</code></a></h3>
|
||||
<p>Linking in <code>__INTERRUPTS</code> creates a bunch of undefined references. If the user doesn't set a
|
||||
handler for <em>all</em> the device specific interrupts then linking will fail with <code>"undefined reference"</code> errors.</p>
|
||||
<p>We want to provide a default handler for all the interrupts while still letting the user
|
||||
individually override each interrupt handler. In C projects, this is usually accomplished using
|
||||
weak aliases declared in external assembly files. In Rust, we could achieve something similar
|
||||
using <code>global_asm!</code>, but that's an unstable feature.</p>
|
||||
<p>A solution that doesn't require <code>global_asm!</code> or external assembly files is to use the <code>PROVIDE</code>
|
||||
command in a linker script to create the weak aliases. This is the approach that <code>cortex-m-rt</code>
|
||||
uses; when the <code>"device"</code> feature is enabled <code>cortex-m-rt</code>'s linker script (<code>link.x</code>) depends on
|
||||
a linker script named <code>device.x</code>. The crate that provides <code>__INTERRUPTS</code> must also provide this
|
||||
file.</p>
|
||||
<p>For our running example the <code>device.x</code> linker script looks like this:</p>
|
||||
<pre><code class="language-text">/* device.x */
|
||||
PROVIDE(Foo = DefaultHandler);
|
||||
PROVIDE(Bar = DefaultHandler);
|
||||
</code></pre>
|
||||
<p>This weakly aliases both <code>Foo</code> and <code>Bar</code>. <code>DefaultHandler</code> is the default exception handler that
|
||||
the user provides via <code>exception!(*, ..)</code> and that the core exceptions use unless overridden.</p>
|
||||
<p>Because this linker script is provided by a dependency of the final application the dependency
|
||||
must contain build script that puts <code>device.x</code> somewhere the linker can find. An example of such
|
||||
build script is shown below:</p>
|
||||
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">env</span>;
|
||||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
||||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Write</span>;
|
||||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||||
<span class="comment">// Put the linker script somewhere the linker can find it</span>
|
||||
<span class="kw">let</span> <span class="ident">out</span> <span class="op">=</span> <span class="kw-2">&</span><span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="ident">env</span>::<span class="ident">var_os</span>(<span class="string">"OUT_DIR"</span>).<span class="ident">unwrap</span>());
|
||||
<span class="ident">File</span>::<span class="ident">create</span>(<span class="ident">out</span>.<span class="ident">join</span>(<span class="string">"device.x"</span>))
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">write_all</span>(<span class="macro">include_bytes</span><span class="macro">!</span>(<span class="string">"device.x"</span>))
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"cargo:rustc-link-search={}"</span>, <span class="ident">out</span>.<span class="ident">display</span>());
|
||||
}</pre>
|
||||
<h2 id="pre_init" class="section-header"><a href="#pre_init"><code>pre_init!</code></a></h2>
|
||||
<p>A user-defined function can be run at the start of the reset handler, before RAM is
|
||||
initialized. The macro <code>pre_init!</code> can be called to set the function to be run. The function is
|
||||
intended to perform actions that cannot wait the time it takes for RAM to be initialized, such
|
||||
as disabling a watchdog. As the function is called before RAM is initialized, any access of
|
||||
static variables will result in undefined behavior.</p>
|
||||
</div><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class="macro" href="macro.entry.html"
|
||||
title='macro cortex_m_rt::entry'>entry</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Macro to define the entry point of the program</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=' module-item'>
|
||||
<td><a class="macro" href="macro.exception.html"
|
||||
title='macro cortex_m_rt::exception'>exception</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Macro to set or override a processor core exception handler</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=' module-item'>
|
||||
<td><a class="macro" href="macro.pre_init.html"
|
||||
title='macro cortex_m_rt::pre_init'>pre_init</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Macro to set the function to be called at the beginning of the reset handler.</p>
|
||||
|
||||
</td>
|
||||
</tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class="struct" href="struct.ExceptionFrame.html"
|
||||
title='struct cortex_m_rt::ExceptionFrame'>ExceptionFrame</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Registers stacked (pushed into the stack) during an exception</p>
|
||||
|
||||
</td>
|
||||
</tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class="fn" href="fn.heap_start.html"
|
||||
title='fn cortex_m_rt::heap_start'>heap_start</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Returns a pointer to the start of the heap</p>
|
||||
|
||||
</td>
|
||||
</tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/macro.entry!.html
Normal file
10
cortex_m_rt/macro.entry!.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.entry.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.entry.html">macro.entry.html</a>...</p>
|
||||
<script>location.replace("macro.entry.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
13
cortex_m_rt/macro.entry.html
Normal file
13
cortex_m_rt/macro.entry.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `entry` macro in crate `cortex_m_rt`."><meta name="keywords" content="rust, rustlang, rust-lang, entry"><title>cortex_m_rt::entry - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc macro"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><div class="sidebar-elems"><p class='location'><a href='index.html'>cortex_m_rt</a></p><script>window.sidebarCurrent = {name: 'entry', ty: 'macro', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#567-577' title='goto source code'>[src]</a></span><span class='in-band'>Macro <a href='index.html'>cortex_m_rt</a>::<wbr><a class="macro" href=''>entry</a></span></h1><div class="docblock type-decl"><pre class="rust macro">
|
||||
<span class="macro">macro_rules</span><span class="macro">!</span> <span class="ident">entry</span> {
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">path</span>:<span class="ident">expr</span>) <span class="op">=></span> { ... };
|
||||
}</pre>
|
||||
</div><div class='docblock'><p>Macro to define the entry point of the program</p>
|
||||
<p><strong>NOTE</strong> This macro must be invoked once and must be invoked from an accessible module, ideally
|
||||
from the root of the crate.</p>
|
||||
<p>Usage: <code>entry!(path::to::entry::point)</code></p>
|
||||
<p>The specified function will be called by the reset handler <em>after</em> RAM has been initialized. In
|
||||
the case of the <code>thumbv7em-none-eabihf</code> target the FPU will also be enabled before the function
|
||||
is called.</p>
|
||||
<p>The signature of the specified function must be <code>fn() -> !</code> (never ending function)</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/macro.exception!.html
Normal file
10
cortex_m_rt/macro.exception!.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.exception.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.exception.html">macro.exception.html</a>...</p>
|
||||
<script>location.replace("macro.exception.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
100
cortex_m_rt/macro.exception.html
Normal file
100
cortex_m_rt/macro.exception.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `exception` macro in crate `cortex_m_rt`."><meta name="keywords" content="rust, rustlang, rust-lang, exception"><title>cortex_m_rt::exception - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc macro"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><div class="sidebar-elems"><p class='location'><a href='index.html'>cortex_m_rt</a></p><script>window.sidebarCurrent = {name: 'exception', ty: 'macro', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#832-894' title='goto source code'>[src]</a></span><span class='in-band'>Macro <a href='index.html'>cortex_m_rt</a>::<wbr><a class="macro" href=''>exception</a></span></h1><div class="docblock type-decl"><pre class="rust macro">
|
||||
<span class="macro">macro_rules</span><span class="macro">!</span> <span class="ident">exception</span> {
|
||||
(<span class="op">*</span> , <span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">expr</span>) <span class="op">=></span> { ... };
|
||||
(<span class="ident">HardFault</span>, <span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">expr</span>) <span class="op">=></span> { ... };
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">Name</span>:<span class="ident">ident</span>, <span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">expr</span>,<span class="ident">state</span>: <span class="macro-nonterminal">$</span><span class="macro-nonterminal">State</span>:<span class="ident">ty</span> <span class="op">=</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">initial_state</span>:<span class="ident">expr</span>) <span class="op">=></span> { ... };
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">Name</span>:<span class="ident">ident</span>, <span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">expr</span>) <span class="op">=></span> { ... };
|
||||
}</pre>
|
||||
</div><div class='docblock'><p>Macro to set or override a processor core exception handler</p>
|
||||
<p><strong>NOTE</strong> This macro must be invoked from an accessible module, ideally from the root of the
|
||||
crate.</p>
|
||||
<h1 id="syntax" class="section-header"><a href="#syntax">Syntax</a></h1>
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="macro">exception</span><span class="macro">!</span>(
|
||||
<span class="comment">// Name of the exception</span>
|
||||
<span class="macro-nonterminal">$</span><span class="macro-nonterminal">Name</span>:<span class="ident">ident</span>,
|
||||
|
||||
<span class="comment">// Path to the exception handler (a function)</span>
|
||||
<span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">expr</span>,
|
||||
|
||||
<span class="comment">// Optional, state preserved across invocations of the handler</span>
|
||||
<span class="ident">state</span>: <span class="macro-nonterminal">$</span><span class="macro-nonterminal">State</span>:<span class="ident">ty</span> <span class="op">=</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">initial_state</span>:<span class="ident">expr</span>,
|
||||
);</pre>
|
||||
<p>where <code>$Name</code> can be one of:</p>
|
||||
<ul>
|
||||
<li><code>*</code></li>
|
||||
<li><code>NonMaskableInt</code></li>
|
||||
<li><code>HardFault</code></li>
|
||||
<li><code>MemoryManagement</code> (a)</li>
|
||||
<li><code>BusFault</code> (a)</li>
|
||||
<li><code>UsageFault</code> (a)</li>
|
||||
<li><code>SecureFault</code> (b)</li>
|
||||
<li><code>SVCall</code></li>
|
||||
<li><code>DebugMonitor</code> (a)</li>
|
||||
<li><code>PendSV</code></li>
|
||||
<li><code>SysTick</code></li>
|
||||
</ul>
|
||||
<p>(a) Not available on Cortex-M0 variants (<code>thumbv6m-none-eabi</code>)</p>
|
||||
<p>(b) Only available on ARMv8-M</p>
|
||||
<h1 id="usage" class="section-header"><a href="#usage">Usage</a></h1>
|
||||
<p><code>exception!(HardFault, ..)</code> sets the hard fault handler. The handler must have signature
|
||||
<code>fn(&ExceptionFrame) -> !</code>. This handler is not allowed to return as that can cause undefined
|
||||
behavior. It's mandatory to set the <code>HardFault</code> handler somewhere in the dependency graph of an
|
||||
application.</p>
|
||||
<p><code>exception!(*, ..)</code> sets the <em>default</em> handler. All exceptions which have not been assigned a
|
||||
handler will be serviced by this handler. This handler must have signature <code>fn(irqn: i16)</code>.
|
||||
<code>irqn</code> is the IRQ number (cf. CMSIS); <code>irqn</code> will be a negative number when the handler is
|
||||
servicing a core exception; <code>irqn</code> will be a positive number when the handler is servicing a
|
||||
device specific exception (interrupt). It's mandatory to set the default handler somewhere
|
||||
in the dependency graph of an application.</p>
|
||||
<p><code>exception!($Exception, ..)</code> overrides the default handler for <code>$Exception</code>. All exceptions,
|
||||
except for <code>HardFault</code>, can be assigned some <code>$State</code>.</p>
|
||||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||||
<ul>
|
||||
<li>Setting the <code>HardFault</code> handler</li>
|
||||
</ul>
|
||||
|
||||
<pre class="rust rust-example-rendered">
|
||||
<span class="attribute">#[<span class="ident">macro_use</span>(<span class="ident">exception</span>)]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">cortex_m_rt</span> <span class="kw">as</span> <span class="ident">rt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">rt</span>::<span class="ident">ExceptionFrame</span>;
|
||||
|
||||
<span class="macro">exception</span><span class="macro">!</span>(<span class="ident">HardFault</span>, <span class="ident">hard_fault</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">hard_fault</span>(<span class="ident">ef</span>: <span class="kw-2">&</span><span class="ident">ExceptionFrame</span>) <span class="op">-></span> <span class="op">!</span> {
|
||||
<span class="comment">// prints the exception frame as a panic message</span>
|
||||
<span class="macro">panic</span><span class="macro">!</span>(<span class="string">"{:#?}"</span>, <span class="ident">ef</span>);
|
||||
}
|
||||
</pre>
|
||||
<ul>
|
||||
<li>Setting the default handler</li>
|
||||
</ul>
|
||||
|
||||
<pre class="rust rust-example-rendered">
|
||||
<span class="attribute">#[<span class="ident">macro_use</span>(<span class="ident">exception</span>)]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">cortex_m_rt</span> <span class="kw">as</span> <span class="ident">rt</span>;
|
||||
|
||||
<span class="macro">exception</span><span class="macro">!</span>(<span class="kw-2">*</span>, <span class="ident">default_handler</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">default_handler</span>(<span class="ident">irqn</span>: <span class="ident">i16</span>) {
|
||||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"IRQn = {}"</span>, <span class="ident">irqn</span>);
|
||||
}
|
||||
</pre>
|
||||
<ul>
|
||||
<li>Overriding the <code>SysTick</code> handler</li>
|
||||
</ul>
|
||||
|
||||
<pre class="rust rust-example-rendered">
|
||||
<span class="attribute">#[<span class="ident">macro_use</span>(<span class="ident">exception</span>)]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">cortex_m_rt</span> <span class="kw">as</span> <span class="ident">rt</span>;
|
||||
|
||||
<span class="macro">exception</span><span class="macro">!</span>(<span class="ident">SysTick</span>, <span class="ident">sys_tick</span>, <span class="ident">state</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="number">0</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">sys_tick</span>(<span class="ident">count</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">u32</span>) {
|
||||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"count = {}"</span>, <span class="kw-2">*</span><span class="ident">count</span>);
|
||||
|
||||
<span class="kw-2">*</span><span class="ident">count</span> <span class="op">+=</span> <span class="number">1</span>;
|
||||
}
|
||||
</pre>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/macro.pre_init!.html
Normal file
10
cortex_m_rt/macro.pre_init!.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.pre_init.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.pre_init.html">macro.pre_init.html</a>...</p>
|
||||
<script>location.replace("macro.pre_init.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
18
cortex_m_rt/macro.pre_init.html
Normal file
18
cortex_m_rt/macro.pre_init.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `pre_init` macro in crate `cortex_m_rt`."><meta name="keywords" content="rust, rustlang, rust-lang, pre_init"><title>cortex_m_rt::pre_init - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc macro"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><div class="sidebar-elems"><p class='location'><a href='index.html'>cortex_m_rt</a></p><script>window.sidebarCurrent = {name: 'pre_init', ty: 'macro', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#915-926' title='goto source code'>[src]</a></span><span class='in-band'>Macro <a href='index.html'>cortex_m_rt</a>::<wbr><a class="macro" href=''>pre_init</a></span></h1><div class="docblock type-decl"><pre class="rust macro">
|
||||
<span class="macro">macro_rules</span><span class="macro">!</span> <span class="ident">pre_init</span> {
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">handler</span>:<span class="ident">path</span>) <span class="op">=></span> { ... };
|
||||
}</pre>
|
||||
</div><div class='docblock'><p>Macro to set the function to be called at the beginning of the reset handler.</p>
|
||||
<p>The function must have the signature of <code>unsafe fn()</code>.</p>
|
||||
<p>The function passed will be called before static variables are initialized. Any access of static
|
||||
variables will result in undefined behavior.</p>
|
||||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||||
<span class="macro">pre_init</span><span class="macro">!</span>(<span class="ident">foo</span>::<span class="ident">bar</span>);
|
||||
|
||||
<span class="kw">mod</span> <span class="ident">foo</span> {
|
||||
<span class="kw">pub</span> <span class="kw">unsafe</span> <span class="kw">fn</span> <span class="ident">bar</span>() {
|
||||
<span class="comment">// do something here</span>
|
||||
}
|
||||
}</pre>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
10
cortex_m_rt/pre_init.m.html
Normal file
10
cortex_m_rt/pre_init.m.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.pre_init.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.pre_init.html">macro.pre_init.html</a>...</p>
|
||||
<script>location.replace("macro.pre_init.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
1
cortex_m_rt/sidebar-items.js
Normal file
1
cortex_m_rt/sidebar-items.js
Normal file
@@ -0,0 +1 @@
|
||||
initSidebarItems({"fn":[["heap_start","Returns a pointer to the start of the heap"]],"macro":[["entry","Macro to define the entry point of the program"],["exception","Macro to set or override a processor core exception handler"],["pre_init","Macro to set the function to be called at the beginning of the reset handler."]],"struct":[["ExceptionFrame","Registers stacked (pushed into the stack) during an exception"]]});
|
||||
68
cortex_m_rt/struct.ExceptionFrame.html
Normal file
68
cortex_m_rt/struct.ExceptionFrame.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ExceptionFrame` struct in crate `cortex_m_rt`."><meta name="keywords" content="rust, rustlang, rust-lang, ExceptionFrame"><title>cortex_m_rt::ExceptionFrame - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><p class='location'>Struct ExceptionFrame</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.r0">r0</a><a href="#structfield.r1">r1</a><a href="#structfield.r2">r2</a><a href="#structfield.r3">r3</a><a href="#structfield.r12">r12</a><a href="#structfield.lr">lr</a><a href="#structfield.pc">pc</a><a href="#structfield.xpsr">xpsr</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-TryFrom">TryFrom</a><a href="#impl-From">From</a><a href="#impl-TryInto">TryInto</a><a href="#impl-Into">Into</a><a href="#impl-Borrow">Borrow</a><a href="#impl-BorrowMut">BorrowMut</a><a href="#impl-Any">Any</a></div></div><p class='location'><a href='index.html'>cortex_m_rt</a></p><script>window.sidebarCurrent = {name: 'ExceptionFrame', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#408-432' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>cortex_m_rt</a>::<wbr><a class="struct" href=''>ExceptionFrame</a></span></h1><div class="docblock type-decl"><pre class='rust struct'><div class="docblock attributes">#[repr(C)]
|
||||
</div>pub struct ExceptionFrame {
|
||||
pub r0: u32,
|
||||
pub r1: u32,
|
||||
pub r2: u32,
|
||||
pub r3: u32,
|
||||
pub r12: u32,
|
||||
pub lr: u32,
|
||||
pub pc: u32,
|
||||
pub xpsr: u32,
|
||||
}</pre></div><div class='docblock'><p>Registers stacked (pushed into the stack) during an exception</p>
|
||||
</div><h2 id='fields' class='fields small-section-header'>
|
||||
Fields<a href='#fields' class='anchor'></a></h2><span id="structfield.r0" class="structfield small-section-header">
|
||||
<a href="#structfield.r0" class="anchor field"></a>
|
||||
<span id="r0.v" class='invisible'>
|
||||
<code>r0: u32</code>
|
||||
</span></span><div class='docblock'><p>(General purpose) Register 0</p>
|
||||
</div><span id="structfield.r1" class="structfield small-section-header">
|
||||
<a href="#structfield.r1" class="anchor field"></a>
|
||||
<span id="r1.v" class='invisible'>
|
||||
<code>r1: u32</code>
|
||||
</span></span><div class='docblock'><p>(General purpose) Register 1</p>
|
||||
</div><span id="structfield.r2" class="structfield small-section-header">
|
||||
<a href="#structfield.r2" class="anchor field"></a>
|
||||
<span id="r2.v" class='invisible'>
|
||||
<code>r2: u32</code>
|
||||
</span></span><div class='docblock'><p>(General purpose) Register 2</p>
|
||||
</div><span id="structfield.r3" class="structfield small-section-header">
|
||||
<a href="#structfield.r3" class="anchor field"></a>
|
||||
<span id="r3.v" class='invisible'>
|
||||
<code>r3: u32</code>
|
||||
</span></span><div class='docblock'><p>(General purpose) Register 3</p>
|
||||
</div><span id="structfield.r12" class="structfield small-section-header">
|
||||
<a href="#structfield.r12" class="anchor field"></a>
|
||||
<span id="r12.v" class='invisible'>
|
||||
<code>r12: u32</code>
|
||||
</span></span><div class='docblock'><p>(General purpose) Register 12</p>
|
||||
</div><span id="structfield.lr" class="structfield small-section-header">
|
||||
<a href="#structfield.lr" class="anchor field"></a>
|
||||
<span id="lr.v" class='invisible'>
|
||||
<code>lr: u32</code>
|
||||
</span></span><div class='docblock'><p>Linker Register</p>
|
||||
</div><span id="structfield.pc" class="structfield small-section-header">
|
||||
<a href="#structfield.pc" class="anchor field"></a>
|
||||
<span id="pc.v" class='invisible'>
|
||||
<code>pc: u32</code>
|
||||
</span></span><div class='docblock'><p>Program Counter</p>
|
||||
</div><span id="structfield.xpsr" class="structfield small-section-header">
|
||||
<a href="#structfield.xpsr" class="anchor field"></a>
|
||||
<span id="xpsr.v" class='invisible'>
|
||||
<code>xpsr: u32</code>
|
||||
</span></span><div class='docblock'><p>Program Status Register</p>
|
||||
</div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code><a href='#impl-Clone' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#406' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#406' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130-132' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id='impl-Copy' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code><a href='#impl-Copy' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#406' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#434-453' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/cortex_m_rt/lib.rs.html#435-452' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Send' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../cortex_m_rt/struct.ExceptionFrame.html" title="struct cortex_m_rt::ExceptionFrame">ExceptionFrame</a></code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-TryFrom' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><U>, </span></code><a href='#impl-TryFrom' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#481-487' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><span id='Error.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = !</code></span></h4>
|
||||
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>try_from</code>)</div></div><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id='method.try_from' class="method"><span id='try_from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#484-486' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>try_from</code>)</div></div><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id='impl-From' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a> for T</code><a href='#impl-From' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#462-464' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#463' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id='impl-TryInto' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#469-476' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><span id='Error.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></span></h4>
|
||||
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>try_from</code>)</div></div><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id='method.try_into' class="method"><span id='try_into.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#473-475' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>try_from</code>)</div></div><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id='impl-Into' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#453-458' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.into' class="method"><span id='into.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#455-457' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id='impl-Borrow' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219-221' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.borrow' class="method"><span id='borrow.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> &T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id='impl-BorrowMut' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#224-226' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method"><span id='borrow_mut.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> &mut T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#225' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id='impl-Any' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#114-116' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.get_type_id' class="method"><span id='get_type_id.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.get_type_id' class='fnname'>get_type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#115' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>get_type_id</code>)</summary><p>this method will likely be replaced by an associated static</p>
|
||||
</details></div></div><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.get_type_id">Read more</a></p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "cortex_m_rt";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
Reference in New Issue
Block a user