How can I activate dynamic printf breakpoint in mcuxpresso?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How can I activate dynamic printf breakpoint in mcuxpresso?

跳至解决方案
5,768 次查看
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 解答
5,056 次查看
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

 

在原帖中查看解决方案

14 回复数
5,390 次查看
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 项奖励
回复
5,387 次查看
ErichStyger
Specialist I

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

0 项奖励
回复
5,385 次查看
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 项奖励
回复
5,162 次查看
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,071 次查看
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"?

 

标记 (1)
0 项奖励
回复
5,057 次查看
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,154 次查看
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 项奖励
回复
5,069 次查看
NVazquez
Contributor IV
I tried this but I got a lot of errors. Maybe I need to change the "fsl_debug_console.h" ?
0 项奖励
回复
5,382 次查看
ErichStyger
Specialist I

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

0 项奖励
回复
5,378 次查看
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 项奖励
回复
5,364 次查看
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 项奖励
回复
5,746 次查看
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 项奖励
回复
5,740 次查看
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 项奖励
回复
5,755 次查看
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 项奖励
回复