首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >调整ARM CMock STM32设置

调整ARM CMock STM32设置
EN

Stack Overflow用户
提问于 2018-03-09 11:07:41
回答 1查看 2.2K关注 0票数 2

我一直在为STM32设置Ceedling。如何操作是非常稀缺的,到目前为止,我已经设法谷歌几乎一无所有。幸运的是,该框架的大小相对透明。是事先知情同意的配置。我设置了类似的东西(project.yml):

代码语言:javascript
复制
...
: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

到目前为止还不错(还没有真正的尝试)。添加了这个定义

代码语言:javascript
复制
    - CMOCK_MEM_PTR_AS_INT=uint32_t

我有个警告:

代码语言:javascript
复制
/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是一个64位指针的PC平台.不过,我根本不确定我是否需要控制CMOCK_MEM_PTR_AS_INT。这取决于CMOCK_MEM_PTR_AS_INT是否是关键目标(ARM)平台定义。

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-24 13:56:21

下面是来之不易的序列,与Eclipse集成一起完成:

安装Ceedling:

代码语言:javascript
复制
$ gem install ceedling

创建Ceedling项目(疑难解答#215):

代码语言:javascript
复制
myproject $ cd ..
$ ceedling new myproject
$ cd myproject/vendor/
$ rm -rf ceedling/
$ git clone --recursive https://github.com/throwtheswitch/ceedling.git

修改vendor/ceedling/plugins/module_generator/config/module_generator.yml

代码语言:javascript
复制
:module_generator:
  :project_root: ./
  :source_root:  Src/
  :inc_root:     Inc/
  :test_root:    test/

修改project.yml

代码语言:javascript
复制
...
: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++单元插件配置:

  • 主要/项目:我的项目
  • 主要/应用程序:/home/user/.gem/ruby/2.5.0/bin/ceedling
  • 主/禁用自动生成
  • 参数/程序参数:clobber\n ntest:all
  • 测试/测试运行程序:
  • 环境:可变项值x项
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49192395

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档