Help with GPIO and delay linking issues

I realize that this question will be stupid simple.  I can program AVR microcontrollers with no trouble.  The setup in the Segger embedded studio seems far more cumbersome.  I am trying to write a simple blinky program with an existing production board.  The program compiles but the link fails.  The program is below and the linking error also.  I realize this is simple.  please be kind.

#include <stdio.h>
#include <stdlib.h>
#include <nrf52810.h>
#include <nrf_gpio.h>
#include <nrf_delay.h>

/*********************************************************************
*
*       main()
*
*  Function description
*   Application entry point.
*/
#define LED1_PIN 38

int main (void)
{
   nrf_gpio_cfg_output(LED1_PIN);
   nrf_gpio_pin_clear(LED1_PIN);
   while(1)
   {
       nrf_gpio_pin_toggle(LED1_PIN);
       nrf_delay_ms(1000);
   }
}

  • Hi,

    In addition to including the header file in main.c, you must also add source and include files manually to the project in SEGGER Embedded Studio.

    To add source files, right click on one of the folders under the project in the Project Explorer that you want to add it to, select 'Add Existing File' and find the source file to add.

    For the include files, right click on the project in Project Explorer and select Options. Make sure that the configuration is set to Common and not Debug or Release. Go to Preprocessor -> User Include Directories. Here you should add the path to the include file. This must be the correct path according to where the project file is, so if you for example want to add the file nrf_gpio.h (located in <SDK_ROOT>/modules/nrfx/hal) to ble_app_blinky the path is ../../../../../../modules/nrfx/hal.

    Best regards.

    Marte

Related