使用printf
#if defined (__CC_ARM) //KEIL
#pragma import(__use_no_semihosting) //取消ARM的半主机工作模式
void _sys_exit(int x) //定义_sys_exit()以避免使用半主机模式
{
x = x;
}
struct __FILE //标准库需要的支持函数
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef?d in stdio.h. */
FILE __stdout;
#endif
printf函数实现一是重定义putc函数,二是自己通过钓鱼C语言的格式化字符串函数来实现 需要重定向 struct __FILE //标准库需要的支持函数
页:
[1]