File tree 8 files changed +83
-23
lines changed
8 files changed +83
-23
lines changed Original file line number Diff line number Diff line change 1
- [target.thumbv7em-none-eabihf]
2
- runner = 'arm-none-eabi-gdb'
1
+ [target.thumbv7m-none-eabi]
2
+
3
+ [target.'cfg(all(target_arch = "arm", target_os = "none"))']
4
+ runner = "arm-none-eabi-gdb -q -x openocd.gdb"
5
+
3
6
rustflags = [
4
7
"-C", "link-arg=-Tlink.x",
5
8
]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ Cargo.lock
5
5
** .bk
6
6
** .sw *
7
7
bloat_log *
8
+ itm.txt
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ version = "0.6"
35
35
ssd1306 = " 0.2"
36
36
nb = " 0.1"
37
37
panic-halt = " 0.2"
38
+ panic-itm = " 0.4"
38
39
39
40
[profile .dev ]
40
41
debug = true
Original file line number Diff line number Diff line change
1
+ //! Sends "Hello, world!" through the ITM port 0
2
+ //!
3
+ //! ITM is much faster than semihosting. Like 4 orders of magnitude or so.
4
+ //!
5
+ //! **NOTE** Cortex-M0 chips don't support ITM.
6
+ //!
7
+ //! You'll have to connect the microcontroller's SWO pin to the SWD interface. Note that some
8
+ //! development boards don't provide this option.
9
+ //!
10
+ //! You'll need [`itmdump`] to receive the message on the host plus you'll need to uncomment two
11
+ //! `monitor` commands in the `.gdbinit` file.
12
+ //!
13
+ //! [`itmdump`]: https://docs.rs/itm/0.2.1/itm/
14
+ //!
15
+ //! ---
16
+
17
+ #![ no_main]
18
+ #![ no_std]
19
+
20
+ extern crate panic_itm;
21
+ extern crate stm32f407g_disc;
22
+
23
+ use cortex_m:: { iprintln, Peripherals } ;
24
+ use cortex_m_rt:: entry;
25
+
26
+ #[ entry]
27
+ fn main ( ) -> ! {
28
+ let mut p = Peripherals :: take ( ) . unwrap ( ) ;
29
+ let stim = & mut p. ITM . stim [ 0 ] ;
30
+
31
+ iprintln ! ( stim, "Hello, world!" ) ;
32
+
33
+ loop { }
34
+ }
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ target extended-remote :3333
2
+
3
+ # print demangled symbols
4
+ set print asm-demangle on
5
+
6
+ # set backtrace limit to not have infinite backtrace loops
7
+ set backtrace limit 32
8
+
9
+ # detect unhandled exceptions, hard faults and panics
10
+ break DefaultHandler
11
+ break HardFault
12
+ break rust_begin_unwind
13
+ # # run the next few lines so the panic message is printed immediately
14
+ # # the number needs to be adjusted for your panic handler
15
+ # commands $bpnum
16
+ # next 4
17
+ # end
18
+
19
+ # *try* to stop at the user entry point (it might be gone due to inlining)
20
+ break main
21
+
22
+ set mem inaccessible-by-default off
23
+
24
+ # monitor arm semihosting enable
25
+
26
+ # # send captured ITM to the file itm.fifo
27
+ # # (the microcontroller SWO pin must be connected to the programmer SWO pin)
28
+ # # 16000000 must match the core clock frequency
29
+ # monitor tpiu config internal itm.txt uart off 16000000
30
+
31
+ # # OR: make the microcontroller SWO pin output compatible with UART (8N1)
32
+ # # 8000000 is the frequency of the SWO pin
33
+ # monitor tpiu config external uart off 8000000 2000000
34
+
35
+ # # enable ITM port 0
36
+ monitor itm port 0 on
37
+
38
+ load
39
+
40
+ # start the process but immediately halt the processor
41
+ stepi
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ if (( $# != 1 )); then
5
5
exit 1
6
6
fi
7
7
8
- openocd -f discovery.cfg - c " init" -c " targets" -c " reset halt" -c " program $1 verify reset exit"
8
+ openocd -c " init" -c " targets" -c " reset halt" -c " program $1 verify reset exit"
You can’t perform that action at this time.
0 commit comments