build doesn't recognize zephyr files

Hello,

im trying to do the first exercise in DevAcademy (https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/advertising-process/) and i downloaded the relevent git aip file and opened a new project. its path is: C:\nordic\BLEexample\bt-fund\lesson1\blefund_less1_exer1

and my zephyr files are in : C:\ncs\v1.9.0\zephyr\include\sys\printk.h

the CMakeLists.txt are are as downloaded:

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(NONE)

# NORDIC SDK APP START
target_sources(app PRIVATE
src/main.c
)

# NORDIC SDK APP END
zephyr_library_include_directories(.)

and i the build fails:
Building blefund_less1_exer1
west build --build-dir c:/nordic/BLEexample/bt-fund/lesson1/blefund_less1_exer1/build_1 c:/nordic/BLEexample/bt-fund/lesson1/blefund_less1_exer1

[59/215] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj
C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DBUILD_VERSION=v2.7.99-ncs1 -DDEVELOP_IN_NRF52833 -DKERNEL -DNRF52820_XXAA -DNRFX_COREDEP_DELAY_US_LOOP_CYCLES=3 -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I../. -IC:/ncs/v1.9.0/nrf/drivers/mpsl/clock_control -IC:/ncs/v1.9.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v1.9.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs/v1.9.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v1.9.0/zephyr/subsys/bluetooth -IC:/ncs/v1.9.0/zephyr/subsys/settings/include -IC:/ncs/v1.9.0/nrf/include -IC:/ncs/v1.9.0/nrf/lib/multithreading_lock/. -IC:/ncs/v1.9.0/nrf/subsys/bluetooth/controller/. -IC:/ncs/v1.9.0/zephyr/drivers/flash -IC:/ncs/v1.9.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v1.9.0/modules/hal/nordic/nrfx -IC:/ncs/v1.9.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v1.9.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v1.9.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v1.9.0/modules/debug/segger/SEGGER -IC:/ncs/v1.9.0/modules/debug/segger/Config -IC:/ncs/v1.9.0/zephyr/modules/segger/. -IC:/ncs/v1.9.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v1.9.0/nrfxlib/mpsl/include -IC:/ncs/v1.9.0/nrfxlib/mpsl/include/protocol -I../~C:/ncs/v1.9.0/zephyr/include -IC:/ncs/v1.9.0/nrfxlib/softdevice_controller/include -IC:/ncs/v1.9.0/zephyr/include/posix -isystem C:/ncs/v1.9.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -Os -imacros C:/nordic/BLEexample/bt-fund/lesson1/blefund_less1_exer1/build_1/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros C:/ncs/v1.9.0/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/nordic/BLEexample/bt-fund/lesson1/blefund_less1_exer1=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v1.9.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v1.9.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles\app.dir\src\main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c ../src/main.c
../src/main.c:11:10: fatal error: zephyr/sys/printk.h: No such file or directory
11 | #include <zephyr/sys/printk.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[68/215] Linking C static library zephyr\lib\libc\minimal\liblib__libc__minimal.a
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\nordic\BLEexample\bt-fund\lesson1\blefund_less1_exer1\build_1'

* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

any idea why?

  • I am running into the same problem, which is good in a way. Then we know that this isn't really a symptom of there being anything wrong with your SDK.  

    Raz_k said:

    However, when i build with the nRF52840DK_nrf52840 it is able to build and flash(using J-link) successfully.

    So you do have a DK on hand as well?

    The nRF9160 doesn't have BLE capabilities, so you shouldn't build anything in the BLE fundamentals course for that SoC. Another thing is that the Thingies (Thingy91 and Thingy53) might be a bit harder to work with. I would recommend using a development kit (DK) instead. For parhaps a better breakdown of the difference between the two, see here.

    Raz_k said:
    But im having trouble understanding how to test the program, since im connected via J-link and there is no outputs in the viewer app. In addition the device doesnt recognize my USB data cable.

    Is this to the Thingy or the DK? The Thingy does not have an OB debugger, which might be the issue.

    Regards,

    Elfving

Related