[ ST NUCLEO-U575ZI-Q 测评] 解决printf 钩选Use MicroLIB报错
<p>我用STM32CubeMX生成的MDK工程,为了重定向prinf。</p><p>1、钩选Use MicroLIB</p>
<p> 2、书写重定向函数:</p>
<pre>
<code>/* USER CODE BEGIN PFP */
int fputc(int ch, FILE *f)
{
uint8_t temp = {ch};
HAL_UART_Transmit(&huart1, temp, 1, 2);
return ch;
}
/* USER CODE END PFP */</code></pre>
<p>编译通过,但是下载时报错:</p>
<pre>
<code>Programming Done.
Verify OK.
Application running ...
Internal command error
File : D:/Keil/Keil/STM32U5xx_DFP/2.0.0/Keil.STM32U5xx_DFP.pdsc
Sequence : DebugPortStop
Context : Item #2: <control if="DoDebugPortStop">
Item #0: <block>::Line 3
Expression : "
"
E310 : Debug access failed - cannot write value 0x00000000 to DP register 0x08
Flash Load finished at 20:08:13</code></pre>
<p>虽然程序可以跑了,但是debug时,好象不正常。网上找了很久的资料,终于找到解决方法,原因是PA13\PA14没用定义。</p>
<p>在stm32cuberMAX中把这两个引脚定义为PA13(SWDIO)、PA14(SWCLK)</p>
<p> 这样再生成工程后,下载就不会提示出错了。</p>
<p>测评汇总:免费申请|ST NUCLEO-U575ZI-Q https://bbs.eeworld.com.cn/thread-1228653-1-1.html</p>
页:
[1]