Repository navigation
Fix concurrent STM32 package updates and builds - #37
Merged
Merged
Conversation
Rbb666
approved these changes
Oct 23, 2026
Rbb666
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
STM32 软件包测试会并行运行多个版本。虽然每个任务有独立的 BSP 副本,它们仍共用
bsp/stm32/libraries下的 HAL/CMSIS 驱动目录。原来的sem_stm32只保护编译,依赖更新没有加锁,因此一个任务可能在另一个任务克隆依赖尚未完成时,对同一目录执行git pull。RT-Thread/rt-thread#11870 的测试就出现了这一问题:
hello:v1.0.0克隆stm32h7_cmsis_driver-latest,而hello:latest更新该共享目录时,Git 报出未跟踪文件将被覆盖并中止。失败发生在依赖更新阶段,随后被测试框架统一报告为compile failure。见失败日志。因此将锁移到
__build(),在配置生成完成后获取,连续保护软件包更新和编译两个阶段。两者必须使用同一个临界区:如果只锁住更新过程,另一个任务仍可能在编译期间修改当前任务正在使用的依赖文件。这样修改后,STM32 任务会完成依赖更新和编译后再交出锁,其他 BSP 仍可并行执行。同时移除
__build_scons()内原有的加锁,避免同一线程重复获取信号量导致死锁,并通过try/finally保证异常时释放锁。