Compiling github projects

Hi,

After downloading any of the projects from nordic github, how does one compile the project successfully? Where should i extract the files to and what paths should i include? I have not been able to get a single project working, any help with this issue would be a massive help,

Thanks!

  • Hi

    The github examples are meant to be used with the ".zip version" of the SDK, not the Pack version. image description

    Using the Packs makes it easy to setup examples included in the Pack, but once you want to do something else it suddenly gets complicated. Therefore we generally recommend using the ".zip version". Your example files should (in most cases) be extracted to "[SDK]/examples/ble_peripheral". For example, if I am to try the PWM Library example I will extract it so that the main.c file ends up at

    "[my_SDK_folder]\examples\ble_peripheral\nrf51-pwm-library-master\main.c"
    

    In our SDK all examples demonstrating the nRF51 as a peripheral is placed in the "ble_peripheral" folder. All examples demonstrating the nRF51 as a central is placed in the "ble_central", etc. You are not, however, required to use these folders. You can, e.g. make a folder structure like

    "[my_SDK_folder]\examples\your_example_folder\nrf51-pwm-library-master\main.c". 
    

    The important thing is the number of "folder layers" down to the main SDK folder so that the compiler knows where to find other drivers and components.

  • Thank you for this, a big help! I would recommend mentioning this on the nordic github read me as i spent so long trying to copy files etc, was a nightmare! I managed to download and compile your advertising example "nrf51-ble-tutorial-advertising" fine. The example i am interested in however is "ble_app_uart_c_S120". After following your methods (this time extracting to ble_central) the project will not compile again stating "no source". Sorry to nag on this same problem but is there something futher i must do for the central example? Thanks!

  • Thank you for your suggestion. I have updated the readme file. The reason why the ble_app_uart_c_S120 example doesn't work is because the author of the example has zipped it "wrong" (there has always got to be an exception to the rule you know). What you need to do is to copy paste the folder called "ble_app_uart_c" inside the "ble_app_uart_c_S120" folder that you have extracted. After you have done this the file structure will look like this: "[my_SDK_folder]\examples\ble_central\ble_app_uart_c\main.c". Notice that main.c now resides 4 "folder layers" above your base SDK folder. This is important because main.c, and other project files in your example, are referencing files relative to your example folder.

  • ahh i see, this has resolved my issue and it has finally compiled. Thank you very much for all your help