Skip to content

[Bug][DFS] 使用 Keil + ARM Compiler 6 构建时因 --c99 参数报错 #10337

@godmial

Description

@godmial

RT-Thread Version

v4.1.0

Hardware Type/Architectures

gd32470z-lckfb

Develop Toolchain

MDK Keil

Describe the bug

1. 使用的工具链(环境)

Keil MDK v5.38 + ARM Compiler 6.22(armclang)
Windows 10


2. 发生问题的模块

components/dfs/dfs_v1/SConscript

Image


3. 复现方式

  1. 使用 RT-Thread v4.1.0;
  2. 启用 DFS 文件系统支持(配置 RT_USING_DFS,使用 V1 实现);
  3. 在 Keil MDK 中切换到 ARM Compiler 6(armclang);
  4. 构建工程。

4. 预期结果

编译成功,正常链接 DFS 模块。


5. 实际结果

编译失败,出现以下错误:

armclang: error: unknown argument: '--c99'

6. 其他信息(建议)

问题分析:

components/dfs/dfs_v1/SConscript 中存在如下代码:

if rtconfig.PLATFORM == 'armcc':
    LOCAL_CFLAGS += ' --c99'

由于当前使用的是 armclang(ARM Compiler 6),虽然 PLATFORM 仍被设置为 'armcc',但 armclang 实际不支持 --c99 参数,导致构建失败。


建议修复方式:

将上述代码修改为:

if rtconfig.PLATFORM in ['gcc', 'clang']:
    LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM == 'armcc':
    LOCAL_CFLAGS += ' --c99'

或直接将当前文件中的:

LOCAL_CFLAGS += ' --c99'

改为:

LOCAL_CFLAGS += ' -std=c99'

即兼容 Clang 工具链使用的参数,防止误用 --c99


Other additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions