Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e44d099bd | ||
|
|
22d921658e | ||
|
|
7260cd522c | ||
|
|
5390231c1e | ||
|
|
9669b788d1 | ||
|
|
7fa559eeab | ||
|
|
ef2cd39453 | ||
|
|
322c9e5341 | ||
|
|
365195df70 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -5,8 +5,35 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## v0.1.3 - 2017-05-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A troubleshooting section to the documentation
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Bumped the cortex-m crate version to v0.2.6
|
||||||
|
|
||||||
|
## v0.1.2 - 2017-05-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- .gdbinit: jump to reset handler after loading the program.
|
||||||
|
|
||||||
|
## v0.1.1 - 2017-04-27
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Bumped the version of the `cortex-m-rt` dependency to v0.2.0. NOTE that the
|
||||||
|
instantiation steps have slightly changed, the `memory.x` file changed,
|
||||||
|
because of this.
|
||||||
|
|
||||||
## v0.1.0 - 2017-04-25
|
## v0.1.0 - 2017-04-25
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
[Unreleased]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.0...HEAD
|
[Unreleased]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.3...HEAD
|
||||||
|
[v0.1.3]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.2...v0.1.3
|
||||||
|
[v0.1.2]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.1...v0.1.2
|
||||||
|
[v0.1.1]: https://github.com/japaric/cortex-m-quickstart/compare/v0.1.0...v0.1.1
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
authors = ["Jorge Aparicio <jorge@japaric.io>"]
|
authors = ["Jorge Aparicio <jorge@japaric.io>"]
|
||||||
|
categories = ["embedded", "no-std"]
|
||||||
description = "A template for building applications for ARM Cortex-M microcontrollers"
|
description = "A template for building applications for ARM Cortex-M microcontrollers"
|
||||||
keywords = ["arm", "cortex-m", "template"]
|
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.1.0"
|
version = "0.1.3"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.2.4"
|
cortex-m = "0.2.6"
|
||||||
cortex-m-rt = "0.1.3"
|
cortex-m-rt = "0.2.0"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
debug = true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
//! $2 = cortex_m::exception::Exception::HardFault
|
//! $2 = cortex_m::exception::Exception::HardFault
|
||||||
//!
|
//!
|
||||||
//! (gdb) # Where did we come from?
|
//! (gdb) # Where did we come from?
|
||||||
//! (gdb) print _e
|
//! (gdb) backtrace
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![feature(used)]
|
#![feature(used)]
|
||||||
|
|||||||
6
memory.x
6
memory.x
@@ -1,6 +1,12 @@
|
|||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/* NOTE K = KiBi = 1024 bytes */
|
/* NOTE K = KiBi = 1024 bytes */
|
||||||
|
/* TODO Adjust these memory regions to match your device memory layout */
|
||||||
FLASH : ORIGIN = 0xBAAAAAAD, LENGTH = 0K
|
FLASH : ORIGIN = 0xBAAAAAAD, LENGTH = 0K
|
||||||
RAM : ORIGIN = 0xBAAAAAAD, LENGTH = 0K
|
RAM : ORIGIN = 0xBAAAAAAD, LENGTH = 0K
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is where the call stack will be allocated. */
|
||||||
|
/* The stack is of the full descending type. */
|
||||||
|
/* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
|
||||||
|
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|||||||
138
src/lib.rs
138
src/lib.rs
@@ -20,6 +20,10 @@
|
|||||||
//!
|
//!
|
||||||
//! - Specify the memory layout of the target device
|
//! - Specify the memory layout of the target device
|
||||||
//!
|
//!
|
||||||
|
//! (Note that some board support crates may provide this file for you (check
|
||||||
|
//! the crate documentation). If you are using one that does that then remove
|
||||||
|
//! *both* the `memory.x` and `build.rs` files.)
|
||||||
|
//!
|
||||||
//! ``` text
|
//! ``` text
|
||||||
//! $ edit memory.x && cat $_
|
//! $ edit memory.x && cat $_
|
||||||
//! MEMORY
|
//! MEMORY
|
||||||
@@ -28,6 +32,11 @@
|
|||||||
//! FLASH : ORIGIN = 0x08000000, LENGTH = 256K
|
//! FLASH : ORIGIN = 0x08000000, LENGTH = 256K
|
||||||
//! RAM : ORIGIN = 0x20000000, LENGTH = 40K
|
//! RAM : ORIGIN = 0x20000000, LENGTH = 40K
|
||||||
//! }
|
//! }
|
||||||
|
//!
|
||||||
|
//! /* This is where the call stack will be allocated. */
|
||||||
|
//! /* The stack is of the full descending type. */
|
||||||
|
//! /* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
|
||||||
|
//! _stack_start = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! - Optionally, set a default build target
|
//! - Optionally, set a default build target
|
||||||
@@ -45,7 +54,7 @@
|
|||||||
//! # add a device crate, or
|
//! # add a device crate, or
|
||||||
//! $ cargo add stm32f30x
|
//! $ cargo add stm32f30x
|
||||||
//!
|
//!
|
||||||
//! # add a BSP crate
|
//! # add a board support crate
|
||||||
//! $ cargo add f3
|
//! $ cargo add f3
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
@@ -86,9 +95,136 @@
|
|||||||
//! Tag_ABI_FP_16bit_format: IEEE 754
|
//! Tag_ABI_FP_16bit_format: IEEE 754
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! - Flash the program
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! # Launch OpenOCD on a terminal
|
||||||
|
//! $ openocd -f (..)
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! # Start debug session
|
||||||
|
//! $ arm-none-eabi-gdb target/..
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
//! Check the [examples module](./examples/index.html)
|
//! Check the [examples module](./examples/index.html)
|
||||||
|
//!
|
||||||
|
//! # Troubleshooting
|
||||||
|
//!
|
||||||
|
//! This section contains fixes for common errors encountered when the
|
||||||
|
//! `cortex-m-quickstart` template is misused.
|
||||||
|
//!
|
||||||
|
//! ## Forgot to launch an OpenOCD instance
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ arm-none-eabi-gdb target/..
|
||||||
|
//! Reading symbols from hello...done.
|
||||||
|
//! .gdbinit:1: Error in sourced command file:
|
||||||
|
//! :3333: Connection timed out.
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Solution: Launch OpenOCD on other terminal. See [Usage] section.
|
||||||
|
//!
|
||||||
|
//! [Usage]: ./index.html#usage
|
||||||
|
//!
|
||||||
|
//! ## Didn't modify the `memory.x` linker script
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ xargo build
|
||||||
|
//! Compiling demo v0.1.0 (file:///home/japaric/tmp/demo)
|
||||||
|
//! error: linking with `arm-none-eabi-ld` failed: exit code: 1
|
||||||
|
//! |
|
||||||
|
//! = note: "arm-none-eabi-ld" "-L" (..)
|
||||||
|
//! = note: arm-none-eabi-ld: address 0xbaaab838 of hello section `.text' is ..
|
||||||
|
//! arm-none-eabi-ld: address 0xbaaab838 of hello section `.text' is ..
|
||||||
|
//! 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: Specify your device memory layout in the `memory.x` linker script.
|
||||||
|
//! See [Usage] section.
|
||||||
|
//!
|
||||||
|
//! ## Forgot to set a default build target
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ xargo build
|
||||||
|
//! (..)
|
||||||
|
//! Compiling cortex-m-semihosting v0.1.3
|
||||||
|
//! error[E0463]: can't find crate for `std`
|
||||||
|
//!
|
||||||
|
//! error: aborting due to previous error
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Solution: Set a default build target in the `.cargo/config` file
|
||||||
|
//! (see [Usage] section), or call Xargo with `--target` flag:
|
||||||
|
//! `xargo build --target thumbv7em-none-eabi`.
|
||||||
|
//!
|
||||||
|
//! ## Called OpenOCD with wrong arguments
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ openocd -f ..
|
||||||
|
//! (..)
|
||||||
|
//! Error: open failed
|
||||||
|
//! in procedure 'init'
|
||||||
|
//! in procedure 'ocd_bouncer'
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Solution: Correct the OpenOCD arguments. Check the
|
||||||
|
//! `/usr/share/openocd/scripts` directory (exact location varies per
|
||||||
|
//! distribution / OS) for a list of scripts that can be used.
|
||||||
|
//!
|
||||||
|
//! ## Used Cargo instead of Xargo
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ cargo build
|
||||||
|
//! Compiling cortex-m-rt v0.2.0
|
||||||
|
//! error[E0463]: can't find crate for `core`
|
||||||
|
//! |
|
||||||
|
//! = note: the `thumbv7em-none-eabihf` target may not be installed
|
||||||
|
//!
|
||||||
|
//! error: aborting due to previous error
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Solution: Use `xargo build`.
|
||||||
|
//!
|
||||||
|
//! ## Used `gdb` instead of `arm-none-eabi-gdb`
|
||||||
|
//!
|
||||||
|
//! Error message:
|
||||||
|
//!
|
||||||
|
//! ``` text
|
||||||
|
//! $ gdb target/..
|
||||||
|
//! Reading symbols from hello...done.
|
||||||
|
//! warning: Architecture rejected target-supplied description
|
||||||
|
//! warning: Cannot convert floating-point register value to ..
|
||||||
|
//! value has been optimized out
|
||||||
|
//! Cannot write the dashboard
|
||||||
|
//! Traceback (most recent call last):
|
||||||
|
//! File "<string>", line 353, in render
|
||||||
|
//! File "<string>", line 846, in lines
|
||||||
|
//! gdb.error: Frame is invalid.
|
||||||
|
//! 0x00000000 in ?? ()
|
||||||
|
//! semihosting is enabled
|
||||||
|
//! Loading section .text, size 0xd88 lma 0x8000000
|
||||||
|
//! Start address 0x8000000, load size 3464
|
||||||
|
//! .gdbinit:6: Error in sourced command file:
|
||||||
|
//! Remote connection closed
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Solution: Use `arm-none-eabi-gdb target/..`
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user