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

Halting at SVCall(SD_SOFTDEVICE_ENABLE, ...)

Hi,

I'm trying to write unit tests and have arrived at the point to write tests for ble characteristic addition to a service.

To offer some background, I have written a test harness called Yoke that will flash an Intel Hex file to a nRF52832 device that has been compiled with unit tests written using the Unity C framework. The hex file will output test results to the UART peripheral that Yoke receives to present the results on a web page. Having just written this framework, I have had very good success integrating the SPI peripheral into my project.

The challenge now is integrating the soft device into the test harness. Borrowing heavily from the ble_peripheral examples, I can compile a unit test to add a characteristic to a service and run assertions on whether the set_value, get value calls return the expected value.

My problem - which is the focus of this question - is the code execution halts at SVCall(SD_SOFTDEVICE_ENABLE, ...) as presented by Segger's Ozone utility. Indeed, Ozone seems to indicate that although subsequent "step" commands are issued, the PC register does not advance. Having the CPU continue from this point and issuing a subsequent "halt" leaves the PC precisely where is was before.

Initially, I was not flashing the softdevice, but I have recently accommodated this concern and I still have the same behaviour.

Therefore, I am impressed I am missing some Makefile entry or some other aspect that will properly execute the SVCall.

I have included a screen shot of the Ozone information that, hopefully, may help indicate what I may be missing.

Screen Shot 2017-09-17 at 1.11.39 PM.png

Thanks

notes.jlinkscript.20170925.001.txt

Makefile

  • The problem was in the linker script as it was setting the Flash origin to 0x0. This was interfering with the Soft Device's flash.

    diff experimental_ble_app_blinky_gcc_nrf52.ld uart_gcc_nrf52.ld 8,9c8,9

    < FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x64000

    < RAM (rwx) : ORIGIN = 0x20002080, LENGTH = 0xdf80

    --

    > FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x80000

    > RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000

    By using a Makefile from a BLE example with appropriate modifications to handle my code, I ran into the linker script contamination. Upon updating the correct linker script, I can now execute unit tests using the Soft Device.

    Thank you for your suggestions and encouragement.

Related