-
Notifications
You must be signed in to change notification settings - Fork 5.3k
bsp: gd32470z-lckfb: 增加 SPI Flash 支持及使用说明 #10347
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
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 support for SPI Flash on the gd32470z-lckfb board while refactoring the SPI Flash driver to support multiple SPI buses and updating documentation and configuration files.
- Refactors the flash driver to use a configuration array for multiple SPI buses
- Adds new Kconfig options for SPI4 and related DMA settings
- Updates README.md with new SPI Flash mount instructions and revises maintainers info
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| bsp/gd32/arm/libraries/gd32_drivers/drv_spi_flash.c | Refactored driver to support multi-SPI bus attachment and SFUD probe |
| bsp/gd32/arm/gd32470z-lckfb/board/Kconfig | Added configuration options for SPI4 and its DMA settings |
| bsp/gd32/arm/gd32470z-lckfb/README.md | Updated documentation for SPI Flash usage and configuration |
| MAINTAINERS | Updated maintainer information for the board |
| return RT_EOK; | ||
| } | ||
| INIT_COMPONENT_EXPORT(rt_hw_spi_flash_with_sfud_init); | ||
| result = rt_hw_spi_device_attach(cfg->bus_name, cfg->device_name, cfg->cs_pin); |
Copilot
AI
May 30, 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 error handling in the for loop overwrites the result from each iteration. Consider aggregating the success state across multiple device attachments or revising the error reporting to ensure that a successful attachment isn't masked by a subsequent failure.
| else | ||
| { | ||
| rt_kprintf("spi flash mount failed!\n"); | ||
| if (dfs_mount(cfg->flash_name, "/", "elm", 0, 0) == RT_EOK) |
Copilot
AI
May 30, 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.
Mounting all SPI Flash devices to the root directory "/" could lead to conflicts when multiple devices are attached. Consider using unique mount points or a strategy to prevent potential mount point collisions.
|
请给出测试截图 |
| static const struct spi_flash_config flash_configs[] = | ||
| { | ||
| #ifdef BSP_USING_SPI0 | ||
| { |
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.
这块格式化有点问题,建议重新刷一下格式
| { | ||
| .bus_name = "spi4", | ||
| .device_name = "spi40", | ||
| .flash_name = "gd25qsp", |
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.
这个flash_name确定不是gd25q_spi4?



拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
为
gd32470z-lckfb开发板增加板载 SPI Flash 的支持,包括驱动适配、文档补充与 Kconfig 配置项扩展。你的解决方案是什么 (what is your solution)
README.md文档,提供详细menuconfig配置路径说明;Kconfig,新增 SPI4 及 DMA 配置项;MAINTAINERS信息,标明维护者身份。请提供验证的bsp和config (provide the config and bsp)
gd32470z-lckfbRT_USING_SPI,RT_USING_SFUD,BSP_USING_SPI,BSP_USING_SPI4,关闭RT_USING_DFS]
当前拉取/合并请求的状态 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