Select Git revision
bare1.rs 2.60 KiB
//! bare1.rs
//! Simple bare metal tracing
// feature to ensure symbols to be linked
#![feature(used)]
// build without the Rust standard library
#![no_std]
// API to the ARM Cortex M Peripherals
extern crate cortex_m;
// Minimal runtime / startup for Cortex-M microcontrollers
extern crate cortex_m_rt;
// Convenient tracing over semihosting and ITM
#[macro_use]
extern crate cortex_m_debug;
#[inline(never)]
fn main() {
// ITM trace (fast)
// start `itmdump` before `openocd`
ipln!("ITM: Hello World");
// semihosting trace (slow)
sprintln!("SEMIHOSTING: Hello World");
// to prevent returning
loop {
// cortex_m::asm::nop();
// cortex_m::asm::bkpt();
}
}
// 1. build and run the application
// start ITM tracing to console
// > itmdump /tmp/itm.log
// start openocd (in my case...)
// > openocd -f interface/stlink.cfg -f target/stm32f4x.cfg
//
// when debugging the application it should get stuck in the
// loop, (press pause/suspend to verify this).
// what is the output in the ITM console
// ** your answer here **
//
// what is the output in the semihosting (openocd) console
// ** your answer here **
//
// commit your answers (bare1_1)
//
// 2. inspecting the assembly
// what is shown in the Dissasmbly view, what instruction is executing
// (if you are NOT under eclipse, then give the command in gdb console
// (gdb) disassemble
// ** your answer here **
//
// commit your answers (bare1_2)
//
// 3. now remove the comment line 30.
// rebuild and debug, pause the program.
// what is shown in the Dissasmbly view, what instruction is executing
// ** your answer here **
//
// commit your answers (bare1_3)
//
// 4. now remeve the comment line 31
// what is shown in the Dissasmbly view, what instruction is executing
// ** your answer here **
//
// commit your answers (bare1_4)