如何在IAR编译器中创建test.out文件以适用Unity Ceedling测试框架

问题描述 投票:0回答:1

我正在尝试使用 IAR 编译器实现 Unity Ceedling 测试框架。但 Ceedling 要求提供测试的 .out 文件,但 IAR 仅生成项目输出文件。如何解决这个问题或者用IAR为测试文件创建一个out文件。

在我的工具部分我给出了

:test_compiler:
    :executable: IarBuild.exe
    :name: 'IAR test compiler'
    :arguments:
      - path to the project.ewp                
      - '-build'              # Command to perform a build
      - 'Build configuration name '               # The build configuration name

// 这会从此命令生成一个 .out 文件。尝试使用 IAR 命令,但在运行时显示错误,因此将其删除。

  :test_linker:
    :executable: ilinkarm.exe
    :name: 'IAR test linker'
    :arguments:
      - --vfe  #Very Fast Executable mode.
      - --redirect _Printf=_PrintfFull
      - --redirect _Scanf=_ScanfFull
      - --config "path to generic_cortex.icf"
      - --map "path to project.map"
      # Additional flags can be added here if needed in the future
      # - -o "path to the project.out folder"
        
  :test_fixture:
    :executable: CSpyBat.exe
    :name: 'CSpyBat test runner'
    :arguments:
      - --backend
      - simulator
      - --plugin
      - '"path to armproc.dll"'
      - '"path to jlinkarm.dll"'
      - '"path to armsim2.dll"'
      - --plugin "path to armbat.dll"

错误信息: 错误[Li005]:“__iar_program_start”没有定义[程序条目] 致命错误[Li010]:没有要链接的模块 检测到致命错误,正在中止。 错误:Shell 命令失败。

Shell执行命令: 'ilinkarm.exe --vfe --redirect _Printf=_PrintfFull --redirect _Scanf=_ScanfFull --config "generic_cortex.icf" --map "project_name.map"' 产生的输出: 适用于 ARM 的 IAR ELF 链接器 V8.50.9.278/W32 版权所有 2007-2020 IAR Systems AB。 并退出,状态为:[3]。

注意:如果链接器报告缺少符号,则可能是由于以下原因造成的:

  1. 测试缺少与所需源文件对应的#include语句。
  2. 项目搜索路径不包含测试中#include语句对应的源文件。
  3. 测试不#include 所需的模拟。

耙子中止!

C:/Ruby27-x64/bin/ceedling:23:in

load' C:/Ruby27-x64/bin/ceedling:23:in 
'

原因: ShellExecutionException:ShellExecutionException C:/Ruby27-x64/bin/ceedling:23:in

load' C:/Ruby27-x64/bin/ceedling:23:in 
' 任务: TOP => build/test/results/test_file.pass => build/test/out/test_file.out (通过使用 --trace 运行任务查看完整跟踪) 错误:传送失败

unit-testing iar ceedling
1个回答
0
投票

考虑将 :test_compiler: 更改为 iccarm.exe(相应地调整参数)。 IARBuild 是命令行构建工具而不是编译器。

将以下内容添加到您的project.yml(如果尚未存在):

:extension:
  :executable: .out

这里还有一个使用 IAR C/Cpp 编译器进行 RX 的 Ceedling 配置示例:https://stackoverflow.com/a/77493081/22832892

© www.soinside.com 2019 - 2024. All rights reserved.