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

Compiling with SDK on desktop for unit testing

Hi,

I am working on a product based on an nRF52832.

For testing purposes, I have setup the Unity testing framework (using Ceedling).

As soon as a module I want to test includes a file from the nrf5 SDK, I get compiler error :

First I had issues with __STATIC_INLINE. I then added a define for __unix so that nrf.h would not include the hardware specifics headers. I then added a definition for __STATIC_INLINE through a -D compiler option.

Now my problem is that I get undefined errors from modules using IRQs (as IRQn_Type is defined in nrf52.h that is therefore not included).

Is there a proper way to run the SDK files on a desktop / host without having to redefine all these ?

Is anyone else using Unity testing framework to test their modules on a desktop / server setup (not on target) ?

Regards

Parents Reply Children
  • The thing here is that I do not want to actually execute any of the driver code :

    If I have a module that uses the RTC for example by calling the nrf_drv_rtc driver, I would like to be able to mock the driver part and test only my module.

    The problem I have here is that the header file of the driver goes on including a lot of target-specific header files.

    The reason I'm asking this post here is that I have found in the nrf.h file the following section that make me think that running on Host platform should be doable :

    #if defined(_WIN32)
        /* Do not include nrf specific files when building for PC host */
    #elif defined(__unix)
        /* Do not include nrf specific files when building for PC host */
    #elif defined(__APPLE__)
        /* Do not include nrf specific files when building for PC host */
    #else

Related