中级会员
 
- 积分
- 367
- 金钱
- 367
- 注册时间
- 2017-10-19
- 在线时间
- 71 小时
|
1金钱
使用RTX操作系统,由于需要使用FlashFS文件管理,因此没法使用MicroLib。但是不使用微库的情况下,一遇到printf,程序就会进入HardFault_Handler中断。已在串口中加入以下代码:
#pragma import(__use_no_semihosting)
void _ttywrch(int ch)
{
for (;;);
}
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;
void _sys_exit(int x)
{
x = x;
}
int fputc(int ch, FILE *f)
{
while((USART2->SR&0X40)==0);
USART2->DR = (u8) ch;
return ch;
}
|
最佳答案
查看完整内容[请看2#楼]
http://www.openedv.com/forum.php?mod=viewthread&tid=123218&highlight=rtx%2Bprintf
老铁 要学会论坛搜索
|