Skip to content

[bsp/Infineon] Fix PWM macro mismatches left by the CHx_PORTy rename - #11802

Open
mengxinyuan638 wants to merge 1 commit into
RT-Thread:masterfrom
mengxinyuan638:fix/psoc6-slider-pwm-macro
Open

mengxinyuan638 wants to merge 1 commit into
RT-Thread:masterfrom
mengxinyuan638:fix/psoc6-slider-pwm-macro

Conversation

@mengxinyuan638

Copy link
Copy Markdown

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

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

bsp/Infineon/psoc6-evaluationkit-062S2/board/ports/slider_sample.c 中,PWM 初始化代码的
条件编译宏写成了 BSP_USING_PWM0_PORT0,但该宏在整个仓库中并不存在。板级 Kconfig 实际
定义的是 BSP_USING_PWM0_CH0_PORT0("Enable PWM0-CH0-PORT0 output pwm"),且启用
slider 示例(BSP_USING_SLIDER_SAMPLE)时会自动选中它。由于宏名不匹配,PWM 初始化代码
整段被编译掉,slider 示例始终找不到 PWM 设备。

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

将 slider_sample.c 中的 BSP_USING_PWM0_PORT0 替换为正确的宏名 BSP_USING_PWM0_CH0_PORT0
使 slider 示例使能时能正常初始化并查找到 PWM 设备。

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

当前拉取/合并请求的状态 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自查

@github-actions

Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • Use workflow from 保持默认分支(通常为 master
    Keep the default branch (usually master) in Use workflow from
  • branch 输入框填写 PR 分支 fix/psoc6-slider-pwm-macro
    Enter PR branch fix/psoc6-slider-pwm-macro in the branch field
  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将作为独立提交推送至你的分支。
    The formatting changes will be pushed to your branch as a separate commit.

完成后,提交将自动更新至 fix/psoc6-slider-pwm-macro 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the fix/psoc6-slider-pwm-macro branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added BSP BSP: Infineon BSP related with Infineon labels Sep 15, 2026
@CLAassistant

CLAassistant commented Sep 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CYFS3

CYFS3 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

e5382cb#diff-52bb1c0931033bbf40d9eca0fb13bb8df29611d8d594855039b3e676e948f7c4
可以看一下这个更改的内容,其他板卡应该都会有问题。

Commit e5382cb renamed the PWM table guards in drv_pwm.c to the
CHx_PORTy convention but only adapted the psoc6-evk Kconfig, leaving
several mismatches behind:

- The psoc6-evaluationkit-062S2 slider sample still tested the old
  flat name BSP_USING_PWM0_PORT0 while the board Kconfig defines
  BSP_USING_PWM0_CH0_PORT0, so the PWM init was compiled out.
- The PORT13 entry was renamed to BSP_USING_PWM0_CH7_PORT13, a macro
  that no Kconfig defines, and the channel is wrong anyway:
  PWM0_CH3_PORT13_CONFIG carries .channel = 3, PORT13 sits under the
  PWM0 CH3 menu, and the slider demo selects CH3 + PORT13.
- The PSOC62 template and five psoc6 boards (cy8ckit-062-BLE,
  cy8ckit-062-WIFI-BT, cy8ckit-062S2-43012, cy8ckit-062s4,
  cy8cproto-062S3-4343W) still define the old flat names.

Fix all of them by migrating the evaluationkit sample to
BSP_USING_PWM0_CH0_PORT0 and renaming the PORT13 group to
BSP_USING_PWM0_CH3_PORT13 across drv_pwm.c, the PSOC62 template and
the five boards' Kconfigs/slider samples, so Kconfig, driver table
and samples match again.

Note: the sibling guards BSP_USING_PWM0_CH7_PORT2/5/7/9/10/12 are
still not generated by these boards' Kconfigs; left untouched for a
separate discussion.
@mengxinyuan638
mengxinyuan638 force-pushed the fix/psoc6-slider-pwm-macro branch from c1ea875 to 4cef957 Compare September 15, 2026 14:58

@CYFS3 CYFS3 left a comment

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.

LGTM

@mengxinyuan638 mengxinyuan638 changed the title [bsp/Infineon] Fix PWM macro name in slider sample [bsp/Infineon] Fix PWM macro mismatches left by the CHx_PORTy rename Sep 15, 2026
@mengxinyuan638

mengxinyuan638 commented Sep 15, 2026

Copy link
Copy Markdown
Author

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

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

Commit e5382cb 将 drv_pwm.c 中 PWM 配置表的宏重命名为 CHx_PORTy 规范,但只适配了
psoc6-evk 的板级 Kconfig,留下了三处不匹配:

  1. bsp/Infineon/psoc6-evaluationkit-062S2/board/ports/slider_sample.c 仍使用旧宏
    BSP_USING_PWM0_PORT0,而板级 Kconfig 实际定义的是 BSP_USING_PWM0_CH0_PORT0
    导致 PWM 初始化代码被编译掉,slider 示例找不到 PWM 设备。
  2. drv_pwm.c 中 PORT13 表项被重命名为 BSP_USING_PWM0_CH7_PORT13,但该宏没有任何
    Kconfig 定义,且通道号有误:PWM0_CH3_PORT13_CONFIG.channel = 3,各板级
    Kconfig 中 PORT13 均挂在 PWM0 CH3 菜单下,slider demo 选中的也是 CH3 + PORT13。
  3. PSOC62 板卡模板与 5 块 psoc6 板卡(cy8ckit-062-BLE、cy8ckit-062-WIFI-BT、
    cy8ckit-062S2-43012、cy8ckit-062s4、cy8cproto-062S3-4343W)的 Kconfig 和
    slider_sample.c 仍保留旧的 BSP_USING_PWM0_PORT13

以上任一情况都会导致使能相应 PWM 通道或 slider demo 后无法正常找到/配置 pwm 设备。

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

将 evaluationkit 的 slider_sample.c 迁移到 BSP_USING_PWM0_CH0_PORT0;并将 PORT13 组
统一重命名为 BSP_USING_PWM0_CH3_PORT13,覆盖 drv_pwm.c 、PSOC62 模板及 5 块板卡的
Kconfig(config 符号、菜单文案、slider select)与 slider_sample.c ,使
Kconfig → rtconfig.h → 驱动配置表 → 示例 全链一致。

说明:BSP_USING_PWM0_CH7_PORT2/5/7/9/10/12 在这些板卡上存在同样的旧名遗留问题
(板级 Kconfig 仍为旧名),本 PR 未涉及,可在后续单独讨论处理。

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

  • BSP: bsp/Infineon/psoc6-cy8ckit-062S2-43012
    (改动另覆盖 PSOC62 模板、其余 4 块 psoc6 板卡及 Infineon 公共驱动 drv_pwm.c)

  • .config: CONFIG_BSP_USING_SLIDER=y,CONFIG_BSP_USING_SLIDER_SAMPLE=y
    (BSP_USING_SLIDER_SAMPLE 会自动选中 BSP_USING_PWM / BSP_USING_PWM0 / BSP_USING_PWM0_CH3 / BSP_USING_PWM0_CH3_PORT13)

  • action: https://github.com/mengxinyuan638/rt-thread/actions/runs/34985824288

当前拉取/合并请求的状态 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自查

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSP: Infineon BSP related with Infineon BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants