I'm starting to look at using Ceedling (+Unity + CMock) for some test driven development but am having trouble getting tests that use/mock the SDK. I'm currently trying to set up unit tests for a custom ble service (an SDK equivalent would be any of the files in the components\ble\ble_services folder) that will run on my PC, not on the target. I am using Cygwin and gccDoes anyone have any experience/guidance/project files for how to set this up?My current yml file looks like this
I am using python to extract include paths and defines from my Keil project file and generate another yml file that I include when running ceedling e.g.
ceedling options:NRF52_S332_SDK153 test:all
this is so i can run tests for each of the targets for my project.I'm currently stuck with errors like
../libnordic/v15.3/components/softdevice/s332/headers/ble.h: In function 'sd_ble_user_mem_reply':../libnordic/v15.3/components/softdevice/s332/headers/nrf_svc.h:68:5: error: unknown register name 'r0' in 'asm' __asm( \ ^.
I have included mock_ble.h in my test file.
#include "unity.h" #include "ble_my_service.h" #include "mock_ble.h" #include "mock_ble_gap.h" void setUp(void) { } void tearDown(void) { } void test_ble_my_service_NeedToImplement(void) { TEST_IGNORE_MESSAGE("Need to Implement ble_my_service"); }
Sorry for resurrecting an old thread.
I have Ceedling working well for my project which uses the Nordic SDK + GCC.
Please be sure to include all relevant defines in your project.yml. Mine looks like this:
: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) :common: &common_defines - NRF52 - NRF52832 - UNIT_TEST - FREERTOS :test: - *common_defines - TEST :test_preprocess: - *common_defines - TEST