[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过
Maintainers usually reply within 2 days
@moment-NEW is already working on this.
Since Oct 3, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c
- Domain
- build-system, documentation, embedded-iot
Research direction
Compare the README_zh.md「快速上手」and「进阶使用」sections, then inspect bsp/stm32/stm32f103-blue-pill/SConstruct and project.uvprojx to confirm how packages enter the MDK project. Run scons --target=mdk5 after pkgs --update and verify the generated project references the required HAL/CMSIS files and can compile.
Written by the indexing model from the issue text.
Description
问题描述
按 README_zh.md 的「快速上手」章节操作,无法编译通过。
该章节写明(第 69-75 行,原文):
请注意!!!
在执行编译工作前请先打开 ENV 执行以下指令(该指令用于拉取必要的HAL库及CMSIS库,否则无法通过编译):pkgs --update
但仓库里 checked-in 的 project.uvprojx 并没有引用 packages/ 目录下的任何路径,
工程的文件列表里也没有任何 HAL 源文件:
project.uvprojx的<IncludePath>中,与库相关的只有
..\libraries\HAL_Drivers、..\libraries\HAL_Drivers\drivers、
..\libraries\HAL_Drivers\drivers\config- 全文检索该工程文件,
package/cmsis/stm32f1xx_hal均无匹配 - 工程的
<RTE>段为空(<apis /><components /><files />)
也就是说,即使执行完 pkgs --update 把 HAL 拉到 <bsp>/packages/ 下,
Keil 工程本身仍然不会去这些路径找头文件和源文件,编译依然会失败。
复现步骤
git clone https://github.com/RT-Thread/rt-thread.git- 用 Keil MDK 打开
bsp/stm32/stm32f103-blue-pill/project.uvprojx - 命令行编译:
UV4.exe -j0 -b project.uvprojx -o build.log - 结果(MDK 5.06 update 7 / AC5):
board\board.h(14): error: #5: cannot open source input file "stm32f1xx.h": No such file or directory
#include <stm32f1xx.h>
"no source": Error: #5: cannot open source input file "..\libraries\HAL_Drivers\drivers\drv_gpio.c": No such file or directory
"no source": Error: #5: cannot open source input file "..\libraries\HAL_Drivers\drivers\drv_usart.c": No such file or directory
"no source": Error: #5: cannot open source input file "..\libraries\HAL_Drivers\drv_common.c": No such file or directory
board\CubeMX_Config\Inc\main.h(31): error: #5: cannot open source input file "stm32f1xx_hal.h": No such file or directory
#include "stm32f1xx_hal.h"
".\build\keil\Obj\rt-thread.axf" - 6 Error(s), 1 Warning(s).
Target not created.
(stm32f1xx.h 属于 Cube HAL/CMSIS device 头文件。本机已安装 Keil.STM32F1xx_DFP 2.4.1,
但该包只提供标准外设库的 stm32f10x.h,不含 Cube HAL 的 stm32f1xx.h,所以靠 DFP 包解决不了。)
相关背景
bsp/stm32/stm32f103-blue-pill/SConstruct 里有 bsp_pkg_check(),会检查三个软件包目录:
check_paths = [
os.path.join("packages", "CMSIS-Core-latest"),
os.path.join("packages", "stm32f1_cmsis_driver-latest"),
os.path.join("packages", "stm32f1_hal_driver-latest")
]
.config 里也确实开启了 CONFIG_PKG_USING_STM32F1_HAL_DRIVER=y 与 CONFIG_PKG_USING_STM32F1_CMSIS_DRIVER=y。
所以包机制是通的,缺的是把这套路径同步进 Keil 工程这一步。
我注意到 bsp/stm32:Separate STM32F1 HAL drivers (#10209) 这个提交之后,
HAL 被拆成了独立软件包,而「快速上手」章节大概没有同步更新。
建议
「快速上手」的步骤 1 之后,可能还需要加上重新生成工程这一步,即 README_zh.md
「进阶使用」章节里已有的:
scons --target=mdk5
另外想请教下:pkgs --update 是否会同时更新 MDK 工程?如果会,那我上面的推断就是错的,
麻烦指正 —— 我没有 ENV 工具环境,无法实测这一步,只能从工程文件内容反推。
环境
- RT-Thread master
dc3da6d(2026-09-11) - Keil MDK 5,ARMCC V5.06 update 7 (build 960)
- Windows 11
@Liang1795 麻烦帮忙确认下这个推断是否成立,谢谢!
- Dominant language
- C
- Stars
- 12.4k
- Forks
- 5.5k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 79
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RT-Thread/rt-thread
-
Arch: ARM/AArch64 Doc
Difficulty 1/5 Under an hour Newbie friendliness 90/100
RT-Thread/rt-thread#12082 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
RT-Thread/rt-thread#11951 · 2 comments ·
Maintainers usually reply within 2 days
-
[Bug] [libc] timer_gettime 拆秒前将总纳秒截断为 uint32_t,剩余时间查询错误May be free again @Yunlk claimed this 28 days ago, and no pull request is open. Openin progress
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RT-Thread/rt-thread#11924 · 7 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug] dfs_v2 tmpfs: ftruncate(fd, 0) frees the file buffer but reports success — use-after-free read/write and double free from a legal POSIX callPossibly taken @remukisama claimed this 33 days ago. Openin progress
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RT-Thread/rt-thread#11902 · 4 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
Arch: RISC-V BSP BSP: HPMicro bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RT-Thread/rt-thread#11687 · 6 comments ·
Maintainers usually reply within 2 days
All issues in RT-Thread/rt-thread
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ESPresense/ESPresense#2680 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ImageMagick/ImageMagick#9134 ·
Maintainers usually reply within 1 day
-
Builder: a structure opened without calculation data shows the Diffraction (fibre) view by defaultOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
FriendsofECCE/ECCE#1245 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/nuttx-apps#4108 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
VirtualBox/virtualbox#996 ·
Maintainers usually reply within 6 days