lvgl sample code build is not working

I am trying to build basic LVGL code and it is giving me the following error. I did not customize the code.

https://github.com/nrfconnect/sdk-zephyr/tree/v3.4.99-ncs1-rc2/samples/subsys/display/lvgl/ 








Error:

main.c.obj -c ../src/main.c
In file included from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\toolchain\gcc.h:92,
from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\toolchain.h:50,
from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\sys\time_units.h:10,
from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\sys\util.h:615,
from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\devicetree.h:25,
from C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:12,
from d:\nrf\test_proj\test\lvgl\src\main.c:7:
../src/main.c: In function 'main':
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:85:41: error: '__device_dts_ord_DT_CHOSEN_zephyr_display_ORD' undeclared (first use in this function)
85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
132 | #define _DO_CONCAT(x, y) x ## y
| ^
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:85:33: note: in expansion of macro '_CONCAT'
85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
| ^~~~~~~~~~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
| ^~~~~~~~~~~~~~~~~~
d:\nrf\test_proj\test\lvgl\src\main.c:46:23: note: in expansion of macro 'DEVICE_DT_GET'
46 | display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
| ^~~~~~~~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:85:41: note: each undeclared identifier is reported only once for each function it appears in
85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
132 | #define _DO_CONCAT(x, y) x ## y
| ^
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:85:33: note: in expansion of macro '_CONCAT'
85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
| ^~~~~~~~~~~~~~~
C:\ncs\v2.5.0-rc2\zephyr\include\zephyr\device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
| ^~~~~~~~~~~~~~~~~~
d:\nrf\test_proj\test\lvgl\src\main.c:46:23: note: in expansion of macro 'DEVICE_DT_GET'
46 | display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
| ^~~~~~~~~~~~~
[48/357] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
[49/357] Building C object zephyr/CMakeFiles/zephyr.dir/lib/posix/getopt/getopt.c.obj
[50/357] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
[51/357] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/isr_wrapper.S.obj
[52/357] Building C object zephyr/arch/common/CMakeFiles/isr_tables.dir/isr_tables.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'd:\nrf\test_proj\test\lvgl\build'

Parents
  • Hi,

    Which command did you use to build the sample?

    Regards,
    Sigurd Hellesvik

  • I have tried both but still getting the same error:

    Building lvgl
    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl"


    Building lvgl
    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52840dk_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="d:/nrf/test_proj/test/lvgl;d:/nrf/test_proj/test/display;." -DCONF_FILE:STRING="d:/nrf/test_proj/test/lvgl/prj.conf""



    I was also able to see the following message if it is of any use:

    -- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at C:/ncs/v2.5.0-rc2/zephyr/CMakeLists.txt:893 (message):
    No SOURCES given to Zephyr library: drivers__display

    Excluding target from build.

  • From your logs:

    Try nrf52dk_nrf52832

  •  

    I have also tried nrf52dk_nrf52832 but I was still getting the error. I was using v2.5.0-rc2 version so converted it to v2.5.0 and now it showed a bit progress but I am getting " `RAM' overflowed " error.

    The error logs are mentioned below:


     

    PS D:\nrf\test_proj\test\lvgl> C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=adafruit_2_8_tft_touch_v2"
    -- west build: making build dir d:\nrf\test_proj\test\lvgl\build pristine
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: D:/nrf/test_proj/test/lvgl
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs2/toolchains/c57af46cb7/cmake)
    CMake Deprecation Warning at C:/ncs2/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
    'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE
    instead.
    Call Stack (most recent call first):
    C:/ncs2/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
    C:/ncs2/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs2/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs2/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:5 (find_package)


    -- Found Python3: C:/ncs2/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs2/v2.5.0/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs2/v2.5.0/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52dk_nrf52832
    -- Shield(s): adafruit_2_8_tft_touch_v2
    -- Found host-tools: zephyr 0.16.1 (C:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs2/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs2/v2.5.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
    -- Found devicetree overlay: C:/ncs2/v2.5.0/zephyr/boards/shields/adafruit_2_8_tft_touch_v2/adafruit_2_8_tft_touch_v2.overlay
    -- Generated zephyr.dts: D:/nrf/test_proj/test/lvgl/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: D:/nrf/test_proj/test/lvgl/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: D:/nrf/test_proj/test/lvgl/build/zephyr/dts.cmake
    Parsing C:/ncs2/v2.5.0/zephyr/Kconfig
    Loaded configuration 'C:/ncs2/v2.5.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
    Merged configuration 'D:/nrf/test_proj/test/lvgl/prj.conf'
    Configuration saved to 'D:/nrf/test_proj/test/lvgl/build/zephyr/.config'
    Kconfig header saved to 'D:/nrf/test_proj/test/lvgl/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (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: C:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Configuring done
    -- Generating done
    -- Build files have been written to: D:/nrf/test_proj/test/lvgl/build
    ←[92m-- west build: building application
    [2/377] Generating include/generated/version.h
    -- Zephyr version: 3.4.99 (C:/ncs2/v2.5.0/zephyr), build: v3.4.99-ncs1
    [372/377] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs2\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=D:/nrf/test_proj/test/lvgl/build/zephyr/zephyr_pre0.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/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/liblib__posix.a zephyr/soc/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/soc/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/subsys/input/libsubsys__input.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/display/libdrivers__display.a zephyr/drivers/gpio/libdrivers__gpio.a
    zephyr/drivers/i2c/libdrivers__i2c.a zephyr/drivers/input/libdrivers__input.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/lvgl/libmodules__lvgl.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -LD:/nrf/test_proj/test/lvgl/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms
    -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_INTEGER_PRINTF_SCANF --specs=picolibc.specs -lc -lgcc && cmd.exe /C "cd /D
    D:\nrf\test_proj\test\lvgl\build\zephyr && C:\ncs2\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `bss' will not
    fit in region `RAM'
    c:/ncs2/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `RAM' overflowed by 116852 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs2\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'd:\nrf\test_proj\test\lvgl\build'

  • I suggest that you try some Memory footprint optimization with that

  • I was using the wrong command to build. I was trying to build lvgl for adafruit display and I wanted to build it for st7735.

    PS D:\nrf\test_proj\test\lvgl> C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=adafruit_2_8_tft_touch_v2"
  • Done! 

      Thanks a lot for the guidance. It wouldn't be possible to do this task without your help.

    I am sharing the following details so it can help others navigate through this issue:

    1. Build Error: 
    I was using the following command to build but I was getting error that nrf52832 is not available board. But the issue was that I was using v2.5.0-rc and I think it was not stable version so I had to shift my version to v2.5.0 and then it worked.

     Command: C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=st7735r_ada_160x128"

    2. Ram Overflow Error:

    section `bss' will not
    fit in region `RAM'

    I was getting this error when I was trying to build lvgl code for Adafruit LCD and adafruit have their own UI libraries so I will not recommend to use lvgl with Adafruit LCD. 

    PS D:\nrf\test_proj\test\lvgl> C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=adafruit_2_8_tft_touch_v2"


    It was working fine when I tried to build it for st7735.
    Command: 

    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=st7735r_ada_160x128"


    3. GPIO Issue:
    After building I was unable to identify the pins that should be used to communicate. I tried multiple examples on community but it didn't work. It was only mentioned that you should use D8-D13 (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0-rc2/zephyr/boards/shields/st7735r/doc/index.html )but I was not sure where to connect it on nrf52832 development kit. This information was available in "nrf52dk_nrf52832.dts" file as shown in the image attached. 

    gpio 19 is refering to P0.19 pin on nrf52832 development kit.

Reply
  • Done! 

      Thanks a lot for the guidance. It wouldn't be possible to do this task without your help.

    I am sharing the following details so it can help others navigate through this issue:

    1. Build Error: 
    I was using the following command to build but I was getting error that nrf52832 is not available board. But the issue was that I was using v2.5.0-rc and I think it was not stable version so I had to shift my version to v2.5.0 and then it worked.

     Command: C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=st7735r_ada_160x128"

    2. Ram Overflow Error:

    section `bss' will not
    fit in region `RAM'

    I was getting this error when I was trying to build lvgl code for Adafruit LCD and adafruit have their own UI libraries so I will not recommend to use lvgl with Adafruit LCD. 

    PS D:\nrf\test_proj\test\lvgl> C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=adafruit_2_8_tft_touch_v2"


    It was working fine when I tried to build it for st7735.
    Command: 

    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir d:/nrf/test_proj/test/lvgl/build d:/nrf/test_proj/test/lvgl --pristine --board nrf52dk_nrf52832 -- -DSHIELD=st7735r_ada_160x128"


    3. GPIO Issue:
    After building I was unable to identify the pins that should be used to communicate. I tried multiple examples on community but it didn't work. It was only mentioned that you should use D8-D13 (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0-rc2/zephyr/boards/shields/st7735r/doc/index.html )but I was not sure where to connect it on nrf52832 development kit. This information was available in "nrf52dk_nrf52832.dts" file as shown in the image attached. 

    gpio 19 is refering to P0.19 pin on nrf52832 development kit.

Children
No Data