Skip to content

Conversation

@rugeGerritsen
Copy link
Contributor

@rugeGerritsen rugeGerritsen commented Feb 7, 2025

This dependency was always there but not explicitly defined. By adding the explicit dependency it becomes more obvious what is wrong when SPI is enabled but GPIO disabled.

This was found when building samples/bluetooth/peripheral for nrf54l15dk/nrf54l15/cpuapp with CONFIG_GPIO=n.

Before we got:

  • A linker error in spi_nrfx_common.c failing to reference some nrfx_gpiote APIs.
  • A linker error in spi_nrfx_spim.c failing to reference the GPIO dts entry.

Now we will get:

  • A CMake warning will be issued that the SPI driver is not compiled in.
  • A linker error in spi_nor.c failing to reference a SPI driver.

With this it becomes more obvious that SPI driver is enabled by default because of the external flash mounted on the DK.

@rugeGerritsen rugeGerritsen marked this pull request as ready for review February 7, 2025 17:34
@zephyrbot zephyrbot added size: XS A PR changing only a single line of code area: SPI SPI bus labels Feb 7, 2025
kartben
kartben previously approved these changes Feb 13, 2025
@rugeGerritsen
Copy link
Contributor Author

@anangl , would you mind reviewing this PR?

default y
depends on SOC_FAMILY_NORDIC_NRF
depends on MULTITHREADING
depends on GPIO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we will get:

  • A CMake warning will be issued that the SPI driver is not compiled in.
  • A linker error in spi_nor.c failing to reference a SPI driver.

With this it becomes more obvious that SPI driver is enabled by default because of the external flash mounted on the DK.

I'm afraid it might still not be obvious enough. The linker error is quite cryptic, as it says about undefined reference to __device_dts_ord_*. How do you know that the device is SPI?
Hence, I think it should be select GPIO. Then, for CONFIG_GPIO=n, we'll get a Kconfig warning that GPIO got the value y, although it was supposed to be n. And in menuconfig, one can find out what exactly makes this option set to y.

This dependency was always there but not explicitly defined.
By adding the explicit dependency it becomes more obvious
what is wrong when SPI is enabled but GPIO disabled.

This was found when building `samples/bluetooth/peripheral`
for `nrf54l15dk/nrf54l15/cpuapp` with `CONFIG_GPIO=n`.

Before we got:
 - A linker error in `spi_nrfx_common.c` failing
   to reference some nrfx_gpiote APIs.
 - A linker error in `spi_nrfx_spim.c` failing to reference
   the GPIO dts entry.

Now we will get a warning of that GPIO is not enabled
With this it becomes more obvious that SPI driver is enabled by
default because of the external flash mounted on the DK.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
@rugeGerritsen
Copy link
Contributor Author

@anangl , can you please have a look at this?

@kartben
Copy link
Contributor

kartben commented May 16, 2025

ping @tbursztyka

@kartben kartben merged commit 577a004 into zephyrproject-rtos:main May 16, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: SPI SPI bus size: XS A PR changing only a single line of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants