Semihosted behavior when no jtag

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

Semihosted behavior when no jtag

606 Views
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? 

Labels (1)
Tags (1)
0 Kudos
3 Replies

465 Views
simonfourquier
Contributor I

Thanks you 

if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)==CoreDebug_DHCSR_C_DEBUGEN_Msk) {
work fine
0 Kudos

465 Views
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 Kudos

465 Views
converse
Senior Contributor V

This thread should help you

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

0 Kudos