我已经为STM32设立了Ceedling。该howto是非常稀缺的,到目前为止,我设法谷歌几乎没有。幸运的是,该框架的规模相对透明。 This是PIC配置。我设置了类似的东西(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
到目前为止一直很好(尚未尝试过真正的工作)。添加了这个定义
- 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_MEM_PTR_AS_INT
。这取决于CMOCK_MEM_PTR_AS_INT
是否是关键目标(ARM)平台定义。
到目前为止,我还没有找到STM32的例子。
答案 0 :(得分:1)
这是艰难的序列,完成了Eclipse集成:
安装Ceedling:
" "
创建Ceedling项目(疑难解答#215):
$ gem install ceedling
修改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
修改:module_generator:
:project_root: ./
:source_root: Src/
:inc_root: Inc/
:test_root: test/
:
project.yml
Eclipse C / C ++单元插件配置:
主要/项目:myproject
主要/申请:...
: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
主要/禁用自动构建
参数/程序参数:clobber \ ntest:all
测试/测试亚军:Google Test Runner
环境:可变期限值xterm