4L LISTBOX_GetItemText 进入异常的问题已解决,使能微库后就可正常运行。
其中曲折不表,最后发现微库是因为仿真调试时,进入异常中断查看调用栈。
程序是因为调用__rt_memcpy进入异常,虽然已重定向printf并使用标准库,
试一试的态度使能了微库,问题解决....
虽然问题解决,但是百思不得其解。 使用MEMCPY为什么要使能微库,测试过在不使能微库时直接使用函数是没有问题的。 - #if 1
- #pragma import(__use_no_semihosting)
- //标准库需要的支持函数
- struct __FILE
- {
- int handle;
- };
- FILE __stdout;
- //定义_sys_exit()以避免使用半主机模式
- void _sys_exit(int x)
- {
- x = x;
- }
- //重定义fputc函数
- int fputc(int ch, FILE *f)
- {
- while((USART1->ISR&0X40)==0);//循环发送,直到发送完毕
- USART1->TDR=(uint8_t)ch;
- return ch;
- }
- //__use_no_semihosting was requested, but _ttywrch was referenced
- void _ttywrch(int ch)
- {
- ch = ch;
- }
- #endif
复制代码
希望有大牛可以帮我扫扫盲!谢谢
|