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

nRF52 and gcc makefile

Hi,

I am trying to develop firmware for the nRF52 platform using Visual Studio, as I prefer VS over Keil. I came across the VisualGDB plugin, but it seems their BSP is currently not compatible with current nRF52 examples, and I haven't found a way to get VisualGDB to use the Nordic SDK instead of the SDK files it downloads automatically.

In order to gain more control of the toolchain I configured VisualGDB to use the Makefile provided in your examples (i.e. \pca10040\s132\armgcc\Makefile) instead of letting it generate its own Makefile. This works fine; compiling and flashing works perfectly. The problem is, however, that this Makefile does not generate an ELF file, which makes JLink debugging impossible. Is there any way I can alter the Makefile so that it generates the files needed to use the JLink debugger with VisualGDB? Do I need to use the Keil compiler instead?

Any help is much appreciated.

Update (a few hours later) I just stumbled across the fact that files with the *.out extension actually are ELF files. It seems that this tutorial has the solution, then. I will try updating the CFLAGS variable as shown under "Setting up a project for debugging in Eclipse" and pointing the JLink to the project .out file (in the _build folder) tomorrow.

  • I pointed JLink to the .out file created during make, and I am now able to debug and read the internal registers. Everything seems in order!

    For future reference, this is what I did:

    • Installed GnuWin32 so that the UNIX commands used by the Makefile would work
    • Made an SDK_PATH variable pointing to the nRF52_SDK folder and replaced "abspath ../../../../../../" with $(SDK_PATH)/ in both the C_SOURCE_FILES and INC_PATHS list
    • Set the VisualGDB Build Command (Project->VisualGDB Project Properties->Build Settings) to "cmd.exe /c make". Also removed everything in "Additional Environments".
    • Added the relevant SDK paths to Intellisense Directories
Related