Ceedling ARM STM32的CMock设置

Ceedling ARM STM32的CMock设置,c,mocking,arm,stm32,cmock,C,Mocking,Arm,Stm32,Cmock,我一直在为STM32设置Ceedling。howto非常稀少,到目前为止,我几乎什么也没用谷歌搜索过。幸运的是,该框架的大小相对透明。是一个PIC配置。我设置了类似的(project.yml): 到目前为止还不错(还没有真正的工作尝试)。增加了这一定义 - CMOCK_MEM_PTR_AS_INT=uint32_t 我有一个警告: /vendor/ceedling/vendor/cmock/src/cmock.c:105:40: warning: cast from pointer t

我一直在为STM32设置Ceedling。howto非常稀少,到目前为止,我几乎什么也没用谷歌搜索过。幸运的是,该框架的大小相对透明。是一个PIC配置。我设置了类似的(
project.yml
):

到目前为止还不错(还没有真正的工作尝试)。增加了这一定义

    - CMOCK_MEM_PTR_AS_INT=uint32_t
我有一个警告:

/vendor/ceedling/vendor/cmock/src/cmock.c:105:40: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   index = *(CMOCK_MEM_INDEX_TYPE*)((CMOCK_MEM_PTR_AS_INT)next - CMOCK_MEM_INDEX_SIZE);
难怪,因为
next
是PC平台的64位指针。但我仍然不确定是否必须控制
CMOCK\u MEM\u PTR\u AS\u INT
。这取决于
CMOCK\u MEM\u PTR\u AS\u INT
是否是关键目标(ARM)平台定义


到目前为止,我还没有找到STM32示例。

下面是来之不易的序列,包括Eclipse集成:

安装Ceedling:

$ gem install ceedling
创建Ceedling项目(疑难解答):

修改供应商/ceedling/plugins/module\u generator/config/module\u generator.yml:

...
:defines:
  # in order to add common defines:
  #  1) remove the trailing [] from the :common: section
  #  2) add entries to the :common: section (e.g. :test: has TEST defined)
  :commmon: &common_defines #[]
    - STM32F103xB
    - UNITY_INT_WIDTH=32
    - CMOCK_MEM_INDEX_TYPE=uint32_t
    - UNITY_LINE_TYPE=uint16_t
  :test:
    - *common_defines
    - TEST
  :test_preprocess:
    - *common_defines
    - TEST
:module_generator:
  :project_root: ./
  :source_root:  Src/
  :inc_root:     Inc/
  :test_root:    test/
...
:paths:
  :test:
    - +:test/**
    - -:test/support
  :source:
    - Src/**
  :include:
    - Drivers/**
    - Inc/**
  :support:
    - test/support
...
:defines:
  :commmon: &common_defines  # A nice typo, next to invisible :)
    - STM32F103xB
...
:cmock:
  :strippables:
    - volatile
...
:plugins:
  :load_paths:
    - vendor/ceedling/plugins
  :enabled:
#    - stdout_pretty_tests_report
    - stdout_gtestlike_tests_report
    - module_generator
修改
project.yml

...
:defines:
  # in order to add common defines:
  #  1) remove the trailing [] from the :common: section
  #  2) add entries to the :common: section (e.g. :test: has TEST defined)
  :commmon: &common_defines #[]
    - STM32F103xB
    - UNITY_INT_WIDTH=32
    - CMOCK_MEM_INDEX_TYPE=uint32_t
    - UNITY_LINE_TYPE=uint16_t
  :test:
    - *common_defines
    - TEST
  :test_preprocess:
    - *common_defines
    - TEST
:module_generator:
  :project_root: ./
  :source_root:  Src/
  :inc_root:     Inc/
  :test_root:    test/
...
:paths:
  :test:
    - +:test/**
    - -:test/support
  :source:
    - Src/**
  :include:
    - Drivers/**
    - Inc/**
  :support:
    - test/support
...
:defines:
  :commmon: &common_defines  # A nice typo, next to invisible :)
    - STM32F103xB
...
:cmock:
  :strippables:
    - volatile
...
:plugins:
  :load_paths:
    - vendor/ceedling/plugins
  :enabled:
#    - stdout_pretty_tests_report
    - stdout_gtestlike_tests_report
    - module_generator
Eclipse C/C++单元插件配置:

  • 主要/项目:myproject

  • 主/应用程序:
    /home/user/.gem/ruby/2.5.0/bin/ceedling

  • 主/禁用自动生成

  • 参数/程序参数:clobber\n测试:全部

  • 测试/测试运行程序:Google测试运行程序

  • 环境:可变项值xterm