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.48k stars 6.41k forks source link

Configuring a project with a sub-project (e.g. nRF5340) and an overlay causes an infinite configuring loop #33213

Closed thedjnK closed 3 years ago

thedjnK commented 3 years ago

Describe the bug A project for the nRF5340 was configured with an overlay file and it entered an infinite loop of configuring the CPU core over and over and over and over again. This was tested using nRF connect SDK so it could be an issue in that rather than zephyr, I have done no investigation into the cause of the issue.

To Reproduce Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. cmake -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DDTC_OVERLAY_FILE="..\test.overlay"
  3. See infinite loop Using this overlay:
    /delete-node/ &slot1_partition;
    /delete-node/ &scratch_partition;
    /delete-node/ &lfs_partition;

Expected behavior The configuration to complete

Impact Showstopper

Logs and console output

<DIR>\app\build>ninja menuconfig
[0/1] Re-running CMake...
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/app
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: <DIR>/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gcc-arm)
-- Found BOARD.dts: <DIR>/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: ../test.overlay
-- Generated zephyr.dts: <DIR>/app/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: <DIR>/app/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: <DIR>/app/build/zephyr/include/generated/device_extern.h
Parsing <DIR>/app/Kconfig
Loaded configuration '<DIR>/app/build/zephyr/.config'
No change to configuration in '<DIR>/app/build/zephyr/.config'
No change to Kconfig header in '<DIR>/app/build/zephyr/include/generated/autoconf.h'
Adding 'hci_rpmsg' firmware as child image since CONFIG_BT_RPMSG_NRF53 is set to 'y'

=== child image hci_rpmsg - CPUNET begin ===
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/zephyr/samples/bluetooth/hci_rpmsg
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpunet
-- Cache files will be written to: <DIR>/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gcc-arm)
-- Found BOARD.dts: <DIR>/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts
-- Generated zephyr.dts: <DIR>/app/build/hci_rpmsg/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: <DIR>/app/build/hci_rpmsg/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: <DIR>/app/build/hci_rpmsg/zephyr/include/generated/device_extern.h
Parsing <DIR>/zephyr/Kconfig
Loaded configuration '<DIR>/app/build/hci_rpmsg/zephyr/.config'
No change to configuration in '<DIR>/app/build/hci_rpmsg/zephyr/.config'
No change to Kconfig header in '<DIR>/app/build/hci_rpmsg/zephyr/include/generated/autoconf.h'
CMake Deprecation Warning at <DIR>/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Build type:
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- C_FLAGS :  -Wall -Wextra
CMake Warning at ../../../CMakeLists.txt:1357 (message):
  __ASSERT() statements are globally ENABLED

-- Configuring done
-- Generating done
-- Build files have been written to: <DIR>/app/build/hci_rpmsg
=== child image hci_rpmsg - CPUNET end ===

CMake Deprecation Warning at <DIR>/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Build type:
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- C_FLAGS :  -Wall -Wextra
CMake Warning at <DIR>/zephyr/CMakeLists.txt:1357 (message):
  __ASSERT() statements are globally ENABLED

-- Configuring done
-- Generating done
-- Build files have been written to: <DIR>/app/build
[0/1] Re-running CMake...
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/app
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: <DIR>/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gcc-arm)
-- Found BOARD.dts: <DIR>/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: ../test.overlay
-- Generated zephyr.dts: <DIR>/app/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: <DIR>/app/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: <DIR>/app/build/zephyr/include/generated/device_extern.h
Parsing <DIR>/app/Kconfig
Loaded configuration '<DIR>/app/build/zephyr/.config'
No change to configuration in '<DIR>/app/build/zephyr/.config'
No change to Kconfig header in '<DIR>/app/build/zephyr/include/generated/autoconf.h'
Adding 'hci_rpmsg' firmware as child image since CONFIG_BT_RPMSG_NRF53 is set to 'y'

=== child image hci_rpmsg - CPUNET begin ===
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/zephyr/samples/bluetooth/hci_rpmsg
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpunet
-- Cache files will be written to: <DIR>/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gcc-arm)
-- Found BOARD.dts: <DIR>/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts
-- Generated zephyr.dts: <DIR>/app/build/hci_rpmsg/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: <DIR>/app/build/hci_rpmsg/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: <DIR>/app/build/hci_rpmsg/zephyr/include/generated/device_extern.h
Parsing <DIR>/zephyr/Kconfig
Loaded configuration '<DIR>/app/build/hci_rpmsg/zephyr/.config'
No change to configuration in '<DIR>/app/build/hci_rpmsg/zephyr/.config'
No change to Kconfig header in '<DIR>/app/build/hci_rpmsg/zephyr/include/generated/autoconf.h'
CMake Deprecation Warning at <DIR>/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Build type:
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- C_FLAGS :  -Wall -Wextra
CMake Warning at ../../../CMakeLists.txt:1357 (message):
  __ASSERT() statements are globally ENABLED

-- Configuring done
-- Generating done
-- Build files have been written to: <DIR>/app/build/hci_rpmsg
=== child image hci_rpmsg - CPUNET end ===

CMake Deprecation Warning at <DIR>/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Build type:
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: cortexm
-- C_FLAGS :  -Wall -Wextra
CMake Warning at <DIR>/zephyr/CMakeLists.txt:1357 (message):
  __ASSERT() statements are globally ENABLED

-- Configuring done
-- Generating done
-- Build files have been written to: <DIR>/app/build
[0/1] Re-running CMake...
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/app
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: <DIR>/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gcc-arm)
-- Found BOARD.dts: <DIR>/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: ../boards/pinnacle_100.overlay
-- Generated zephyr.dts: <DIR>/app/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: <DIR>/app/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: <DIR>/app/build/zephyr/include/generated/device_extern.h
Parsing <DIR>/app/Kconfig
Loaded configuration '<DIR>/app/build/zephyr/.config'
No change to configuration in '<DIR>/app/build/zephyr/.config'
No change to Kconfig header in '<DIR>/app/build/zephyr/include/generated/autoconf.h'
Adding 'hci_rpmsg' firmware as child image since CONFIG_BT_RPMSG_NRF53 is set to 'y'

=== child image hci_rpmsg - CPUNET begin ===
Including boilerplate (Zephyr base (cached)): <DIR>/zephyr/cmake/app/boilerplate.cmake
-- Application: <DIR>/zephyr/samples/bluetooth/hci_rpmsg
-- Zephyr version: 2.4.99 (<DIR>/zephyr)
-- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
ninja: error: rebuilding 'build.ninja': interrupted by user

Environment (please complete the following information):

thedjnK commented 3 years ago

If doing it afresh not on an existing module, also do ninja menuconfig to get the infinite loop

hakonfam commented 3 years ago

You are using NCS which handles partition management differently from upstream zephyr. Please see https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html for details on how to specify the flash partitions you want. In general, only those needed should be included by default. Run ninja partition_manager_report to see what is currently included.

tejlmand commented 3 years ago

Although @hakonfam is correct about this belonging in NCS and not upstream Zephyr, then I have tested this out as well, as there should not something causing an infinite CMake loop with Zephyr.

I have tried with the NCS bluetooth sample peripheral_lbs, but CMake executed as expected on Windows. No looping.

But I had to adjust the test.overlay to:

/delete-node/ &slot1_partition;
/delete-node/ &scratch_partition;

because otherwise I would get: Label or path lfs_partition not found

Could you provide some more details on how to reproduce ?

carlescufi commented 3 years ago

Closing since it is not reproduceable. @thedjnK please reopen this if you have a way of helping us reproduce this.