File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ cortex-m-rtfm = "0.5.1"
46
46
cortex-m-semihosting = " 0.3.5"
47
47
panic-semihosting = " 0.5.3"
48
48
panic-halt = " 0.2.0"
49
+ panic-itm = " 0.4.2"
50
+ lazy_static = { version = " 1.4" , features = [" spin_no_std" ] }
49
51
log = " 0.4.11"
52
+ cortex-m-log = { version = " 0.7" , features = [" log-integration" ] }
50
53
cfg-if = " 0.1.10"
51
54
rtt-target = { version = " 0.3.0" , features = [" cortex-m" ] }
52
55
panic-rtt-target = { version = " 0.1.1" , features = [" cortex-m" ] }
@@ -63,9 +66,9 @@ stm32g483 = ["stm32g4/stm32g483"]
63
66
stm32g484 = [" stm32g4/stm32g484" ]
64
67
stm32g491 = [" stm32g4/stm32g491" ]
65
68
stm32g4a1 = [" stm32g4/stm32g4a1" ]
66
- log-itm = []
69
+ log-itm = [" cortex-m-log/itm " ]
67
70
log-rtt = []
68
- log-semihost = []
71
+ log-semihost = [" cortex-m-log/semihosting " ]
69
72
70
73
[profile .dev ]
71
74
codegen-units = 1
Original file line number Diff line number Diff line change
1
+ #![ allow( unsafe_code) ]
1
2
cfg_if:: cfg_if! {
2
3
if #[ cfg( any( feature = "log-itm" ) ) ] {
3
4
use panic_itm as _;
@@ -19,7 +20,9 @@ cfg_if::cfg_if! {
19
20
level: LevelFilter :: Info ,
20
21
inner: unsafe {
21
22
InterruptSync :: new(
22
- ItmDest :: new( cortex_m:: Peripherals :: steal( ) . ITM )
23
+ // We must not use Peripherals::steal() here to get an ITM instance, as the
24
+ // code might expect to be able to call Peripherals::take() later on.
25
+ ItmDest :: new( core:: mem:: transmute( ( ) ) )
23
26
)
24
27
} ,
25
28
} ;
Original file line number Diff line number Diff line change 3
3
source [find interface/stlink.cfg]
4
4
source [find target/stm32g4x.cfg]
5
5
6
+ reset_config srst_only srst_nogate
7
+ init
8
+
6
9
reset halt
7
10
stm32g4x unlock 0
8
11
reset halt
9
-
10
- reset_config srst_only srst_nogate
11
- init
12
12
flash probe 0
13
+
14
+ # Uncomment the following lines for ITM logging to "itm.fifo" and adapt core
15
+ # clock (16MHz by default) and pin frequency if necessary:
16
+ # stm32g4x.tpiu configure -protocol uart -traceclk 16000000 -pin-freq 8000000 -output itm.fifo -formatter off
17
+ # stm32g4x.tpiu enable
18
+ # itm ports on
You can’t perform that action at this time.
0 commit comments