Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
starkindustries
Level 1
Level 1
First reply posted First question asked Welcome!

Hello community,

I am looking for printf style debugging feature in ModusToolBox for PSoC. Actually I want printf style debugging feature available on STMCUBE IDE. As ModusToolBox is also an eclipse based IDE, I want to know how to use printf statement in main.c of my PSoC6 project on MTB. 

I already know about UART style printf debugging. Please do not suggest UART based serial terminal code example for such feature. I want to use MTB with printf over ARM Cortex M4 ITM-SWO line, so that I can directly see print statement on ITM console.

Regards,

Tony Stark,

Stark Industries

0 Likes
3 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I thought that PSoC6 and MTB has been supporting "printf" from the first place, 
unlike PSoC Creator.

So I tested with 

ModusToolbox_3.1.0.12257

CY8CKIT-062-BLE

I created a new project using the template of "Hello World"

main.c seems to be using "printf"

002-IDE.JPG

I built the project and debugged with my CY8CKIT-062-BLE, 

the output in the Tera Term was

001-TeraTerm-log.JPG

So apparently "printf" is working.

Although I'm not sure what you mean with "ITM-SWO", 
I checked the pin assignment, UART pins seemed to be assinged to P5[0] and P5[1].

If you want to assign UART pins to other pins, 
I hope that you can change these pins in the Devie Configurator > Pins

003-Pins.JPG

Meantime, I wonder if the following information can be a hint for you to use "printf"

file:///C:/Cypress/MTW/WorkSpace230810/mtb_shared/retarget-io/release-v1.5.0/docs/html/index.html

moto

 

on MTB, using the Retarget-IO library allow you to directly use the printf 

An another link with debuging through SWO PSoC6 Cortex-M4 SWD SWO debug output - Infineon Developer Community

michaskla8
Level 1
Level 1
First reply posted Welcome!

In ModusToolBox for PSoC, achieving printf-style debugging without relying on UART can be seamlessly integrated using the ARM Cortex-M4 Instrumentation Trace Macrocell - Serial Wire Output (ITM-SWO) feature. This approach allows you to directly visualize print statements on the ITM console. To implement this, ensure your project's main.c includes the necessary configurations. Utilize the ITM_SendChar function to send characters to the ITM channel, allowing you to observe printf outputs in real-time. Avoid UART-based serial terminal examples, as this method provides a more direct and efficient means of printf-style debugging in the ModusToolBox Eclipse-based IDE for PSoC6 projects.

0 Likes