-
Notifications
You must be signed in to change notification settings - Fork 5.3k
stm32f103-keysking学习板BSP移植(first version) #10286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📌 Code Review Assignment🏷️ Tag: workflowPath: Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-05-18 15:43 UTC)
📝 Review Instructions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds the first-version BSP port for the Keysking STM32F103 learning board, including board configuration files, CubeMX-generated startup and HAL code, an RT-Thread LED blink example, and updates to build and CI scripts.
- Introduce Kconfig entries for enabling USB-to-UART, GPIO, and UART2 in the board directory.
- Add CubeMX_Config directory with interrupt handlers, MSP init/deinit, HAL config, and a main stub.
- Provide an example application toggling an onboard LED and update SCons build scripts, CI attachconfigs, and documentation.
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| board/Kconfig | Define onboard/on-chip peripheral driver options |
| board/CubeMX_Config/Src/stm32f1xx_it.c | Add Cortex-M3 and peripheral ISR stubs |
| board/CubeMX_Config/Src/stm32f1xx_hal_msp.c | Implement global and UART2 MSP init/deinit |
| board/CubeMX_Config/Src/main.c | CubeMX main, clock setup, GPIO/UART2 initialization |
| board/CubeMX_Config/Inc/stm32f1xx_it.h | Prototype declarations for interrupt handlers |
| board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h | HAL module enable macros and clock values |
| board/CubeMX_Config/Inc/main.h | Declarations for Error_Handler and HAL includes |
| board/CubeMX_Config/CubeMX_Config.ioc | CubeMX project configuration |
| board/.ignore_format.yml | Exclude CubeMX_Config folder from format checks |
| applications/main.c | RT-Thread LED blink sample using rt_pin APIs |
| applications/SConscript | Build script for applications folder |
| SConstruct | Root SConstruct integrating RT-Thread build logic |
| SConscript | BSP-level SConscript selecting STM32F103 series macro |
| README.md | BSP overview, quick start, and advanced usage guide |
| Kconfig | Top-level Kconfig entry to include this BSP |
| .gitignore | Add board-specific ignore rules |
| .ci/attachconfig/rtduino.attach & nano.attach | CI attachconfigs for Arduino and Nano builds |
| .github/ALL_BSP_COMPILE.json | Add this BSP to the CI build matrix |
| #include <rtdevice.h> | ||
| #endif /* RT_USING_NANO */ | ||
|
|
||
| /* defined the LED0 pin: PC13 */ |
Copilot
AI
May 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment indicates LED0 is on PC13 but the code sets it to GET_PIN(A, 7). Update either the comment or the pin definition to match the actual LED pin.
| /* defined the LED0 pin: PC13 */ | |
| /* defined the LED0 pin: PA7 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里参考一下
| #define HAL_DMA_MODULE_ENABLED | ||
| #define HAL_FLASH_MODULE_ENABLED | ||
| #define HAL_EXTI_MODULE_ENABLED | ||
| #define HAL_GPIO_MODULE_ENABLED |
Copilot
AI
May 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAL_GPIO_MODULE_ENABLED is defined twice; remove the duplicate definition to avoid redundancy.
| #define HAL_GPIO_MODULE_ENABLED |
| .config 3 | ||
| .config 4 | ||
| .config 5 |
Copilot
AI
May 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entries like '.config 3', '.config 4', and '.config 5' appear incorrect and may not match intended patterns; consider removing or correcting them.
| .config 3 | |
| .config 4 | |
| .config 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件似乎没有生效,可以删除
| #config BSP_UART2_RX_USING_DMA | ||
| # bool "Enable UART2 RX DMA" | ||
| # depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA | ||
| # default n |
Copilot
AI
May 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Commented-out Kconfig entries can clutter the file; consider removing them or converting to active options if still needed.
| #config BSP_UART2_RX_USING_DMA | |
| # bool "Enable UART2 RX DMA" | |
| # depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA | |
| # default n | |
| config BSP_UART2_RX_USING_DMA | |
| bool "Enable UART2 RX DMA" | |
| depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA | |
| default n |
|
Added bsp/stm32/stm32f103-keysking-learning/figures/board.png: 3111512 bytes 这个文件略大,请压缩一下。 |
好的,已经压缩到了650kb |
| @@ -0,0 +1,2 @@ | |||
| # scons: --strict | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些配置是你常用的配置吗?还是拷贝其他bsp的?
这里可以采用yml的方式保存,.attach的方式文件太多。
yml方式保存的配置是bsp常用的一些配置。具体参考rt-spark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些配置是你常用的配置吗?还是拷贝其他bsp的? 这里可以采用yml的方式保存,.attach的方式文件太多。 yml方式保存的配置是bsp常用的一些配置。具体参考rt-spark
是的,这份bsp是基于bluepill的bsp改的,这是原bsp的配置,目前我这份bsp作为第一个版本只支持串口和gpio,所以没去管理这些配置。这个需要从一开始就做吗(我以为是等功能齐全之后再选择性开启的),如果是的话那我根据rt-spark的研究一下
此外,stm32f1xx_it.c这个文件别的bsp都是保留的,我这份没开中断所以是空的,但后面肯定是会用到的,是不是可以保留
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stm32f1xx_it.c main.h和it.h这个用不到的,删了吧。没有bsp用到这个文件,其他bsp只是保留了一下,有ioc文件就可以生成了,删除之后你看CI能不能编译过就可以了。
只支持串口和gpio,你也可以考虑用yml存放,配置可以不用很多,有一两个自己常用的配置即可。把*.attach文件改为yml文件。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
开中断也是用不到的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stm32f1xx_it.c main.h和it.h这个用不到的,删了吧。没有bsp用到这个文件,其他bsp只是保留了一下,有ioc文件就可以生成了,删除之后你看CI能不能编译过就可以了。 只支持串口和gpio,你也可以考虑用yml存放,配置可以不用很多,有一两个自己常用的配置即可。把*.attach文件改为yml文件。
您好,我根据论坛文档和rt-spark的yml写了一份yml,请问yml选项需要添加 - '--strict'强制检查吗
| * @attention | ||
| * | ||
| * <h2><center>© Copyright (c) 2019 STMicroelectronics. | ||
| * All rights reserved.</center></h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个用不到的文件可以删掉
| * All rights reserved. | ||
| * | ||
| * This software is licensed under terms that can be found in the LICENSE file | ||
| * in the root directory of this software component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个应该也不需要。
| * <h2><center>© Copyright (c) 2019 STMicroelectronics. | ||
| * All rights reserved.</center></h2> | ||
| * | ||
| * This software component is licensed by ST under BSD 3-Clause license, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删除
| #include <rtdevice.h> | ||
| #endif /* RT_USING_NANO */ | ||
|
|
||
| /* defined the LED0 pin: PC13 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里参考一下
| .config 3 | ||
| .config 4 | ||
| .config 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件似乎没有生效,可以删除
| @@ -0,0 +1,2 @@ | |||
| # scons: --strict | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stm32f1xx_it.c main.h和it.h这个用不到的,删了吧。没有bsp用到这个文件,其他bsp只是保留了一下,有ioc文件就可以生成了,删除之后你看CI能不能编译过就可以了。
只支持串口和gpio,你也可以考虑用yml存放,配置可以不用很多,有一两个自己常用的配置即可。把*.attach文件改为yml文件。
| @@ -0,0 +1,2 @@ | |||
| # scons: --strict | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
开中断也是用不到的。
|
感谢PR |
拉取/合并请求描述:(PR description)
[
keysking学习板
为什么提交这份PR (why to submit this PR)
stm32f103-keysking学习板BSP移植
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up