Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit cb039c1

Browse files
author
Jorge Aparicio
committed
add documentation
1 parent 2461266 commit cb039c1

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
[package]
2+
authors = ["Jorge Aparicio <[email protected]>"]
3+
description = "Minimal runtime / startup for Cortex-M microcontrollers"
4+
documentation = "https://docs.rs/cortex-m-rt"
5+
keywords = ["arm", "cortex-m", "runtime", "startup"]
6+
license = "MIT OR Apache-2.0"
27
name = "cortex-m-rt"
8+
repository = "https://github.com/japaric/cortex-m-rt"
39
version = "0.1.0"
4-
authors = ["Jorge Aparicio <[email protected]>"]
510

611
[dependencies]
712
r0 = "0.2.1"
813

914
[dependencies.cortex-m]
1015
optional = true
11-
version = "0.2.2"
16+
version = "0.2.3"
1217

1318
[dependencies.cortex-m-semihosting]
1419
optional = true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `cortex-m-rt`
22

3-
> Minimal startup / runtime for Cortex-M microcontrollers
3+
> Minimal runtime / startup for Cortex-M microcontrollers
44
55
# License
66

src/lib.rs

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,46 @@
44
//!
55
//! - Before main initialization of the `.bss` and `.data` sections
66
//!
7-
//! - An overridable (\*) `panic_fmt` implementation that prints overs the ITM
8-
//! or through semihosting depending on the enabled Cargo feature.
7+
//! - An overridable (\*) `panic_fmt` implementation that prints to the ITM or
8+
//! to the host stdout (through semihosting) depending on which Cargo feature
9+
//! has been enabled: `"panic-over-itm"` or `"panic-over-semihosting"`.
910
//!
10-
//! - Minimal `start` lang item, to support vanilla `fn main()`. NOTE the
11+
//! - A minimal `start` lang item, to support vanilla `fn main()`. NOTE the
1112
//! processor goes into "reactive" mode (`loop { asm!("wfi") }`) after
1213
//! returning from `main`.
1314
//!
15+
//! - An opt-in linker script (`"linker-script"` Cargo feature) that encodes
16+
//! the memory layout of a generic Cortex-M microcontroller. This linker
17+
//! script is missing the definition of the FLASH and RAM memory regions of
18+
//! the device. This missing information must be supplied through a `memory.x`
19+
//! linker script of the form:
20+
//!
21+
//! ``` text
22+
//! MEMORY
23+
//! {
24+
//! FLASH : ORIGIN = 0x08000000, LENGTH = 128K
25+
//! RAM : ORIGIN = 0x20000000, LENGTH = 8K
26+
//! }
27+
//! ```
28+
//!
29+
//! - A default exception handler tailored for debugging and that provides
30+
//! access to the stacked registers under the debugger. By default, all
31+
//! exceptions (\*\*) are serviced by this handler but this can be overridden
32+
//! on a per exception basis by opting out of the "exceptions" Cargo feature
33+
//! and then defining the following `struct`
34+
//!
35+
//! ``` ignore,no_run
36+
//! use cortex_m::exception;
37+
//!
38+
//! #[link_section = ".rodata.exceptions"]
39+
//! #[used]
40+
//! static EXCEPTIONS: exception::Handlers = exception::Handlers {
41+
//! hard_fault: my_override,
42+
//! nmi: another_handler,
43+
//! ..exception::DEFAULT_HANDLERS
44+
//! };
45+
//! ````
46+
//!
1447
//! (\*) To override the `panic_fmt` implementation, simply create a new
1548
//! `rust_begin_unwind` symbol:
1649
//!
@@ -24,6 +57,16 @@
2457
//! ..
2558
//! }
2659
//! ```
60+
//!
61+
//! (\*\*) All the device specific exceptions, i.e. the interrupts, are left
62+
//! unpopulated. You must fill that part of the vector table by defining the
63+
//! following static (with the right memory layout):
64+
//!
65+
//! ``` ignore,no_run
66+
//! #[link_section = ".rodata.interrupts"]
67+
//! #[used]
68+
//! static INTERRUPTS: SomeStruct = SomeStruct { .. }
69+
//! ```
2770
2871
#![deny(missing_docs)]
2972
#![deny(warnings)]

0 commit comments

Comments
 (0)