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

How to add driver to an SDK example, in Segger Embedded Studio?

I'm a beginner to programming nRF devices in C, trying to graduate from Arduino (i.e. kindergarten).

I've installed Segger Embedded Studio and can compile and run SDK examples just fine. I'm able to tinker with the c source code successfully, use the debugger, run examples. So nice, so far!

Now I need to build an app that is based on heart rate client (ble_app_hrs_c), but has additional features, such as reporting out via the UART. So I start with ble_app_hrs_c (I'll call it the core example), and add in other drivers/libraries needed, in this case nrf_serial.

But I'm confused about the steps to do this. Here's what I'm doing. Sometimes it works, sometimes I get lost:

  1. Load the core example project in SES, confirm everything compiles and runs.
  2. To the #include section of main.c, add any #includes needed for new driver/library
  3. In SES > Project > Options > Preprocessor > User Include Directories, make sure there is a path to that new driver/library under the SDK components folder. (It wasn't already there for the nrf_serial library/)
  4. In SES > Project Explorer, navigate to appropriate folder (nRF_Drivers or nRF_Libraries), right click and choose Add Existing File, and navigate to the .c source file for that driver/library within the SDK components folder. Sometimes this works, but sometimes I have to right-click and manually compile that code before SES makes it part of the build. Why?
  5. Sometimes a compile/build shows up other missing libraries (in the case of nrf_serial, I found the nrf_queue library was missing and had to add it the same way.
  6. What about the sdk_config.h file? Sometimes there's an obvious Enable for the driver/library, sometimes not (e.g., there was no #define nrf_serial_enabled in my core example).

I've tried reading the SES manual, but it's designed for more advanced users who understand c compiling and linking, which I don't quite get yet (because Arduino hid all that).

BTW: a blog post on "Graduating to SES and nRF from Arduino" would be very helpful.

Thank you for any help you can provide.

Related