Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CLI in C++ project

Hi,

I'm trying to port a project using nRF5 SDK to C++. One of the desired features would be interaction with the app via J-Link RTT using the command line interface.

CLI library is very easy to use, but it's also very hard-wired to C programming style. I've tried somewhat porting CLI macros like NRF_CLI_CMD_REGISTER to C++ and didn't succeed because it uses named section variables. Trying to use extern "C" and C-style wrappers for C++ functions also didn't get rid of the errors.

I can't either execute C++ functions from the CLI commands or register them. 

Could you point me in some direction if anybody used command line in nRF C++ projects? Porting CLI library or perhaps using another command line handling library, either should be fine

Parents
  • Hi,

    The nRF5 SDK does not support C++, and as you have seen there are quite a few modules that are not easily converted to valid C++ code. This means that you would want to keep the SDK code as C even if you write the rest of your application as C++. You also have to write some glue code and rewrite parts of the CLI code to handle the incompatibilities. Unfortunately, we have not done this task, and do not have a guide.

Reply
  • Hi,

    The nRF5 SDK does not support C++, and as you have seen there are quite a few modules that are not easily converted to valid C++ code. This means that you would want to keep the SDK code as C even if you write the rest of your application as C++. You also have to write some glue code and rewrite parts of the CLI code to handle the incompatibilities. Unfortunately, we have not done this task, and do not have a guide.

Children
No Data
Related