How can I either turn off HardFault_Handler interrupts or find out whether I'm running stand-alone or with a debugger?
I am working with the STM32F405-microcontroller and I'm writing my code inside Eclipse (NOT System Workbench) and I'm compiling with GCC and I am debugging using GDB OpenOCD Debugging. My project only has a debug-configuration, it does not have a release configuration (don't want compiler bugs to hit me when I release code). Sometimes I want to display small helpful text-messages and when I'm running in conjunction with a debugger I want to display those inside Eclipse, otherwise I want to send the messages to a UART. When I'm running with the debugger I can simply use _trace_write_semihosting_debug and this works great. However, when I run without debugger my call to _trace_write_semihosting_debug creates a hardware error, HardFault_Handler is called and SCB->HFSR bit 31 (=DEBUG_VT) is set and it's impossible to clear it. How can I either turn off these HardFault interrupts or find out whether I'm running with or without debugger?