Skip to content

Instantly share code, notes, and snippets.

@KunYi
Last active November 18, 2021 10:00
Show Gist options
  • Select an option

  • Save KunYi/f4ad55b91ef9841d8adff6ab9563d5e1 to your computer and use it in GitHub Desktop.

Select an option

Save KunYi/f4ad55b91ef9841d8adff6ab9563d5e1 to your computer and use it in GitHub Desktop.
use standard C library and printf redirection to USART/ITM for debugging need disable semihosting mode on Keil MDK ARM
/*
* add the below code snippt into your project
*/
#include <stdio.h>
#pragma import(__use_no_semihosting)
struct __FILE
{
int handle;
};
FILE __stdout;
/**
* @brief define _sys_exit() to avoid using semihosting mode
* @param void
* @return void
*/
void _sys_exit(int x)
{
x = x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment