I am trying to port an nRF51 project that runs on the nRF51 DK using Keil to the nRF52840 DK using Segger Embedded Studio. Clearly the best way to start is to take an example from the SDK which has all the Segger-specific stuff and hardware specific stuff and change those few files which the app developer actually writes (like main.c) and update for the new SoftDevice
In my case the Keil project uses SoftDevice calls for all the Bluetooth functionality and Flash. It handles the sd_ble_evt_get() and dispatching of events. I know I will have to make a few modifications because there are changes in SoftDevice s130 to SoftDevice s140 but they are not extensive. However, the sdk_config.h file changes ARE huge and I don't know what 90% of it means. Is there any detailed documentation describing what all these config parameters mean? A few are obvious to me like turning off the service support like CTS, DIS, BATtery, etc. This project is an implementation of a proposed protocol and there is no support in the SDK for it. So I want to turn off all those items in the sdk_config.h file that I don't need, but I don't want to mess up something that will mess up that which is needed for the chip on the DK.
Eventually I want to remove all the files in the project that I don't need - that's not too easy either. It would be nice to have a final project which ONLY contains those files necessary to build this project.
How to proceed?
nRF52840 is supported from SDK12.3, but only S132. S140 support nRF52840 started from SDK13.0. See SDKs and SoftDevices
I would suggest you start from the ble_app_template in SDK12.3 then migrate to S140 of SDK13.0. You could use https://infocenter.nordicsemi.com/index.jsp to search for the configs in sdk_config.h to understand it. This Migrating from the nRF51 Series to the nRF52 Series might help.
I am using s140 and I am not using the SDK. Though I started with the hts project for segger from SDK 17.3.0 examples. I am trying to eliminate that what I don't need. Most of the content in the sdk_config.h file I do not understand.
This doc Health Thermometer Application can help you understand how to use the example. As I replyed previously, you should use https://infocenter.nordicsemi.com/index.jsp to find the doc of the config in the sdk_config.h.
Of course I have looked through that site. The search engine is poor (as I have pointed out many times) so finding what you need is very time consuming as you have to page through everything yourself. I have found 'documentation' on the sdk_config.h' file but it just lists what's in it ... it does not explain what they mean or what the consequences are from the various settings. You have to guess from the words in the defines. Its kind of like Linux 'man' pages - useless if you don't know what the commands mean, but good if you do and you have forgotten what the details of the settings are.
In any case, I cannot get NRF_LOG to work at all (with or without RTT) and I can only get printf to work with RTT in the 'main' function of main.c. Once a callback event is handled, nothing.
Something is seriously sick.
Absolutely no problem using s130 on the nrf51 DK in a Keil project. (No RTT of course.)
Try porting that SoftDevice only project to SES and the nRF52840 DK using s140 has been a nightmare. Thought it would be easy.
If you want to get RTT log, you need to enable NRF_LOG_BACKEND_RTT_ENABLED and disable NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED in the sdk_config.h as
// <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
#define NRF_LOG_BACKEND_RTT_ENABLED 1
// <q> NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED - For each printed LF, function will add CR.
#define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0