Since trying to change the compiler to arm-none-eabi-gcc caused CLion to go into an infinite loop, I decided to keep the default C compiler while disabling compiler macros and adding the _GNUC_ macro instead: list(APPEND CFLAGS "-undef" "-D_GNUC_") list(FILTER CFLAGS EXCLUDE REGEX mcpu) Debugging the nRF52 with CLion Prerequisitesġ. This CMakeLists.txt file is still not good enough, CLion is going to try and use the system’s default C compiler for generating the compiler’s macros, this results in macros such as _APPLE_ or _LINUX_ being enabled and we do not want that. It also adds the include_directories(), project() and add_executable() commands. The Makefile reads the relevant variables from the project’s Makefile and translates them into CMake variables. Since this might overload CLion, all of the sub-projects are commented out and we should uncomment the ones we want to use. At last it creates a main CMakeLists.txt that includes all of the other sub-projects. The script creates a Makefile that generates a CMakeLists.txt file for an existing project, then runs it for each example project in the SDK. You can check this GitHub repository for the source code. Trying to import the nRF5-SDK to CLion is not a pretty sight, most definitions and declarations are not found and the ones that are found might be incorrect or have multiple declarations. By parsing the CMakeLists.txt files in your project, CLion, figures out where the definitions and declarations are, letting you navigate through the code (i.e. CLion and nRF52 - How Does it Work?ĬLion is awesome, with one downside, it only works with CMake. The way I see it CLion is like your everyday car, it is comfortable, easy to ride and gets you quickly to your destination, using IAR for code navigation is like driving a tank for taking your kids to school. I agree that sometimes you are going to need a dedicated tool and even Eclipse with the GNU ARM Eclipse plugins can probably do more than CLion when it comes to reading registers and memory analysis. I know what you’re thinking, you can’t beat IAR when it comes to the deep debugging of your insanely optimized stack. My favorite IDE for C development is JetBrain’s CLion, unlike other IDEs used for embedded programming, it has brilliant autocomplete, refactoring and navigation features. If you did some work in the distant world of high-level programming such as JS or Python you probably know how helpful a good IDE can get. If you got here, you are probably an embedded software engineer as I am. From CLion, go to File → Open and choose the root directory of the nRF5-SDK.Open “./CMakeLists.txt” and uncomment the desired project’s path (you can uncomment multiple projects).cd into the root of the nrf5-SDK directory.(optional) Create a backup for your current nrf5-SDK directory.For debugging go to “Debugging the nRF52 with CLion” below. If you just want to navigate (without debugging) through the nRF5-SDK using CLion, follow the following steps.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |