1. 程式人生 > >STM32報錯、報錯狀況以及解決辦法:Library reports error: __use_no_semihosting was requested, but _ttywrch was refer

STM32報錯、報錯狀況以及解決辦法:Library reports error: __use_no_semihosting was requested, but _ttywrch was refer

在寫STM32程式的時候
①我用到了#include “stdlib.h”這個標頭檔案,裡面包括一些malloc、exit、free等函式;
②我是用的正點原子的官方usart函式檔案。
在這樣的前提下出現錯誤:
Library reports error: __use_no_semihosting was requested, but _ttywrch was referenced

解決辦法:
在usart.c檔案的
_sys_exit(int x)
{
x = x;
}
大約47行後面加入
//__use_no_semihosting was requested, but _ttywrch was
_ttywrch(int ch)
{
ch = ch;
}
圖1

這樣就完美解決了!