2024-09-17 12:55 AM
Hi,
I'm trying retarget printf. My uart_write function is working correctly and i'm able to see character on Teraterm.
But when i try to use printf it is not working. i even tried semihosting to execute printf but it fails. i'm attaching the screenshots -
Disassembly of the code stucks at "bkpt 0x00ab" -
any solution for this problem?
Solved! Go to Solution.
2024-09-17 03:29 AM - edited 2024-09-17 03:48 AM
Just noticed that you are doing this in C++
The linked articles are both just C, and I have just used C.
Could you try this in a plain C project to see if that makes a difference?
EDIT:
2024-09-17 01:37 AM
Hello @AVerm.4 ,
I recommend you to refer to this FAQ: How to redirect the printf function to a UART for debug messages and follow the steps.
This article describes how to redirect the printf output to the STM32 UART peripheral that is connected to the UART pins on the embedded ST-Link that will be transmitted to the host computer and displayed via a windows terminal program, Tera Term using Nucleo-G070RB.
I hope this help you!
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-09-17 01:51 AM
Please see this for how to capture a screenshot - far better than photographing the screen!
https://www.techrepublic.com/article/how-to-take-screenshots-in-windows-10/
For posting source code, please see the posting tips:
2024-09-17 02:04 AM
Hi @KDJEM.1 ,
I appreciate your comment. But the link provides the way to retarget HAL library UART, which i see is working fine.
But here I'm using CMSIS library to write my UART driver. And here it is not working.
2024-09-17 02:05 AM - edited 2024-09-17 02:06 AM
@Andrew Neil sorry for that. I'm not using a personal computer rather a corporate one were we have limited access to file sharing.!
2024-09-17 02:06 AM
@AVerm.4 wrote:i even tried semihosting
Presumably, the screenshots you shared show your semihosting attempt - as this works via the BKPT instruction?
https://interrupt.memfault.com/blog/arm-semihosting
Instead, follow the Knowledge Base article linked by @KDJEM.1
And here's a 3rd-party article on the same: https://shawnhymel.com/1873/
2024-09-17 02:10 AM
@AVerm.4 wrote:the link provides the way to retarget HAL library UART, which i see is working fine.
But here I'm using CMSIS library to write my UART driver. And here it is not working.
It really shouldn't make any difference - they all just end up writing to the UART.
If you're hitting a BKPT instruction, that suggests you're configured for semihosting - you don't want that.
2024-09-17 03:16 AM
I tried both of the above solutions but there is no success in using printf.!
2024-09-17 03:21 AM
Again, if you're hitting a BKPT instruction, that suggests you're still configured for semihosting - you need to get rid of that.
2024-09-17 03:27 AM
Sorry missed to mention i have disabled semihosting. Even reconfigured a new project still stuck with not working "printf" whereas "uart_write" function working correctly.