This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to set path for harder file ?

hello sir,

i am using segger to program nrf9160 . i have successfully uploaded sample sketch for blink led using "" open NRF Connect SDK "  option. Now i want to create  a new project . 

i uploaded same code for blink as given in example , on but compiler sow error for header files. please help me i have do lot of practice but don't found any solution. how set path for header files.

/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   2000

/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)

#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0	DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN	DT_GPIO_PIN(LED0_NODE, gpios)
#define FLAGS	DT_GPIO_FLAGS(LED0_NODE, gpios)
#else
/* A build error here means your board isn't set up to blink an LED. */
#error "Unsupported board: led0 devicetree alias is not defined"
#define LED0	""
#define PIN	0
#define FLAGS	0
#endif

void main(void)
{
	const struct device *dev;
	bool led_is_on = true;
	int ret;

	dev = device_get_binding(LED0);
	if (dev == NULL) {
		return;
	}

	ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
	if (ret < 0) {
		return;
	}

	while (1) {
		gpio_pin_set(dev, PIN, (int)led_is_on);
		led_is_on = !led_is_on;
		k_msleep(SLEEP_TIME_MS);
	}
}

ERROR:      'zephyr.h' file not found  

i  

  • Hi,

    Can you explain the steps you made to create your own project, and how you opened it?

    What does your CMakeLists.txt file look like?

    Best regards,

    Marte

  • mam , thanks for reply.

    1. installed tool chain manager for desktop.(tool chain manager vr. 1.9.1)

    2. install command line tool .

    3. install j link and segger ide and opne nrf connect project - blink select nrf9160 clean builds

    and build and run. by  this code successfully uploaded and led start blinkin.

    after that i click on new project . select location .>> select with current solution >> and copy blink code in main.c file 

    . on compiling  sketch show header file not found .

    i think there was problem with header file path . i don't know hoe correct it.

    either i have try with VS code and follows the steps  showing in   nordic   official YouTube channel .

    on setting build directory it show include path error .

    please mam suggest me right way to do this........please help me 

  • Hi,

    So you create the new project using SES? This is not the correct way to create a new project.

    Did you try following the guide linked to you in your two previous cases, nRF Connect SDK Tutorial series - Part 1? The project explorer in SES should not look like as it does in the picture you uploaded, which makes me suspect that you are either missing some files in your project, such as CMakeLists.txt and prj.conf, or that you are not opening the project correctly (using Open nRF Connect SDK project).

    Mohit Nama said:

    either i have try with VS code and follows the steps  showing in   nordic   official YouTube channel .

    on setting build directory it show include path error .

    Can you give more details about this error? Did you get it on the New Application page when selecting application location, or was it an error you got during building? What was the error?

    Best regards,

    Marte

  • yes mam i get new application page when selecting application location .

    ERROR: cannot open source file "device.h"

Related