This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TDD with SoftDevice

I'm trying to use TDD for my development of a BLE peripheral application, but I'm running into some problems. I'm using Ceedling, CMock, and Unity for my TDD environment, but I'm running into issues mocking the SDK files. I'm using a standard x86 compiler because I want to run the unit tests locally, so it's unable to parse the inline assembly. Has anyone else tried to use these tools and if so, how did you get around this?

EDIT: Adding code example:

test_uart.c

#include "mock_ble.h"

#include "mock_ble_nus.h"

...

void test_init(void) {

ble_nus_t nus;

TEST_ASSERT_EQUAL_INT(0, uart_init(&nus));}

uart.c

uart_init(ble_nus_t* nus) {

g_nus = nus;

APP_UART_FIFO_INIT(...); ...}

Example error message:

ble.h: In Function 'sd_ble_opt_get': nrf_svc.h:66:5: error unknown register name 'r0' in 'asm'

ble.h:622:1: note: in expansion of macro 'SVCALL' SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt));

Parents
  • Well r0 is an ARM register so if you are using an x86 environment clearly it won't compile. There's probably a very small part of the SDK which will compile under any OS, but anything at all which deals with the chip registers, any assembler, anything to do with the softdevice .. is not going to compile or work in any way at all.

    I'm really not sure what you're trying to accomplish here, but I don't see how you're going to do anything useful at all with the small part of the SDK which isn't tied to the chip and the architecture.

Reply
  • Well r0 is an ARM register so if you are using an x86 environment clearly it won't compile. There's probably a very small part of the SDK which will compile under any OS, but anything at all which deals with the chip registers, any assembler, anything to do with the softdevice .. is not going to compile or work in any way at all.

    I'm really not sure what you're trying to accomplish here, but I don't see how you're going to do anything useful at all with the small part of the SDK which isn't tied to the chip and the architecture.

Children
No Data
Related