Semihosted behavior when no jtag

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

Semihosted behavior when no jtag

693 次查看
simonfourquier
Contributor I

Hi

I use semihosted (on lpcxpresso1769) for do a log of my application in a file.

That work fine when i run from mcuxpresso.

But if i reset me board I want me aplication continue to work witouth log. But my application do a hardFault in fopen()

is possible to test if we are connected in jtag or not? 

标签 (1)
标记 (1)
0 项奖励
3 回复数

552 次查看
simonfourquier
Contributor I

Thanks you 

if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)==CoreDebug_DHCSR_C_DEBUGEN_Msk) {
work fine
0 项奖励

552 次查看
BlackNight
NXP Employee
NXP Employee

You could use a modification of the hard fault handler.

Have a look at

mcuoneclipse/McuHardFault.c at master · ErichStyger/mcuoneclipse · GitHub 

and for McuHardFault_CONFIG_SETTING_SEMIHOSTING.

It basically continues in case you get a hard fault because no debugger is attached.

For background on the handler see Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse 

As for detecting if a debugger is attached: I think there is a bit in the ARM DWT (see Cycle Counting on ARM Cortex-M with DWT | MCU on Eclipse ), but I would have to check.

I hope this helps,

Erich

0 项奖励

552 次查看
converse
Senior Contributor V

This thread should help you

https://community.nxp.com/thread/424925 

0 项奖励