| |||
| Home > Controlling runtime messages > Enabling automatic semihosting support in the debugger | |||
By default, semihosting support is not enabled in the debugger.
However, you can create a special semihosting function, __auto_semihosting(void) in
your C code with an alias to another function. This places the required
symbol in the debug information but not in the main application
image. When the debugger detects that symbol then it automatically
enables semihosting operations if the target supports it.
Creating a special semihosting function is not required if you build your application image using ARM Compiler 5.0 and later. The linker automatically adds a semihosting symbol if required.
Example 9. Create a special semihosting function with an alias to another function
#include <stdio.h>
void __auto_semihosting(void) __attribute__ ((alias("main")));
//mark as alias for main() to declare
//semihosting symbol in debug information only
int main(void)
{
printf("Hello world\n");
return 0;
}
ARM® DS-5™ Debugger Command Reference: