zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.45k forks source link

GPIO Issue #71086

Closed majidBahmanigbt closed 5 months ago

majidBahmanigbt commented 5 months ago

Hi, I would like to test “samples/basic/blinky” for IMX8MP. According to “zephyr/samples/basic/blinky/README.rst” in the first step I add the “leds” node to the device tree of boards/nxp/imx8mp_evk/ imx8mp_evk_mimx8ml8_adsp.dts.

/*
 * Copyright 2021, 2023, 2024 NXP
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/dts-v1/;

#include <nxp/nxp_imx8m.dtsi>
#include <nxp/nxp_imx/mimx8ml8dvnlz-pinctrl.dtsi>

/ {
    model = "NXP i.MX 8MPLUS Audio DSP";
    compatible = "nxp";

    leds {
        compatible = "gpio-leds";
        myled0: led_0 {
            gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                };
    };

    chosen {
        zephyr,sram = &sram0;

        zephyr,console = &uart4;
        zephyr,shell-uart = &uart4;
    };

    aliases {
        led0 = &myled0;
    };

};

&gpiote {
    status = "okay";
};

&gpio0 {
    status = "okay";
};

&pinctrl {
    uart4_default: uart4_default {
        group0 {
            pinmux = <&iomuxc_uart4_rxd_uart_rx_uart4_rx>,
                <&iomuxc_uart4_txd_uart_tx_uart4_tx>;
            bias-pull-up;
            slew-rate = "slow";
            drive-strength = "x1";
        };
    };
};

&uart4 {
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart4_default>;
    pinctrl-names = "default";
};

However, when I compile the blink code, I receive the following error:

xxxxx@LinuxForiMX:~/nxp/Repositories/DSP_Zephyr/zephyr$ west build -p always -b imx8mp_evk//adsp samples/basic/blinky
-- west build: making build dir /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky
-- CMake version: 3.22.1
-- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: /home/xxxxx/.cache/zephyr
-- Zephyr version: 3.6.99 (/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: imx8mp_evk, qualifiers: mimx8ml8/adsp
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.5 (/home/xxxxx/zephyr-sdk-0.16.5-1)
-- Found toolchain: zephyr 0.16.5 (/home/xxxxx/zephyr-sdk-0.16.5-1)
-- Found Dtc: /home/xxxxx/zephyr-sdk-0.16.5-1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_adsp.dts
-- Generated zephyr.dts: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/dts.cmake
Parsing /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/Kconfig
Loaded configuration '/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_adsp_defconfig'
Merged configuration '/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/prj.conf'
Configuration saved to '/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/xxxxx/zephyr-sdk-0.16.5-1/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/../lib/gcc/xtensa-nxp_imx8m_adsp_zephyr-elf/12.2.0/../../../../xtensa-nxp_imx8m_adsp_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/xxxxx/zephyr-sdk-0.16.5-1/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/xtensa-nxp_imx8m_adsp_zephyr-elf-gcc
Load components for MIMX8ML8_dsp:
driver_common component is included.
driver_reset component is included.
driver_iuart component is included.
CMake Warning at /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/CMakeLists.txt:865 (message):
  No SOURCES given to Zephyr library: drivers__gpio

  Excluding target from build.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build
-- west build: building application
[2/136] Preparing syscall dependency handling

[3/136] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr), build: v3.6.0-2050-g3c42daee9c1b
[13/136] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
/home/xxxxx/zephyr-sdk-0.16.5-1/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/xtensa-nxp_imx8m_adsp_zephyr-elf-gcc -DCPU_MIMX8ML8DVNLZ_dsp -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DNDEBUG -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/include/generated -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx/imx8m/adsp -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx/imx8m/adsp/include -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx/. -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx/imx8m -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/soc/nxp/imx/imx8m/include -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/nxp/mcux/mcux-sdk/devices/MIMX8ML8 -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/nxp/mcux/mcux-sdk/devices/MIMX8ML8/drivers -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/nxp/mcux/mcux-sdk/drivers/common -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/nxp/mcux/mcux-sdk/drivers/iuart -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/modules/hal_nxp/. -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/xtensa/include -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/xtensa/XTENSA_HAL -I/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/modules/hal/xtensa/zephyr/soc/mimx8ml8 -isystem /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always --sysroot=/home/xxxxx/zephyr-sdk-0.16.5-1/xtensa-nxp_imx8m_adsp_zephyr-elf/xtensa-nxp_imx8m_adsp_zephyr-elf -imacros /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -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/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -mlongcalls --specs=picolibc.specs -std=c99 -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/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c
In file included from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/toolchain.h:50,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/kernel_includes.h:23,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/kernel.h:17,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:8:
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/device.h:91:41: error: '__device_dts_ord_DT_N_NODELABEL_led0_P_gpios_IDX_1_PH_ORD' undeclared here (not in a function)
   91 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/device.h:91:33: note: in expansion of macro '_CONCAT'
   91 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/device.h:218:37: note: in expansion of macro 'DEVICE_NAME_GET'
  218 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/device.h:235:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  235 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/drivers/gpio.h:333:25: note: in expansion of macro 'DEVICE_DT_GET'
  333 |                 .port = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx)),\
      |                         ^~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:22:34: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
   22 | const struct gpio_dt_spec spec = GPIO_DT_SPEC_GET_BY_IDX(DT_NODELABEL(led0), gpios, 1);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/arch/xtensa/arch.h:18,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/arch/cpu.h:27,
                 from /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/kernel_includes.h:36:
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/devicetree.h:200:36: error: 'DT_N_NODELABEL_led0_P_gpios_IDX_1_VAL_pin' undeclared here (not in a function)
  200 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                                    ^~~~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/devicetree.h:4492:9: note: in definition of macro 'DT_CAT7'
 4492 |         a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7
      |         ^~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/devicetree/gpio.h:110:9: note: in expansion of macro 'DT_PHA_BY_IDX'
  110 |         DT_PHA_BY_IDX(node_id, gpio_pha, idx, pin)
      |         ^~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/drivers/gpio.h:334:24: note: in expansion of macro 'DT_GPIO_PIN_BY_IDX'
  334 |                 .pin = DT_GPIO_PIN_BY_IDX(node_id, prop, idx),                 \
      |                        ^~~~~~~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:22:34: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
   22 | const struct gpio_dt_spec spec = GPIO_DT_SPEC_GET_BY_IDX(DT_NODELABEL(led0), gpios, 1);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/zephyr/include/zephyr/devicetree.h:200:29: note: in expansion of macro 'DT_CAT'
  200 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:22:58: note: in expansion of macro 'DT_NODELABEL'
   22 | const struct gpio_dt_spec spec = GPIO_DT_SPEC_GET_BY_IDX(DT_NODELABEL(led0), gpios, 1);
      |                                                          ^~~~~~~~~~~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c: In function 'main':
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:29:32: error: 'led' undeclared (first use in this function)
   29 |         if (!gpio_is_ready_dt(&led)) {
      |                                ^~~
/home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/samples/basic/blinky/src/main.c:29:32: note: each undeclared identifier is reported only once for each function it appears in
[15/136] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/xxxxx/nxp/Repositories/DSP_Zephyr/zephyr/build
github-actions[bot] commented 5 months ago

Hi @majidBahmanigbt! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙