Using Printf Debugging, LIVE expressions and SWV Trace in CubeIDE || STM32 || ITM || SWV

Using Printf Debugging, LIVE expressions and SWV Trace in CubeIDE || STM32 || ITM || SWV

ControllersTech

4 года назад

90,546 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

ControllersTech
ControllersTech - 20.09.2019 13:33

the write function is as mentioned below:
int _write(int file, char *ptr, int len)
{
/* Implement your write code here, this is used by puts and printf for example */
int i=0;
for(i=0 ; i<len ; i++)
ITM_SendChar((*ptr++));
return len;
}

Ответить
Iosif Iliese
Iosif Iliese - 10.07.2023 17:47

It doesn't show anything for me either (stm32f429I-DISC1). I connected the PB3 pin of the microcontroller to the SWO pin of the debugger with a wire. It started displaying characters, but not the string "Hello world". I changed in Serial Wire Viewer, Core Clock (MHz) to 16.0, and it displayed the string "Hello world" 😃.

Ответить
Amr Musa
Amr Musa - 03.07.2023 04:15

i have done the same procedure but neither the itm data trace nor the time line graph showed any thing

Ответить
Vahidreza Shokouh
Vahidreza Shokouh - 01.05.2023 17:48

how abou iar ?

Ответить
Nithin Varghese
Nithin Varghese - 19.04.2023 15:47

I TRIED THE SAME WRITE FUNCTION, BUT IT'S SHOWING UNDEFINED REFERENCE TO ITM_SendChar,,,,,,how to solve that?
😞

Ответить
Smit Patel
Smit Patel - 28.03.2023 12:06

Hello , Guys..

This person has shown a true configuration for using printf() function. If you facing issue in printing context using printf() , then please try to use "/n" after the writing the context in printf() function.

printf("hello world") -> Nothing will print on SWV ITM Data Console
printf("hello world/n") -> Proper Output on serial console...

Ответить
Faith Hl
Faith Hl - 18.01.2023 06:26

I have been binge watching your STM32 videos. They are well thought through and thorough. Thank you, Arun.

Ответить
Colin Wong
Colin Wong - 11.12.2022 13:58

Hi. Is it possible to save the port values to a text file?

Ответить
cem ulaş atar
cem ulaş atar - 21.11.2022 16:34

SWV is working with the frequency of 16 MHZ but it didnt work with 168 MH.. Why ? my board ( stm32f407g)

Ответить
tomio yamaguchi
tomio yamaguchi - 30.05.2022 09:41

why STM do not support printf() in STM32CubeIDE ?
Seems me, this function is very useful and commonly provided almost IDE's. Is there any reason avoiding implement ?

Ответить
ES Ben
ES Ben - 13.05.2022 02:35

Nice video. Although it doesn't work for me. Nothing is printed. I use an ST board as a debuguer for another board.

Ответить
Watcher_Of_The_Skies
Watcher_Of_The_Skies - 12.05.2022 12:59

Thanks! Now, I'm trying to make scanf input, but no results..

Ответить
Robert Canberk Ozturk
Robert Canberk Ozturk - 15.10.2021 09:12

based thanks

Ответить
rameshwar nagargoje
rameshwar nagargoje - 23.09.2021 11:20

I am using STM32F407VG board, shows error while debugging i.e. " Error in final launch sequence:

Failed to execute MI command:
load "G:\\udemy\\embedded c\\my_workspace\\target\\001HelloWorld\\Debug\\001HelloWorld.elf"

Error message from debugger back end:
Error finishing flash operation "

Ответить
Alex Mayer
Alex Mayer - 13.09.2021 00:21

Thanks!
Really helpful :)

Ответить
Vinoth Kannan
Vinoth Kannan - 02.08.2021 11:40

In STM32 HAL and LL , which one is best for creating big and complex projects ??

Ответить
Circuitando
Circuitando - 28.07.2021 00:07

Hey! Thanks for your support! It help me a lot!

Ответить
sandeep sivadas
sandeep sivadas - 21.07.2021 04:03

I am using STM32L475 ..will it work ?
I am using micro usb only.

Ответить
Khoa Trần
Khoa Trần - 20.07.2021 10:33

can it work with stm32f303 ?

Ответить
Antoine Nauzet
Antoine Nauzet - 24.06.2021 12:59

Hello,
Thank you for this tutorial! Really usfull. Two questions
- The printf are working even when I do not activate any comparator. Is it normal?
- When activating the comparator 1 (with address 0x0), it display a "data" 0x0 in the SWV Data trace Timeline Graph. Is it still the comparator 1 that should activate printf?

Ответить
Lukas Petrikas
Lukas Petrikas - 17.06.2021 14:35

Hello. What if ITM is not available? I am programming stm32wb55 Nucleo board and I am trying to setup printf for debugging. This method does not seem to work due to the microcontroller not supporting ITM

Ответить
Lokanadya
Lokanadya - 11.06.2021 13:25

I'm using a STM32L151CB and a legit ST-Link/V2 Isol. (Own custom PCB)

Strangely, when i click "start trace", the square around the circle lights up, then, when i press resume, the circle is greyed and unselected.
No data shows up in either of the SWV tabs, but i have the live expressions working fine.

Ответить
Electrical Coder
Electrical Coder - 04.06.2021 08:28

but when i use any Hal_delay function in my int main while loop along with printf it doesnt print ot any thing on the console

Ответить
Eduardo Blotta
Eduardo Blotta - 27.05.2021 02:35

Hi Controllers Tech, thanks for the clear explanation. I could made a debug session but only show debug data in step by step execution. Any idea? Thanks again.

Ответить
Sertaç Kaan TOKYAY
Sertaç Kaan TOKYAY - 06.05.2021 17:03

I really big thank you to you

Ответить
Gael Vangheluwe
Gael Vangheluwe - 07.04.2021 11:53

thanks for the extremely good content quality !
What's your OS desktop environment ? it's smooth

Ответить
Seff2
Seff2 - 18.03.2021 21:03

Wtf... why does a printf command has to be so needlessly complicated? In arduino or mbed you just write printf(...) and done. With stupid CubeIDE Shit you need a doctors degree to get a simple output... just ridiculous. Who can use that or create anything more complicated than a blink sketch? Speaking of which: A fucking blink sketch generated in cubeF(uck)X for my discovery board gives me a 700!!!! lines main.c file. WTF?!? 700 lines to to toggle an LED on and off???

Ответить
Domagoj Tomić
Domagoj Tomić - 18.03.2021 18:16

Great video! What IDE theme are you using?

Ответить
BastiBas94
BastiBas94 - 16.03.2021 11:36

it looks like you got a reset button for the debugger. if so, how do i get the button ?

Ответить
prajakta gavandi
prajakta gavandi - 01.03.2021 16:57

Thanku for this video may god bless you

Ответить
Deniver Reinke Schiitz
Deniver Reinke Schiitz - 27.02.2021 00:32

Hi, thank you for the video. Works great, however, only in .c files. Is there a way to work in cpp files?

Ответить
Gunter Otté
Gunter Otté - 17.02.2021 17:24

Thanks. For the STM32F429i-DISCO, you need to solder SB9 (to connect SWO-PB3 to the ST-LINK) to make it work.

Ответить
rai nandani
rai nandani - 10.02.2021 20:03

I have try this but not give ouput in swt port.

Ответить
G lewiss66
G lewiss66 - 25.11.2020 11:31

Hello, I tried to set up the printf debuging with the bluepill board and the st_link v2 chinese dongle but can't make it work. The variable "count" in the live expression and the led toggle work but I got nothing on the console editor...Any idea? Thanks

Ответить
Ahmed Siddique
Ahmed Siddique - 28.10.2020 10:02

worked more or less with stm32f3discovery. one small problem though, in live expression
"Target not available"
was displayed in place of value for count variable.

Ответить
iforce2d
iforce2d - 08.10.2020 04:58

Thanks, very helpful!
Small addition: if you don't have a newline at the end of what you're printf-ing, nothing will show up until a very large buffer has been filled, then you get it all at once, on a single line. At least that's my experience.

Ответить
Axel Schmidt
Axel Schmidt - 18.09.2020 17:59

Hello, it's a great series with many information. One question: does it work with tasks? Meaning some printf in tasks don't show at my board. Does anyone have a solution?

Ответить
Xiao Yi
Xiao Yi - 01.08.2020 03:09

I've been helped. This is a great tutorial! Keep up the good work.

Ответить
Ömer ANAR
Ömer ANAR - 25.07.2020 14:35

how can i change/modify variable's values while code runinng ?

Ответить
Julian H.
Julian H. - 16.07.2020 10:48

Not working on Nucleo F303RE before setting Debug Mode to Trace Asynchronous Sw. After that it just works fine!

Ответить
전사 다이 그레퍼
전사 다이 그레퍼 - 09.07.2020 19:49

Works like a charm! Thanks!

Ответить
Arash Hashemi
Arash Hashemi - 20.06.2020 22:06

Thanks so much 💞

Ответить
Mr. Engineer
Mr. Engineer - 14.06.2020 07:40

ITM debugging is only for Cortex-M3 / Cortex-M4 / Cortex-M7 chips. Make sure your stm32 has one of the aforementioned controller.

Ответить
Simon Maghiar
Simon Maghiar - 04.06.2020 16:34

I think God punishes me because I made exactly the same thing as you and nothing happens. I use the original ST-Link V2 debugger and STM32F446RET MCU.

Edit: After 7 month of trying this again on my Nucleo, now it works!

Ответить
Joseph M
Joseph M - 28.05.2020 01:21

STM32 F0 doesn't support the SWV (viewer) , too bad

Ответить
Joseph M
Joseph M - 27.05.2020 21:00

Thank you for this. What is the serial comm program are you using it looks like it is integrated with eclipse.

Ответить
fja0568
fja0568 - 21.05.2020 02:59

Alternatively, you could overwrite __io_putchar(). _write() calls __io_putchar.

Ответить
A Cc
A Cc - 17.05.2020 01:03

Is it possible to have the swv console always active? I hate clicking the record button every time.

Ответить
Linh Truc Vo
Linh Truc Vo - 04.05.2020 14:25

Which debugger did you use ?
I'm using ST-Link V2 and STM32F407VE but it doesn't work.

Ответить