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

West tool using zephyr does not build Servo-motor example for nRF52840 DK

Hello! 

I am a beginner trying to learn Zephyr using nRF52840 DK. 

I tried to build the example present in the zephyr's samples/basic/servo_motor directory. 

I made necessary changes such as changing the name of the overlay file and including the board name in the sample.yaml

Here's the log message:

-- west build: generating a build system
Including boilerplate (Zephyr base): /home/skandaprasad/sp_data/career/internships/technoculture_research/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/servo_motor
-- Zephyr version: 2.6.99 (/home/skandaprasad/sp_data/career/internships/technoculture_research/zephyr), build: zephyr-v2.6.0-692-gfadc5d15a3b5
-- Found Python3: /usr/bin/python3.9 (found suitable exact version "3.9.5") found components: Interpreter
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52811
-- Cache files will be written to: /home/skandaprasad/.cache/zephyr
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Using toolchain: zephyr 0.12.4 (/home/skandaprasad/zephyr-sdk-0.12.4)
-- Found dtc: /home/skandaprasad/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/skandaprasad/sp_data/career/internships/technoculture_research/zephyr/boards/arm/nrf52840dk_nrf52811/nrf52840dk_nrf52811.dts
-- Found devicetree overlay: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/servo_motor/boards/nrf52840dk_nrf52811.overlay
-- Generated zephyr.dts: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/include/generated/device_extern.h
Parsing /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/servo_motor/Kconfig
Loaded configuration '/home/skandaprasad/sp_data/career/internships/technoculture_research/zephyr/boards/arm/nrf52840dk_nrf52811/nrf52840dk_nrf52811_defconfig'
Merged configuration '/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/servo_motor/prj.conf'
Configuration saved to '/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/.config'
Kconfig header saved to '/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/skandaprasad/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build
-- west build: building application
[1/150] Preparing syscall dependency handling

[143/150] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map
: && ccache /home/skandaprasad/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -fuse-ld=bfd -Wl,-T zephyr/linker_zephyr_prebuilt.cmd -Wl,-Map=/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/i2c/libdrivers__i2c.a zephyr/drivers/pwm/libdrivers__pwm.a zephyr/drivers/serial/libdrivers__serial.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/home/skandaprasad/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/thumb/v7e-m/nofp" -L/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn && cd /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build/zephyr && /usr/bin/cmake -E echo
/home/skandaprasad/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(main.c.obj): in function `main':
/home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/servo_motor/src/main.c:48: undefined reference to `__device_dts_ord_6'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/skandaprasad/sp_data/career/internships/technoculture_research/ZephyrPlayground/build

I have even tried to add a Kconfig to the application folder which was non-existent earlier. It made no difference.

Any insights into this matter would be helpful.

Other details:

OS: Pop!_OS 21.04 x86_64

Board: nRF52840 Development Kit

Thank you. If required, I am ready to share my files.

Related