Hello, I´ve been days trying to fix this error, hopefully you can help me PLEASE

(fpga) gabriela@Akane:~/zephyrproject/zephyr$ west build -p always -b litex_vexriscv samples/basic/blinky
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/gabriela/zephyrproject/zephyr/samples/basic/blinky
-- CMake version: 3.26.1
-- Found Python3: /home/gabriela/miniconda3/envs/fpga/bin/python3.10 (found suitable exact version "3.10.9") found components: Interpreter 
-- Cache files will be written to: /home/gabriela/.cache/zephyr
-- Zephyr version: 3.3.99 (/home/gabriela/zephyrproject/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: litex_vexriscv
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.0 (/home/gabriela/zephyr-sdk-0.16.0)
-- Found toolchain: zephyr 0.16.0 (/home/gabriela/zephyr-sdk-0.16.0)
-- Found Dtc: /home/gabriela/zephyr-sdk-0.16.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/gabriela/zephyrproject/zephyr/boards/riscv/litex_vexriscv/litex_vexriscv.dts
-- Generated zephyr.dts: /home/gabriela/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/gabriela/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/gabriela/zephyrproject/zephyr/build/zephyr/dts.cmake
Parsing /home/gabriela/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/gabriela/zephyrproject/zephyr/boards/riscv/litex_vexriscv/litex_vexriscv_defconfig'
Merged configuration '/home/gabriela/zephyrproject/zephyr/samples/basic/blinky/prj.conf'
Configuration saved to '/home/gabriela/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/gabriela/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-zephyr-elf/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc
CMake Warning at /home/gabriela/zephyrproject/zephyr/CMakeLists.txt:835 (message):
  No SOURCES given to Zephyr library: lib_libc_common

  Excluding target from build.


-- Configuring done (3.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/gabriela/zephyrproject/zephyr/build
-- west build: building application
[1/127] Preparing syscall dependency handling

[3/127] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (/home/gabriela/zephyrproject/zephyr), build: zephyr-v3.3.0-2070-g5a6cf526ef2c
[72/127] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -DKERNEL -D_ZEPHYR_=1 -I/home/gabriela/zephyrproject/zephyr/include -I/home/gabriela/zephyrproject/zephyr/build/zephyr/include/generated -I/home/gabriela/zephyrproject/zephyr/soc/riscv/litex-vexriscv -isystem /home/gabriela/zephyrproject/zephyr/lib/libc/minimal/include -isystem /home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/include -isystem /home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/include-fixed -fno-strict-aliasing -Os -imacros /home/gabriela/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=ilp32 -march=rv32ima_zicsr_zifencei --sysroot=/home/gabriela/zephyr-sdk-0.16.0/riscv64-zephyr-elf/riscv64-zephyr-elf -imacros /home/gabriela/zephyrproject/zephyr/include/zephyr/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-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/gabriela/zephyrproject/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/gabriela/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/gabriela/zephyrproject=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 /home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c
In file included from /home/gabriela/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:92,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/toolchain.h:50,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/kernel_includes.h:19,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/kernel.h:17,
                 from /home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c:7:
/home/gabriela/zephyrproject/zephyr/include/zephyr/device.h:83:41: error: '__device_dts_ord_DT_N_ALIAS_led0_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
   83 | #define DEVICE_NAME_GET(dev_id) CONCAT(device, dev_id)
      |                                         ^~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/gabriela/zephyrproject/zephyr/include/zephyr/device.h:83:33: note: in expansion of macro '_CONCAT'
   83 | #define DEVICE_NAME_GET(dev_id) CONCAT(device, dev_id)
      |                                 ^~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/device.h:209:37: note: in expansion of macro 'DEVICE_NAME_GET'
  209 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/device.h:226:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  226 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:316:25: note: in expansion of macro 'DEVICE_DT_GET'
  316 |                 .port = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx)),\
      |                         ^~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:352:9: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
  352 |         GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0)
      |         ^~~~~~~~~
/home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c:20:40: note: in expansion of macro 'GPIO_DT_SPEC_GET'
   20 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
      |                                        ^~~~~~
In file included from /home/gabriela/zephyrproject/zephyr/soc/riscv/litex-vexriscv/soc.h:11,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/arch/riscv/irq.h:26,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/arch/riscv/arch.h:20,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/arch/cpu.h:25,
                 from /home/gabriela/zephyrproject/zephyr/include/zephyr/kernel_includes.h:33:
/home/gabriela/zephyrproject/zephyr/include/zephyr/devicetree.h:232:32: error: 'DT_N_ALIAS_led0_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function)
  232 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
      |                                ^~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/devicetree.h:4060:9: note: in definition of macro 'DT_CAT7'
 4060 |         a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7
      |         ^~
/home/gabriela/zephyrproject/zephyr/include/zephyr/devicetree/gpio.h:164:9: note: in expansion of macro 'DT_PHA_BY_IDX'
  164 |         DT_PHA_BY_IDX(node_id, gpio_pha, idx, pin)
      |         ^~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:317:24: note: in expansion of macro 'DT_GPIO_PIN_BY_IDX'
  317 |                 .pin = DT_GPIO_PIN_BY_IDX(node_id, prop, idx),                 \
      |                        ^~~~~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:352:9: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
  352 |         GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0)
      |         ^~~~~~~~~
/home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c:20:40: note: in expansion of macro 'GPIO_DT_SPEC_GET'
   20 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
      |                                        ^~~~~~
/home/gabriela/zephyrproject/zephyr/include/zephyr/devicetree.h:232:25: note: in expansion of macro 'DT_CAT'
  232 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
      |                         ^~~~
/home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c:14:19: note: in expansion of macro 'DT_ALIAS'
   14 | #define LED0_NODE DT_ALIAS(led0)
      |                   ^~~~
/home/gabriela/zephyrproject/zephyr/samples/basic/blinky/src/main.c:20:57: note: in expansion of macro 'LED0_NODE'
   20 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
      |                                                         ^~~~~
[77/127] Building C object zephyr/lib/libc/m...libc_minimal.dir/source/stdlib/qsort.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /home/gabriela/.local/bin/cmake --build /home/gabriela/zephyrproject/zephyr/build

I am not sure why is this happening, I am using Zephyr with Ubuntu and I am trying to compile a simple program.

I´ve already tried deleting the build folder, reinstalling Ubuntu and Zephyr updated to the latest version, I am not sure what else to do, but I think it still is an installation error or some sort of thing like it, it might be simple to solve, but I am a beginner, can somebody help me please ?

    jcarvajalu that’s because litex_vexriscv doesn’t have an led0 definition in the device tree binding. (litex_vexriscv.dts)

    Here’s an example of one:

    / {
    	
    	leds {
    		compatible = "gpio-leds";
    		blue_led: led_0 {
    			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
    			label = "Blue LED (D7)";
    		};
    	};
    
    
    	aliases {
    		led0 = &blue_led;
    	};
    };

    You will need to replace gpio0 with your port and 3 with the pin number. My guess gpio_out is the replacement for gpio0 but you’ll have to do some trial and error.

      Terms and Conditions | Privacy Policy