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?
Thanks you
if ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)==CoreDebug_DHCSR_C_DEBUGEN_Msk) { work fine
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
This thread should help you