How can I activate dynamic printf breakpoint in mcuxpresso?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I activate dynamic printf breakpoint in mcuxpresso?

Jump to solution
5,766 Views
NVazquez
Contributor IV

Do I need to go to properties and change some setting?

 

Right now I am trying to test a simple program,  

uint8_t a = 6;

 

after couple of lines I am trying to print the value in a, by setting the dynamic breakpoint.

Nhule_1-1644356238326.png

This is what I get in the debug console.

 

Nhule_3-1644356374419.png

 

 

This is how my dynamic breakpoint looks like.

1 Solution
5,054 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Create a new project or use the Quickstart Panel => Quick Settings shortcut. See sections 12.1 and 16.4 from User Guide.

Regards,
MCUXpresso IDE Support

 

View solution in original post

14 Replies
5,388 Views
NVazquez
Contributor IV

My printf was working fine all of a sudden, not sure if I did something. I was using 11.5.0. But now it stopped working again. Getting the same error in debug console "No symbol "printf" in current context."

How can I have a printf() function present on the target?

 

0 Kudos
Reply
5,385 Views
ErichStyger
Specialist I

can you show your context (console message, the code you are using) and the breakpoint settings?

0 Kudos
Reply
5,383 Views
NVazquez
Contributor IV

Thank you for your quick response.

 

NVazquez_1-1663004523332.png

 

 

NVazquez_2-1663004685722.png

 

 

NVazquez_3-1663004713161.png

 

 

NVazquez_4-1663004937664.png

The yellow warning says "Breakpoint installation failed: suspended operation timeout"

 

 

 

 

0 Kudos
Reply
5,160 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I think the behavior is caused by an incorrect (or rather not according to your expectations) project configuration. If your work is based on an SDK example, you probably set "SDK Debug Console" to "UART" during the project creation. Thus, no "printf" available.

lpcxpresso_supp_0-1665132722708.png

My assumption is also based on the usage of Redlib nohost-nf variant.

Regards,
MCUXpresso IDE Support

 

5,069 Views
NVazquez
Contributor IV

That's the problem, I do have SDK_DEBBUGCONSOLE selected,

 

NVazquez_0-1665501844359.png

 

Do I need to create a new project or can I some how select "DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN"?

 

Tags (1)
0 Kudos
Reply
5,055 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Create a new project or use the Quickstart Panel => Quick Settings shortcut. See sections 12.1 and 16.4 from User Guide.

Regards,
MCUXpresso IDE Support

 

5,152 Views
ErichStyger
Specialist I

that's a good point!

In such a case the gdb can be directed to use the printf on the host using 'set dprintf-style'

0 Kudos
Reply
5,067 Views
NVazquez
Contributor IV
I tried this but I got a lot of errors. Maybe I need to change the "fsl_debug_console.h" ?
0 Kudos
Reply
5,380 Views
ErichStyger
Specialist I

how many breakpoints do you have? Try reduce the number of breakpoints (or use a SEGGER J-Link)?

0 Kudos
Reply
5,376 Views
NVazquez
Contributor IV

I don't have a jlink. I am using ulink2(which was working few days back)Removed all the other breakpoint and just had this one but it's the same. Can't print in debug console. Got this error this time.

 

NVazquez_0-1663006191586.png

 

Is there any other way I can use printf, if I include "fsl_debug_console.h" and add this line "(void)PRINTF("g_tolBitmapBytes \" %d \n", g_tolBitmapBytes);"?

 

0 Kudos
Reply
5,362 Views
ErichStyger
Specialist I

I cannot comment on the ulink2 (never used one), but I feel that could be the problem.

I would recommend to use one of the supported debug probes (P&E, SEGGER or NXP LinkServer) instead.

Sure you can use printf() in your code, but that won't stop/use the debugger, unless you are using semihosting.

0 Kudos
Reply
5,744 Views
NVazquez
Contributor IV

Hi Erich! Thank you for your response.

 

I am using NXP MCUXpresso IDE 11.4.1.

 

I have used the dynamic printf before, but on a different windows machine, probably on MCUXpresso 11.4.0 and it worked like a charm. Not sure what's the matter this time.

 

Do I need to change something in here,

Nhule_0-1644422706873.png

 

 

I can try to update my IDE to 11.5.0 and see if that helps.

 

 

0 Kudos
Reply
5,738 Views
ErichStyger
Specialist I

Unfortunately I did run out of disk space and I had to uninstall the 11.4.x.

I think for some reasons for you it is using the printf of the application?

What does

show dprintf-style

report for you?

If not set to gdb, use

set dprintf-style gdb

to set it to gdb. Other than that: do you have the printf code in your application?

0 Kudos
Reply
5,753 Views
ErichStyger
Specialist I

Hi @NVazquez ,

you might want to check out something I just wrote about: https://mcuoneclipse.com/2022/02/09/debugging-with-dynamic-printf-breakpoints/

What IDE are you using? I'm using the NXP MCUXpresso IDE 11.5.0 and there it uses gdb by default. Your error message indicates that your gdb is using the 'call' style with printf(), so you have to have the printf() function be present on the target.

I hope this helps,

Erich

0 Kudos
Reply