Skip to content

[bsp][k230] add K230D support and Smart improvements - #11897

Merged
Rbb666 merged 10 commits into
RT-Thread:masterfrom
BernardXiong:pr/k230-k230d-smart
Nov 6, 2026
Merged

Rbb666 merged 10 commits into
RT-Thread:masterfrom
BernardXiong:pr/k230-k230d-smart

Conversation

@BernardXiong

@BernardXiong BernardXiong commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

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

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

The K230 BSP only targeted the 512MB K230 board and had no K230D (128MB DDR)
variant. It also lacked a pin device, ext4 rootfs support and pseudo terminal
mount points required by the Smart configuration.

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

  • add SOC_K230/SOC_K230D selection and size the default memory layout for 128MB DDR
  • register GPIO as an RT-Thread pin device
  • add ext4 rootfs support and mount ptyfs and procfs
  • remove unused board peripheral definitions
  • keep the SDK riscv64-unknown-linux-musl toolchain and lp64d ABI
  • regenerate .config and rtconfig.h

Dependencies

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

  • BSP: bsp/k230 (K230D, 128MB DDR)
  • .config: CONFIG_SOC_K230D=y, CONFIG_BSP_ROOTFS_TYPE_EXT4=y, CONFIG_BSP_USING_GPIO=y, CONFIG_RT_USING_PIN=y
  • action: built locally with the K230 SDK riscv64-unknown-linux-musl toolchain; CI will verify the configuration

当前拉取/合并请求的状态 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
  • 已经使用clang-format 源码格式化工具确保格式符合RT-Thread代码规范 This PR has been formatted with clang-format and complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@BernardXiong BernardXiong mentioned this pull request Oct 18, 2026
10 tasks
@BernardXiong
BernardXiong marked this pull request as ready for review October 18, 2026 12:08
@github-actions github-actions Bot added the BSP label Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

k230

  • SRAM: .bss +61,608 B, .data +1,080 B, .eh_frame +21,864 B, .sbss +56 B, .srodata.cst8 +24 B, .stack +8 B, .text +103,552 B (+15.6%, 1,395,268 B / 60,682,240 B, total: 2% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Comment thread bsp/k230/rtconfig.h Outdated
Comment on lines +605 to +617
#define BSP_ROOTFS_TYPE_EXT4
#define BSP_RISCV_FPU_SOFT
#define RT_USING_DFS_V2
#define RT_USING_DFS_DEVFS
#define RT_USING_DFS_PTYFS
#define RT_USING_DFS_PROCFS
#define RT_USING_DFS_CROMFS
#define RT_USING_DFS_TMPFS
#define PKG_USING_LWEXT4
#define RT_USING_DFS_LWEXT4
#define PKG_USING_LWEXT4_LATEST_VERSION
#define PKG_USING_ZLIB
#define PKG_USING_ZLIB_LATEST_VERSION

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个地方感觉怪怪的,建议是通过 menuconfig 重新刷一遍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

已按建议改用 scons --pyconfig-silent 重新生成 bsp/k230/.config 和 rtconfig.h(commit 87a0051),并把分支 rebase 到最新 master。

原来手动追加在 rtconfig.h 末尾的 SOC_K230D、BSP_ROOTFS_TYPE_EXT4、RT_USING_DFS_*、PKG_USING_LWEXT4、PKG_USING_ZLIB 等宏,现在都由 Kconfig 输出到各自对应的 section。生成时为了与 #11892 的依赖保持一致,临时应用了 #11892 的 libcpu/Kconfig 变更,提交中不包含该文件。

BernardXiong and others added 6 commits November 1, 2026 00:02
- add SOC_K230/SOC_K230D selection and a 128MB memory layout
- register GPIO as an RT-Thread pin device
- support ext4 rootfs and mount ptyfs and procfs
- remove unused board peripheral definitions
- switch the toolchain to the musleabi ABI
- regenerate .config and rtconfig.h
- use the lp64d ABI expected by libc_kernel.a and libgcc.a
- restore the riscv64-unknown-linux-musl toolchain prefix
- fix the double-float and soft-float link failure
- format memory layout macros
- format the pin device callbacks
- no functional change
- initialize all RTC register fields before writing them to hardware
- fix the cppcheck uninitvar warning for reserved fields
- initialize alarm date and time register fields before use
- fix the cppcheck uninitvar warning for reserved fields
Normalize bsp/k230/.config and rtconfig.h with scons --pyconfig-silent so
the Kconfig symbols are emitted in their proper sections instead of being
appended at the end of the file. The previous configuration choices are
preserved.

Co-Authored-By: Claude Code <noreply@anthropic.com>

@Rbb666 Rbb666 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

新增 k230_pin_mode() 的模式映射需要修正(bsp/k230/drivers/interdrv/gpio/drv_gpio.c:388-398)。

PIN_MODE_OUTPUT_OD 当前直接映射到普通 GPIO_DM_OUTPUT,写高仍会推挽驱动高电平,没有实现开漏释放;PIN_MODE_INPUT_PULLUP/PULLDOWN 也只映射普通输入,没有配置上下拉。调用标准 pin API 的开漏总线和无外部上拉按键因此会得到错误电气行为。

请实现对应 pad/开漏配置及写高释放逻辑;若某模式暂不支持,应明确报告不支持,不能静默按普通输入/输出执行。请补充这些模式的板上验证。

The standard pin API mapped PIN_MODE_OUTPUT_OD and the pull-up/pull-down
input modes to a plain GPIO output/input, so an open-drain user got a
push-pull driver and the requested pulls were silently ignored.

Configure the IO mux pad for every mode (pull-up, pull-down, output
enable) and emulate open-drain output by switching the pad to input for a
high level, which releases the line. Pins without a pad are rejected for
open-drain instead of falling back to push-pull behavior.

Add a utest that drives GPIO33 as open drain while GPIO32 senses the line
with its input pull resistors.
scons --dist only copies libcpu/<ARCH> for the current BSP. The
unconditional rsource "arm/Kconfig" therefore breaks pyconfig for every
non-ARM dist project, such as bsp/k230. Use orsource like the aarch64
and risc-v entries already do in the same file.
@github-actions github-actions Bot added the libcpu label Nov 5, 2026
aarch64 BSPs select ARCH_ARM, ARCH_ARM_MMU and ARCH_ARMV8, which are
defined in libcpu/arm/Kconfig. scons --dist only copies libcpu/<ARCH>,
so the pyconfig run on the dist project silently dropped those symbols
together with the AArch64 configuration block, and the dist build of
board like rockchip/rk3500 failed with ARCH_RAM_OFFSET undeclared.

Copy the shared ARM Kconfig into every dist project so that pyconfig
sees the same symbols as the full tree.
@github-actions github-actions Bot added the tools label Nov 5, 2026
@Rbb666
Rbb666 merged commit f97ab55 into RT-Thread:master Nov 6, 2026
111 checks passed
wdfk-prog pushed a commit to wdfk-prog/rt-thread that referenced this pull request Nov 13, 2026
@BernardXiong
BernardXiong deleted the pr/k230-k230d-smart branch November 18, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants