Skip to content
Snippets Groups Projects
Commit bb24706a authored by DevDoggo's avatar DevDoggo
Browse files

Done

parent 141f9791
No related branches found
No related tags found
No related merge requests found
...@@ -7,4 +7,5 @@ ...@@ -7,4 +7,5 @@
#cargo build --target thumbv7em-none-eabihf --release --example bare2 #cargo build --target thumbv7em-none-eabihf --release --example bare2
#cargo build --target thumbv7em-none-eabihf --example bare3 #cargo build --target thumbv7em-none-eabihf --example bare3
#cargo build --target thumbv7em-none-eabihf --example bare4 #cargo build --target thumbv7em-none-eabihf --example bare4
cargo build --target thumbv7em-none-eabihf --example bare5 #cargo build --target thumbv7em-none-eabihf --example bare5
cargo build --target thumbv7em-none-eabihf --example bare6
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
extern crate f4; extern crate f4;
extern crate stm32f40x; extern crate stm32f40x;
extern crate cortex_m;
#[macro_use] #[macro_use]
extern crate cortex_m_debug; extern crate cortex_m_debug;
...@@ -76,7 +77,11 @@ fn idle(dwt: &mut DWT, rcc: &mut RCC, gpioa: &mut GPIOA) { ...@@ -76,7 +77,11 @@ fn idle(dwt: &mut DWT, rcc: &mut RCC, gpioa: &mut GPIOA) {
// at 16 Mhz, 8000_0000 cycles = 0.5s // at 16 Mhz, 8000_0000 cycles = 0.5s
// at 64 Mhz, 8000_0000 cycles = 0.125s // at 64 Mhz, 8000_0000 cycles = 0.125s
unsafe {
(*DWT.get()).cyccnt.write(0);
}
loop { loop {
ipln!("led on"); ipln!("led on");
// set PA5 high, RM0368 8.4.7 // set PA5 high, RM0368 8.4.7
gpioa.bsrr.write(|w| w.bs5().set_bit()); gpioa.bsrr.write(|w| w.bs5().set_bit());
...@@ -100,6 +105,10 @@ fn idle(dwt: &mut DWT, rcc: &mut RCC, gpioa: &mut GPIOA) { ...@@ -100,6 +105,10 @@ fn idle(dwt: &mut DWT, rcc: &mut RCC, gpioa: &mut GPIOA) {
// vscode using the new "cortex debug" plugin // vscode using the new "cortex debug" plugin
// //
// what is the frequency of blinking // what is the frequency of blinking
//
// >> Given that at 16Mhz, 8000_000 cycles = 0.5s,
// and we need to go 2*8000_000 cycles for the next light on,
// we're about ~1Hz on the blinking, just slightly above.
// ** your answer here ** // ** your answer here **
// //
// commit your answers (bare6_1) // commit your answers (bare6_1)
......
...@@ -8,4 +8,4 @@ TARGET=thumbv7em-none-eabihf ...@@ -8,4 +8,4 @@ TARGET=thumbv7em-none-eabihf
#arm-none-eabi-gdb target/$TARGET/release/examples/bare2 #arm-none-eabi-gdb target/$TARGET/release/examples/bare2
#arm-none-eabi-gdb target/$TARGET/debug/examples/bare3 #arm-none-eabi-gdb target/$TARGET/debug/examples/bare3
#arm-none-eabi-gdb target/$TARGET/debug/examples/bare4 #arm-none-eabi-gdb target/$TARGET/debug/examples/bare4
arm-none-eabi-gdb target/$TARGET/debug/examples/bare5 arm-none-eabi-gdb target/$TARGET/debug/examples/bare6
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment