新手入门
- 积分
- 2
- 金钱
- 2
- 注册时间
- 2019-5-8
- 在线时间
- 0 小时
|
发表于 2019-5-8 11:32:23
|
显示全部楼层
#if 1
//??????
#pragma import(__use_no_semihosting_swi)
namespace std{
struct __FILE
{
int handle;
};
FILE __stdout;
FILE __stdin;
FILE __stderr;
//FILE *fopen(const char * __restrict /*filename*/,
// const char * __restrict /*mode*/)
// {
// usart1<<"\n\r fopen. \n\r";
// return NULL;
// }
int fputc(int ch, std::FILE *f)
{
while((USART1->SR&0X40)==0);//???fputc
USART1->DR = (u8) ch;
return ch;
}
// int fgetc(FILE *f) {
// /* Your implementation of fgetc(). */
// usart1<<"\n\r fgetc \n\r";
// return 0;
// }
int ferror(FILE *stream)
{
/* Your implementation of ferror(). */
return 0;
}
// long int ftell(FILE *stream){
// /* Your implementation of ftell(). */
// usart1<<"ftell\n\r";
// return 0;
// }
// int fclose(FILE *f){
// /* Your implementation of fclose(). */
// usart1<<"\n\r fclose \n\r";
// return 0;
// }
// int fseek(FILE *f, long nPos, int nMode){
// /* Your implementation of fseek(). */
// usart1<<"fseek\n\r";
// return 0;
// }
int fflush(FILE *f)
{
/* Your implementation of fflush(). */
return 0;
}
extern "C" void _sys_exit(int)
{
/* declared in <stdlib.h> */
abort();
while(1);
}
extern "C" void _ttywrch(int ch)
{
while((USART1->SR&0X40)==0);
USART1->DR = (u8) ch;
return ;
}
}
#endif
我用C++弄,前面改成这样就可以用了 |
|