Skip to content

Conversation

@QianJiu05
Copy link
Contributor

拉取/合并请求描述:(PR description)

[

keysking学习板

为什么提交这份PR (why to submit this PR)

stm32f103-keysking学习板BSP移植

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:bsp\stm32\stm32f103-keysking-learning
  • .config:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions
Copy link

github-actions bot commented May 17, 2025

📌 Code Review Assignment

🏷️ Tag: workflow

Path: .github
Reviewers: supperthomas Rbb666 kurisaW

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json

📊 Current Review Status (Last Updated: 2025-05-18 15:43 UTC)

  • Rbb666 Pending Review
  • kurisaW Pending Review
  • supperthomas Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@github-actions github-actions bot added BSP: STM32 BSP related with ST/STM32 BSP action github action yml imporve labels May 17, 2025
@supperthomas supperthomas requested a review from Copilot May 17, 2025 13:23
Copy link
Contributor

Copilot AI left a 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 */
Copy link

Copilot AI May 17, 2025

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.

Suggested change
/* defined the LED0 pin: PC13 */
/* defined the LED0 pin: PA7 */

Copilot uses AI. Check for mistakes.
Copy link
Member

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
Copy link

Copilot AI May 17, 2025

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.

Suggested change
#define HAL_GPIO_MODULE_ENABLED

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 29
.config 3
.config 4
.config 5
Copy link

Copilot AI May 17, 2025

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.

Suggested change
.config 3
.config 4
.config 5

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件似乎没有生效,可以删除

Comment on lines +35 to +38
#config BSP_UART2_RX_USING_DMA
# bool "Enable UART2 RX DMA"
# depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
# default n
Copy link

Copilot AI May 17, 2025

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.

Suggested change
#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

Copilot uses AI. Check for mistakes.
@supperthomas
Copy link
Member

Added bsp/stm32/stm32f103-keysking-learning/figures/board.png: 3111512 bytes
Size: 3.0 MB

这个文件略大,请压缩一下。

@QianJiu05
Copy link
Contributor Author

Added bsp/stm32/stm32f103-keysking-learning/figures/board.png: 3111512 bytes Size: 3.0 MB

这个文件略大,请压缩一下。

好的,已经压缩到了650kb

@@ -0,0 +1,2 @@
# scons: --strict
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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都是保留的,我这份没开中断所以是空的,但后面肯定是会用到的,是不是可以保留

Copy link
Member

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文件。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

开中断也是用不到的。

Copy link
Contributor Author

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>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该也不需要。

* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
Copy link
Member

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 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里参考一下

Comment on lines 27 to 29
.config 3
.config 4
.config 5
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

开中断也是用不到的。

@supperthomas supperthomas merged commit fd5c70d into RT-Thread:master May 18, 2025
60 checks passed
@supperthomas
Copy link
Member

感谢PR

@supperthomas supperthomas added the BSP: new bsp board New added bsp, need sync action label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP: new bsp board New added bsp, need sync action BSP: STM32 BSP related with ST/STM32 BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants