This commit is contained in:
Jorge Aparicio
2018-01-20 11:27:24 +01:00
parent d60563ff45
commit 682fe4e77c
3 changed files with 43 additions and 59 deletions

View File

@@ -5,6 +5,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
## [v0.2.3] - 2018-01-20
### Changed
- Tweaked docs. Instruction steps are now numbered.
### Removed
- The `CARGO_INCREMENTAL=1` workaround has been removed since it's now controlled via Cargo.toml and
we have the setting disabled in the template.
## [v0.2.2] - 2018-01-17 ## [v0.2.2] - 2018-01-17
### Added ### Added
@@ -110,7 +121,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Initial release - Initial release
[Unreleased]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.2...HEAD [Unreleased]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.3...HEAD
[v0.2.3]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.2...v0.2.3
[v0.2.2]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.1...v0.2.2 [v0.2.2]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.1...v0.2.2
[v0.2.1]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.0...v0.2.1 [v0.2.1]: https://github.com/japaric/cortex-m-quickstart/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.8...v0.2.0 [v0.2.0]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.8...v0.2.0

View File

@@ -6,7 +6,7 @@ keywords = ["arm", "cortex-m", "template"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
name = "cortex-m-quickstart" name = "cortex-m-quickstart"
repository = "https://github.com/japaric/cortex-m-quickstart" repository = "https://github.com/japaric/cortex-m-quickstart"
version = "0.2.2" version = "0.2.3"
[dependencies] [dependencies]
cortex-m = "0.3.0" cortex-m = "0.3.0"

View File

@@ -3,22 +3,22 @@
//! # Dependencies //! # Dependencies
//! //!
//! - Nightly Rust toolchain: `rustup default nightly` //! - Nightly Rust toolchain: `rustup default nightly`
//! - ARM linker: `sudo apt-get install binutils-arm-none-eabi` //! - ARM linker: `sudo apt-get install binutils-arm-none-eabi` (on Ubuntu)
//! - Cargo `clone` subcommand: `cargo install cargo-clone` //! - Cargo `clone` subcommand: `cargo install cargo-clone`
//! - GDB: `sudo apt-get install gdb-arm-none-eabi` //! - GDB: `sudo apt-get install gdb-arm-none-eabi` (on Ubuntu)
//! - OpenOCD: `sudo apt-get install OpenOCD` //! - OpenOCD: `sudo apt-get install OpenOCD` (on Ubuntu)
//! - Xargo: `cargo install xargo` //! - Xargo: `cargo install xargo`
//! - [Optional] Cargo `add` subcommand: `cargo install cargo-edit` //! - [Optional] Cargo `add` subcommand: `cargo install cargo-edit`
//! //!
//! # Usage //! # Usage
//! //!
//! - Clone this crate //! 1) Clone this crate
//! //!
//! ``` text //! ``` text
//! $ cargo clone cortex-m-quickstart && cd $_ //! $ cargo clone cortex-m-quickstart && cd $_
//! ``` //! ```
//! //!
//! - Change the crate name, author and version //! 2) Change the crate name, author and version
//! //!
//! ``` text //! ``` text
//! $ edit Cargo.toml && head $_ //! $ edit Cargo.toml && head $_
@@ -28,11 +28,11 @@
//! version = "0.1.0" //! version = "0.1.0"
//! ``` //! ```
//! //!
//! - Specify the memory layout of the target device //! 3) Specify the memory layout of the target device
//! //!
//! (Note that some board support crates may provide this file for you (check //! **NOTE** board support crates sometimes provide this file for you (check the crate
//! the crate documentation). If you are using one that does that then remove //! documentation). If you are using one that does then remove *both* the `memory.x` and `build.rs`
//! *both* the `memory.x` and `build.rs` files.) //! files.
//! //!
//! ``` text //! ``` text
//! $ edit memory.x && cat $_ //! $ edit memory.x && cat $_
@@ -44,7 +44,7 @@
//! } //! }
//! ``` //! ```
//! //!
//! - Optionally, set a default build target //! 4) Optionally, set a default build target
//! //!
//! ``` text //! ``` text
//! $ cat >>.cargo/config <<'EOF' //! $ cat >>.cargo/config <<'EOF'
@@ -53,35 +53,32 @@
//! EOF //! EOF
//! ``` //! ```
//! //!
//! - Very likely, depend on a device or a BSP (Board Support Package) crate. //! 5) Depend on a device, HAL implementation or a board support crate.
//! //!
//! ``` text //! ``` text
//! # add a device crate, or //! $ # add a device crate, OR
//! $ cargo add stm32f103xx //! $ cargo add stm32f30x
//! //!
//! # add a board support crate //! $ # add a HAL implementation crate, OR
//! $ cargo add blue-pill --git https://github.com/japaric/blue-pill //! $ cargo add stm32f103xx-hal
//!
//! $ # add a board support crate
//! $ cargo add f3
//! ``` //! ```
//! //!
//! - Write the application or start from one of the examples //! 6) Write the application or start from one of the examples
//! //!
//! ``` text //! ``` text
//! $ rm -r src/* && cp examples/hello.rs src/main.rs //! $ rm -r src/* && cp examples/hello.rs src/main.rs
//! ``` //! ```
//! //!
//! - Disable incremental compilation. It doesn't work for embedded development. //! 7) Build the application
//! You'll hit nonsensical linker errors if you use it.
//! //!
//! ``` text //! ``` text
//! $ unset CARGO_INCREMENTAL //! $ # NOTE this command requires `arm-none-eabi-ld` to be in $PATH
//! ```
//!
//! - Build the application
//!
//! ``` text
//! # NOTE this command requires `arm-none-eabi-ld` to be in $PATH
//! $ xargo build --release //! $ xargo build --release
//! //!
//! $ # sanity check
//! $ arm-none-eabi-readelf -A target/thumbv7em-none-eabihf/release/demo //! $ arm-none-eabi-readelf -A target/thumbv7em-none-eabihf/release/demo
//! Attribute Section: aeabi //! Attribute Section: aeabi
//! File Attributes //! File Attributes
@@ -104,22 +101,21 @@
//! Tag_ABI_FP_16bit_format: IEEE 754 //! Tag_ABI_FP_16bit_format: IEEE 754
//! ``` //! ```
//! //!
//! - Flash the program //! 8) Flash the program
//! //!
//! ``` text //! ``` text
//! # Launch OpenOCD on a terminal //! $ # Launch OpenOCD on a terminal
//! $ openocd -f (..) //! $ openocd -f (..)
//! ``` //! ```
//! //!
//! ``` text //! ``` text
//! # Start a debug session in another terminal //! $ # Start a debug session in another terminal
//! $ arm-none-eabi-gdb target/.. //! $ arm-none-eabi-gdb target/thumbv7em-none-eabihf/release/demo
//! ``` //! ```
//! //!
//! **NOTE** As of nightly-2017-05-14 or so and cortex-m-quickstart v0.1.6 you //! **NOTE** As of nightly-2017-05-14 or so and cortex-m-quickstart v0.1.6 you can simply run `xargo
//! can simply run `cargo run` or `cargo run --example $example` to build the //! run` or `xargo run --example $example` to build the program, *and* immediately start a debug
//! program, and immediately start a debug session. IOW, it lets you omit the //! session. IOW, it lets you omit the `arm-none-eabi-gdb` command.
//! `arm-none-eabi-gdb` command.
//! //!
//! ``` text //! ``` text
//! $ cargo run --example hello //! $ cargo run --example hello
@@ -262,30 +258,6 @@
//! //!
//! Solution: Switch to the nightly toolchain with `rustup default nightly`. //! Solution: Switch to the nightly toolchain with `rustup default nightly`.
//! //!
//! ## Used `CARGO_INCREMENTAL=1`
//!
//! Error message:
//!
//! ``` text
//! $ xargo build
//! error: linking with `arm-none-eabi-ld` failed: exit code: 1
//! |
//! = note: "arm-none-eabi-ld" (..)
//! = note: arm-none-eabi-ld:
//! You must specify the exception handlers.
//! Create a non `pub` static variable with type
//! `cortex_m::exception::Handlers` and place it in the
//! '.rodata.exceptions' section. (cf. #[link_section]). Apply the
//! `#[used]` attribute to the variable to make it reach the linker.
//! arm-none-eabi-ld:
//! Invalid '.rodata.exceptions' section.
//! Make sure to place a static with type `cortex_m::exception::Handlers`
//! in that section (cf. #[link_section]) ONLY ONCE.
//! ```
//!
//! Solution: `$ unset CARGO_INCREMENAL`. And to be on the safe side, call
//! `cargo clean` and thrash the Xargo sysroot: `$ rm -rf ~/.xargo`
//!
//! ## Used `gdb` instead of `arm-none-eabi-gdb` //! ## Used `gdb` instead of `arm-none-eabi-gdb`
//! //!
//! Error message: //! Error message: