解決首次運行報錯問題
近期在網上購買了一個WIFI模組,例程是使用HAL庫撰寫的,首次編譯的時候出現USER\stm32f4xx.h(193): error: #35: #error directive: "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)“的錯誤,定位到報錯的位置為
#error “Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)”
意思是"請首先選擇應用程式中使用的STM32F4xx目標設備(在STM32F4xx .h檔案中)”,在stm32f4xx.h檔案(就是報錯的那個檔案里),找到如圖所示的位置,我的是從第83行開始,

這些注釋的內容是對應于你的單片機型號,比如我使用的為stm32f429單片機,就把對應行的注釋取消掉即可,

之后編譯,完美解決,
keil5下載按鈕變成灰色問題
報錯解決后,又發現了新問題,keil5的下載按鈕變成灰色的了,這也是我第一次遇見,只好繼續問度娘了,參考了網上一些大神的解決方法,發現并沒有結局問題,最后發現了解決問題的方法,
打開魔術棒,在Utilities選項卡下,先把Use Debug Deriver取消勾選,

之后選擇自己使用的仿真器,我使用的是CMSIS-DAP,最后再把Use Debug Deriver勾選上,點OK即可,這時候發現下載按鈕奇跡般的恢復了,

如果我的方法不能解決下載按鈕變灰的問題,還可以參考一下博文:
https://www.cnblogs.com/renmeditation/articles/9975268.html
https://blog.csdn.net/wuyuzun/article/details/90721736
https://blog.csdn.net/qq_22329595/article/details/79256715?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/214365.html
標籤:其他
