keil解决debug卡在startup_stm32f10x_hd.s

在开发板上进行SPI协议实验时遇到串口未接收到flash_ID号的问题,调试发现卡在启动文件。解决方案是针对使用printf函数的USART进行重定向,并在项目设置中启用MicroLIB,最终成功读取并解决了通信问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这两天在开发板上运行SPI协议并且利用串口读取flash_ID号的实验。不过串口助手一直没有信息,并且debug还卡在启动文件中。最后在互联网上搜集了两天信息后终于解决。

如果USART中用到printf函数,那就需要首先进行重定向

int fputc(int ch, FILE *f)
{
		/* 发送一个字节数据到串口 */
		USART_SendData(DEBUG_USARTx, (uint8_t) ch);
		
		/* 等待发送完毕 */
		while (USART_GetFlagStatus(DEBUG_USARTx, USART_FLAG_TXE) == RESET);		
	
		return (ch);
}

然后还需要勾选:Use MicroLIB

 

大功告成,完美解决

stm32f4xx_gpio.h stm32f*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'D:\嵌入式\keil5\ARM\ARMCC\Bin' Build target 'Target 1' assembling startup_stm32f410xx.s... assembling startup_stm32f429_439xx.s... assembling startup_stm32f446xx.s... assembling startup_stm32f411xe.s... assembling startup_stm32f413_423xx.s... assembling startup_stm32f427x.s... assembling startup_stm32f40_41xxx.s... assembling startup_stm32f401xx.s... assembling startup_stm32f40xx.s... assembling startup_stm32f427_437xx.s... assembling startup_stm32f412xg.s... assembling startup_stm32f469_479xx.s... compiling stm32f4xx_rcc.c... ..\star\stm32f4xx.h(11581): warning: #47-D: incompatible redefinition of macro "DBGMCU_APB2_FZ_DBG_TIM1_STOP" (declared at line 11574) #define DBGMCU_APB2_FZ_DBG_TIM1_STOP DBGMCU_APB1_FZ_DBG_TIM1_STOP ..\star\stm32f4xx.h(11582): warning: #47-D: incompatible redefinition of macro "DBGMCU_APB2_FZ_DBG_TIM8_STOP" (declared at line 11575) #define DBGMCU_APB2_FZ_DBG_TIM8_STOP DBGMCU_APB1_FZ_DBG_TIM8_STOP ..\star\stm32f4xx.h(11583): warning: #47-D: incompatible redefinition of macro "DBGMCU_APB2_FZ_DBG_TIM9_STOP" (declared at line 11576) #define DBGMCU_APB2_FZ_DBG_TIM9_STOP DBGMCU_APB1_FZ_DBG_TIM9_STOP ..\star\stm32f4xx.h(11584): warning: #47-D: incompatible redefinition of macro "DBGMCU_APB2_FZ_DBG_TIM10_STOP" (declared at line 11577) #define DBGMCU_APB2_FZ_DBG_TIM10_STOP DBGMCU_APB1_FZ_DBG_TIM10_STOP ..\star\stm32f4xx.h(11585): warning: #47-D: incompatible redefinition of macro "DBGMCU_APB2_FZ_DBG_TIM11_STOP" (declared at line 11578) #define DBGMCU_APB2_FZ_DBG_TIM11_STOP DBGMCU_APB1_FZ_DBG_TIM11_STOP ..\star\stm32f4xx.h(12028): error: #5: cannot open source input file "stm32f4xx_conf.h": No such file or directory #include "stm32f4xx_conf.h" ..\star\stm32f4xx_rcc.c: 5 warnings, 1 error compiling system_stm32f4xx.c... ..\star\stm32f4xx.h(11581): warning: #47-D: incompat4xx_rcc.h stdint.h 头文件 missing 错误 解决方案
03-26
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值