4 files + 142 − 36 Side-by-side Compare changes Side-by-side Inline Show whitespace changes Files 4 .vscode/launch.json +27 −10 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "version": "0.2.0", "configurations": [ "configurations": [ // Launch configuration for `app` // Launch configuration for `app` // - debug // - debug // - semihosting // - semihosting Loading @@ -16,8 +17,28 @@ "preLaunchTask": "cargo build", "preLaunchTask": "cargo build", "executable": "./target/thumbv7em-none-eabihf/debug/app", "executable": "./target/thumbv7em-none-eabihf/debug/app", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" ], "postLaunchCommands": [ "monitor arm semihosting enable" ], "runToMain": true, "cwd": "${workspaceRoot}" }, // Launch configuration for `app` // - debug // - semihosting // - run to main { "type": "cortex-debug", "request": "launch", "servertype": "openocd", "name": "examples (debug)", "preLaunchTask": "cargo build --examples", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "interface/stlink-v2-1.cfg", "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading @@ -39,8 +60,7 @@ "preLaunchTask": "cargo build --example", "preLaunchTask": "cargo build --example", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading Loading @@ -75,8 +95,7 @@ "preLaunchTask": "cargo build --example", "preLaunchTask": "cargo build --example", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading Loading @@ -150,8 +169,7 @@ "preLaunchTask": "cargo build --example --release", "preLaunchTask": "cargo build --example --release", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading @@ -175,8 +193,7 @@ "preLaunchTask": "cargo build --example --release --features stm32f4", "preLaunchTask": "cargo build --example --release --features stm32f4", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading examples/bare0.rs +49 −13 Original line number Original line Diff line number Diff line Loading @@ -22,25 +22,49 @@ use panic_semihosting as _; use cortex_m_rt::entry; use cortex_m_rt::entry; // a constant (cannot be changed at run-time) // a constant (cannot be changed at run-time) const X_INIT: u32 = 10; const X_INIT: u32 = core::u32::MAX; // const X_INIT: u32 = core::u32::MAX; // global mutable variables (changed using unsafe code) // global mutable variables (changed using unsafe code) static mut X: u32 = X_INIT; static mut X: u32 = X_INIT; static mut Y: u32 = 0; static mut Y: u32 = 0; fn write_x(x: u32, i: u32) { unsafe{ X = x.wrapping_add(i); } } fn write_y(y: u32) { unsafe{ Y = y; } } fn read_y() -> u32 { unsafe{ Y } } fn read_x() -> u32 { unsafe{ X } } #[entry] #[entry] fn main() -> ! { fn main() -> ! { // local mutable variable (changed in safe code) // local mutable variable (changed in safe code) let mut x = unsafe { X }; let mut x = read_x(); loop { loop { x += 1; // <- place breakpoint here (3) x = x.wrapping_add(1); // <- place breakpoint here (3) unsafe { X += 1; write_x(read_x(), 1); Y = X; write_y(read_x()); assert!(x == X && X == Y); assert!(x == read_x() && read_x() == read_y()); } } } } } Loading @@ -56,12 +80,14 @@ fn main() -> ! { // // // Look under Variables/Local what do you find. // Look under Variables/Local what do you find. // // // ** your answer here ** // x: 9389056 // // // In the Expressions (WATCH -vscode) view add X and Y // In the Expressions (WATCH -vscode) view add X and Y // what do you find // what do you find // // // ** your answer here ** // ** your answer here ** // X: 9389055 // Y: <optimized out> // // // Step through one complete iteration of the loop // Step through one complete iteration of the loop // and see how the (Local) Variables are updated // and see how the (Local) Variables are updated Loading @@ -69,6 +95,10 @@ fn main() -> ! { // // // ** place your answer here ** // ** place your answer here ** // // // x will update to 9389057 // eventually x will overflow and if rust runs in debug mode then rust will panic and // if it runs in release mode rust wont check for the overflow and just do a wrap the value // // Commit your answers (bare0_1) // Commit your answers (bare0_1) // // // 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap. // 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap. Loading @@ -76,6 +106,8 @@ fn main() -> ! { // (Hint, look under OUTPUT/Adopter Output to see the `openocd` output.) // (Hint, look under OUTPUT/Adopter Output to see the `openocd` output.) // // // ** your answer here ** // ** your answer here ** // The program panics // panicked at 'attempt to add with overflow', examples/bare0.rs:42:9 // // // Commit your answers (bare0_2) // Commit your answers (bare0_2) // // Loading @@ -84,10 +116,12 @@ fn main() -> ! { // Change (both) += operations to use wrapping_add // Change (both) += operations to use wrapping_add // load and run the program, what happens // load and run the program, what happens // ** your answer here ** // ** your answer here ** // // x wrapps around and become 0 // X does nothing // Now continue execution, what happens // Now continue execution, what happens // ** your answer here ** // ** your answer here ** // // x continues to add up // X still does nothing // Commit your answers (bare0_3) // Commit your answers (bare0_3) // // // (If the program did not succeed back to the breakpoint // (If the program did not succeed back to the breakpoint Loading @@ -96,6 +130,8 @@ fn main() -> ! { // 4. Change the assertion to `assert!(x == X && X == Y + 1)`, what happens? // 4. Change the assertion to `assert!(x == X && X == Y + 1)`, what happens? // // // ** place your answer here ** // ** place your answer here ** // panic because the assertion fails // panicked at 'assertion failed: x == X && X == Y + 1', examples/bare0.rs:46:13 // // // Commit your answers (bare0_4) // Commit your answers (bare0_4) // // Loading examples/bare1.rs +64 −10 Original line number Original line Diff line number Diff line Loading @@ -59,10 +59,16 @@ fn main() -> ! { // (passing 3 breakpoints) // (passing 3 breakpoints) // // // ** your answer here ** // ** your answer here ** // The program hits the first breakpoint again with a callstack // with a lot of elements in the callstack pointing to 0x08000424 // local x variable contains various values // // // What is the `ITM` output. // What is the `ITM` output. // // // ** your answer here ** // Program // received signal SIGTRAP, Trace/breakpoint trap. // bare1::__cortex_m_rt_main () at examples/bare1.rs:22 // 22 cortex_m::asm::bkpt(); // // // Commit your answer (bare1_1) // Commit your answer (bare1_1) // // Loading @@ -74,16 +80,42 @@ fn main() -> ! { // What is the output of: // What is the output of: // > disassemble // > disassemble // // // ** your answer here ** // Please check OUTPUT tab (Adapter Output) for output from openocd // disassemble // Dump of assembler code for function bare1::__cortex_m_rt_main: // 0x0800040a <+0>: sub sp, #8 // 0x0800040c <+2>: mvn.w r0, #1 // 0x08000410 <+6>: str r0, [sp, #4] // 0x08000412 <+8>: bkpt 0x0000 // 0x08000414 <+10>: mov.w r0, #4294967295 ; 0xffffffff // 0x08000418 <+14>: add r4, sp, #4 // 0x0800041a <+16>: str r0, [sp, #4] // 0x0800041c <+18>: bkpt 0x0000 // 0x0800041e <+20>: mov r0, r4 // 0x08000420 <+22>: bl 0x8000400 <core::ptr::read_volatile> // => 0x08000424 <+26>: bkpt 0x0000 // 0x08000426 <+28>: ldr r0, [sp, #4] // 0x08000428 <+30>: adds r0, #1 // 0x0800042a <+32>: bcc.n 0x800041a <bare1::__cortex_m_rt_main+16> // 0x0800042c <+34>: movw r0, #5984 ; 0x1760 // 0x08000430 <+38>: movt r0, #2048 ; 0x800 // 0x08000434 <+42>: movw r2, #5956 ; 0x1744 // 0x08000438 <+46>: movt r2, #2048 ; 0x800 // 0x0800043c <+50>: movs r1, #28 // 0x0800043e <+52>: bl 0x800053a <core::panicking::panic> // 0x08000442 <+56>: udf #254 ; 0xfe // End of assembler dump. // // // How many instructions are in between the two `bkpt` instructions in the loop. // How many instructions are in between the two `bkpt` instructions in the loop. // Notice, the generated code may not be exactly what you expect :) // Notice, the generated code may not be exactly what you expect :) // // // ** your answer here ** // THere are 6 instrucations inbetween // // // Which instruction stores the local variable on the stack. // Which instruction stores the local variable on the stack. // // // ** your answer here ** // 0x0800041a <+16>: str r0, [sp, #4] // // // Commit your answers (bare1_2) // Commit your answers (bare1_2) // // Loading @@ -99,15 +131,25 @@ fn main() -> ! { // What is the output of: // What is the output of: // > disassemble // > disassemble // // // ** your answer here ** // Dump of assembler code for function bare1::__cortex_m_rt_main: // 0x08000406 <+0>: sub sp, #4 // 0x08000408 <+2>: mvn.w r0, #1 // 0x0800040c <+6>: str r0, [sp, #0] // 0x0800040e <+8>: adds r0, #1 // 0x08000410 <+10>: bkpt 0x0000 // 0x08000412 <+12>: str r0, [sp, #0] // => 0x08000414 <+14>: bkpt 0x0000 // 0x08000416 <+16>: ldr r0, [sp, #0] // 0x08000418 <+18>: b.n 0x800040e <bare1::__cortex_m_rt_main+8> // End of assembler dump. // // // How many instructions are in between the two `bkpt` instructions. // How many instructions are in between the two `bkpt` instructions. // // // ** your answer here ** // 1 // // // Where is the local variable stored? // Where is the local variable stored? // // // ** your answer here ** // 0x08000412 <+12>: str r0, [sp, #0] // // // Is there now any reference to the panic handler? // Is there now any reference to the panic handler? // If not, why is that the case? // If not, why is that the case? Loading Loading @@ -172,9 +214,21 @@ fn main() -> ! { // // // What is now the disassembly of the loop (in debug/dev mode): // What is now the disassembly of the loop (in debug/dev mode): // // // ** your answer here ** // Dump of assembler code for function bare1::__cortex_m_rt_main: // // 0x0800040a <+0>: sub sp, #8 // commit your answers (bare1_5) // 0x0800040c <+2>: mvn.w r0, #1 // 0x08000410 <+6>: str r0, [sp, #4] // 0x08000412 <+8>: add r4, sp, #4 // 0x08000414 <+10>: bkpt 0x0000 // 0x08000416 <+12>: ldr r0, [sp, #4] // 0x08000418 <+14>: adds r0, #1 // 0x0800041a <+16>: str r0, [sp, #4] // => 0x0800041c <+18>: bkpt 0x0000 // 0x0800041e <+20>: mov r0, r4 // 0x08000420 <+22>: bl 0x8000400 <core::ptr::read_volatile> // 0x08000424 <+26>: b.n 0x8000414 <bare1::__cortex_m_rt_main+10> // End of assembler dump. // commit your answers (bare1_4) // // // Now restore the `.cargo/config` to its original state. // Now restore the `.cargo/config` to its original state. // // Loading openocd.cfg +2 −3 Original line number Original line Diff line number Diff line source [find interface/stlink.cfg] source [find interface/stlink-v2-1.cfg] # deprecated # source [find interface/stlink-v2-1.cfg] transport select hla_swd transport select hla_swd # increase working area to 64KB # increase working area to 64KB Loading
.vscode/launch.json +27 −10 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "version": "0.2.0", "configurations": [ "configurations": [ // Launch configuration for `app` // Launch configuration for `app` // - debug // - debug // - semihosting // - semihosting Loading @@ -16,8 +17,28 @@ "preLaunchTask": "cargo build", "preLaunchTask": "cargo build", "executable": "./target/thumbv7em-none-eabihf/debug/app", "executable": "./target/thumbv7em-none-eabihf/debug/app", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" ], "postLaunchCommands": [ "monitor arm semihosting enable" ], "runToMain": true, "cwd": "${workspaceRoot}" }, // Launch configuration for `app` // - debug // - semihosting // - run to main { "type": "cortex-debug", "request": "launch", "servertype": "openocd", "name": "examples (debug)", "preLaunchTask": "cargo build --examples", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "interface/stlink-v2-1.cfg", "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading @@ -39,8 +60,7 @@ "preLaunchTask": "cargo build --example", "preLaunchTask": "cargo build --example", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading Loading @@ -75,8 +95,7 @@ "preLaunchTask": "cargo build --example", "preLaunchTask": "cargo build --example", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading Loading @@ -150,8 +169,7 @@ "preLaunchTask": "cargo build --example --release", "preLaunchTask": "cargo build --example --release", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading @@ -175,8 +193,7 @@ "preLaunchTask": "cargo build --example --release --features stm32f4", "preLaunchTask": "cargo build --example --release --features stm32f4", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "executable": "./target/thumbv7em-none-eabihf/release/examples/${fileBasenameNoExtension}", "configFiles": [ "configFiles": [ "interface/stlink.cfg", "interface/stlink-v2-1.cfg", // "interface/stlink-v2-1.cfg", // deprecated setup script "target/stm32f4x.cfg" "target/stm32f4x.cfg" ], ], "postLaunchCommands": [ "postLaunchCommands": [ Loading
examples/bare0.rs +49 −13 Original line number Original line Diff line number Diff line Loading @@ -22,25 +22,49 @@ use panic_semihosting as _; use cortex_m_rt::entry; use cortex_m_rt::entry; // a constant (cannot be changed at run-time) // a constant (cannot be changed at run-time) const X_INIT: u32 = 10; const X_INIT: u32 = core::u32::MAX; // const X_INIT: u32 = core::u32::MAX; // global mutable variables (changed using unsafe code) // global mutable variables (changed using unsafe code) static mut X: u32 = X_INIT; static mut X: u32 = X_INIT; static mut Y: u32 = 0; static mut Y: u32 = 0; fn write_x(x: u32, i: u32) { unsafe{ X = x.wrapping_add(i); } } fn write_y(y: u32) { unsafe{ Y = y; } } fn read_y() -> u32 { unsafe{ Y } } fn read_x() -> u32 { unsafe{ X } } #[entry] #[entry] fn main() -> ! { fn main() -> ! { // local mutable variable (changed in safe code) // local mutable variable (changed in safe code) let mut x = unsafe { X }; let mut x = read_x(); loop { loop { x += 1; // <- place breakpoint here (3) x = x.wrapping_add(1); // <- place breakpoint here (3) unsafe { X += 1; write_x(read_x(), 1); Y = X; write_y(read_x()); assert!(x == X && X == Y); assert!(x == read_x() && read_x() == read_y()); } } } } } Loading @@ -56,12 +80,14 @@ fn main() -> ! { // // // Look under Variables/Local what do you find. // Look under Variables/Local what do you find. // // // ** your answer here ** // x: 9389056 // // // In the Expressions (WATCH -vscode) view add X and Y // In the Expressions (WATCH -vscode) view add X and Y // what do you find // what do you find // // // ** your answer here ** // ** your answer here ** // X: 9389055 // Y: <optimized out> // // // Step through one complete iteration of the loop // Step through one complete iteration of the loop // and see how the (Local) Variables are updated // and see how the (Local) Variables are updated Loading @@ -69,6 +95,10 @@ fn main() -> ! { // // // ** place your answer here ** // ** place your answer here ** // // // x will update to 9389057 // eventually x will overflow and if rust runs in debug mode then rust will panic and // if it runs in release mode rust wont check for the overflow and just do a wrap the value // // Commit your answers (bare0_1) // Commit your answers (bare0_1) // // // 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap. // 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap. Loading @@ -76,6 +106,8 @@ fn main() -> ! { // (Hint, look under OUTPUT/Adopter Output to see the `openocd` output.) // (Hint, look under OUTPUT/Adopter Output to see the `openocd` output.) // // // ** your answer here ** // ** your answer here ** // The program panics // panicked at 'attempt to add with overflow', examples/bare0.rs:42:9 // // // Commit your answers (bare0_2) // Commit your answers (bare0_2) // // Loading @@ -84,10 +116,12 @@ fn main() -> ! { // Change (both) += operations to use wrapping_add // Change (both) += operations to use wrapping_add // load and run the program, what happens // load and run the program, what happens // ** your answer here ** // ** your answer here ** // // x wrapps around and become 0 // X does nothing // Now continue execution, what happens // Now continue execution, what happens // ** your answer here ** // ** your answer here ** // // x continues to add up // X still does nothing // Commit your answers (bare0_3) // Commit your answers (bare0_3) // // // (If the program did not succeed back to the breakpoint // (If the program did not succeed back to the breakpoint Loading @@ -96,6 +130,8 @@ fn main() -> ! { // 4. Change the assertion to `assert!(x == X && X == Y + 1)`, what happens? // 4. Change the assertion to `assert!(x == X && X == Y + 1)`, what happens? // // // ** place your answer here ** // ** place your answer here ** // panic because the assertion fails // panicked at 'assertion failed: x == X && X == Y + 1', examples/bare0.rs:46:13 // // // Commit your answers (bare0_4) // Commit your answers (bare0_4) // // Loading
examples/bare1.rs +64 −10 Original line number Original line Diff line number Diff line Loading @@ -59,10 +59,16 @@ fn main() -> ! { // (passing 3 breakpoints) // (passing 3 breakpoints) // // // ** your answer here ** // ** your answer here ** // The program hits the first breakpoint again with a callstack // with a lot of elements in the callstack pointing to 0x08000424 // local x variable contains various values // // // What is the `ITM` output. // What is the `ITM` output. // // // ** your answer here ** // Program // received signal SIGTRAP, Trace/breakpoint trap. // bare1::__cortex_m_rt_main () at examples/bare1.rs:22 // 22 cortex_m::asm::bkpt(); // // // Commit your answer (bare1_1) // Commit your answer (bare1_1) // // Loading @@ -74,16 +80,42 @@ fn main() -> ! { // What is the output of: // What is the output of: // > disassemble // > disassemble // // // ** your answer here ** // Please check OUTPUT tab (Adapter Output) for output from openocd // disassemble // Dump of assembler code for function bare1::__cortex_m_rt_main: // 0x0800040a <+0>: sub sp, #8 // 0x0800040c <+2>: mvn.w r0, #1 // 0x08000410 <+6>: str r0, [sp, #4] // 0x08000412 <+8>: bkpt 0x0000 // 0x08000414 <+10>: mov.w r0, #4294967295 ; 0xffffffff // 0x08000418 <+14>: add r4, sp, #4 // 0x0800041a <+16>: str r0, [sp, #4] // 0x0800041c <+18>: bkpt 0x0000 // 0x0800041e <+20>: mov r0, r4 // 0x08000420 <+22>: bl 0x8000400 <core::ptr::read_volatile> // => 0x08000424 <+26>: bkpt 0x0000 // 0x08000426 <+28>: ldr r0, [sp, #4] // 0x08000428 <+30>: adds r0, #1 // 0x0800042a <+32>: bcc.n 0x800041a <bare1::__cortex_m_rt_main+16> // 0x0800042c <+34>: movw r0, #5984 ; 0x1760 // 0x08000430 <+38>: movt r0, #2048 ; 0x800 // 0x08000434 <+42>: movw r2, #5956 ; 0x1744 // 0x08000438 <+46>: movt r2, #2048 ; 0x800 // 0x0800043c <+50>: movs r1, #28 // 0x0800043e <+52>: bl 0x800053a <core::panicking::panic> // 0x08000442 <+56>: udf #254 ; 0xfe // End of assembler dump. // // // How many instructions are in between the two `bkpt` instructions in the loop. // How many instructions are in between the two `bkpt` instructions in the loop. // Notice, the generated code may not be exactly what you expect :) // Notice, the generated code may not be exactly what you expect :) // // // ** your answer here ** // THere are 6 instrucations inbetween // // // Which instruction stores the local variable on the stack. // Which instruction stores the local variable on the stack. // // // ** your answer here ** // 0x0800041a <+16>: str r0, [sp, #4] // // // Commit your answers (bare1_2) // Commit your answers (bare1_2) // // Loading @@ -99,15 +131,25 @@ fn main() -> ! { // What is the output of: // What is the output of: // > disassemble // > disassemble // // // ** your answer here ** // Dump of assembler code for function bare1::__cortex_m_rt_main: // 0x08000406 <+0>: sub sp, #4 // 0x08000408 <+2>: mvn.w r0, #1 // 0x0800040c <+6>: str r0, [sp, #0] // 0x0800040e <+8>: adds r0, #1 // 0x08000410 <+10>: bkpt 0x0000 // 0x08000412 <+12>: str r0, [sp, #0] // => 0x08000414 <+14>: bkpt 0x0000 // 0x08000416 <+16>: ldr r0, [sp, #0] // 0x08000418 <+18>: b.n 0x800040e <bare1::__cortex_m_rt_main+8> // End of assembler dump. // // // How many instructions are in between the two `bkpt` instructions. // How many instructions are in between the two `bkpt` instructions. // // // ** your answer here ** // 1 // // // Where is the local variable stored? // Where is the local variable stored? // // // ** your answer here ** // 0x08000412 <+12>: str r0, [sp, #0] // // // Is there now any reference to the panic handler? // Is there now any reference to the panic handler? // If not, why is that the case? // If not, why is that the case? Loading Loading @@ -172,9 +214,21 @@ fn main() -> ! { // // // What is now the disassembly of the loop (in debug/dev mode): // What is now the disassembly of the loop (in debug/dev mode): // // // ** your answer here ** // Dump of assembler code for function bare1::__cortex_m_rt_main: // // 0x0800040a <+0>: sub sp, #8 // commit your answers (bare1_5) // 0x0800040c <+2>: mvn.w r0, #1 // 0x08000410 <+6>: str r0, [sp, #4] // 0x08000412 <+8>: add r4, sp, #4 // 0x08000414 <+10>: bkpt 0x0000 // 0x08000416 <+12>: ldr r0, [sp, #4] // 0x08000418 <+14>: adds r0, #1 // 0x0800041a <+16>: str r0, [sp, #4] // => 0x0800041c <+18>: bkpt 0x0000 // 0x0800041e <+20>: mov r0, r4 // 0x08000420 <+22>: bl 0x8000400 <core::ptr::read_volatile> // 0x08000424 <+26>: b.n 0x8000414 <bare1::__cortex_m_rt_main+10> // End of assembler dump. // commit your answers (bare1_4) // // // Now restore the `.cargo/config` to its original state. // Now restore the `.cargo/config` to its original state. // // Loading
openocd.cfg +2 −3 Original line number Original line Diff line number Diff line source [find interface/stlink.cfg] source [find interface/stlink-v2-1.cfg] # deprecated # source [find interface/stlink-v2-1.cfg] transport select hla_swd transport select hla_swd # increase working area to 64KB # increase working area to 64KB Loading