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.99k stars 6.69k forks source link

Warning when using flash_stm32_qspi with CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32 and requires-ulbpr #79654

Open tt0776 opened 1 month ago

tt0776 commented 1 month ago

Feedback and question on warning

What is not correct configured or how to possible fix in zephyr/drivers/flash/flash_stm32_qspi.c? Driver looks to work correct with sample and able to read and write.

I have checked out main and tested when microchip patch was added(#74534) and used it to flash for microchip sst26vf032b with sample "samples/drivers/spi_flash" For easier reproduction warning, I have attached overlay for "stm32l476g_disco" to be placed in sample "boards" (Need rename to .conf and .overlay to use) stm32l476g_disco_conf.txt stm32l476g_disco_overlay.txt

Specific enable and using. CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32=y requires-ulbpr;

Example on location of configflash_stm32_qspi.c "CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32" and "requires-ulbpr "

I get warning on this and not sure on how to fix it or it will be a problem. Warning (spi_bus_bridge): /soc/quadspi@a0001000: node name for SPI buses Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge'

Example on "my_board" as derived from nucleo_l476rg

relevant devicetree part for sst26vf032b

sst26vf032b: qspi-nor-flash@90000000 {
        // https://docs.zephyrproject.org/latest/build/dts/api/bindings/flash_controller/st,stm32-qspi-nor.html
        compatible = "st,stm32-qspi-nor";
        reg = <0x90000000 DT_SIZE_M(32)>; // 4 MBytes
        qspi-max-frequency = <DT_FREQ_M(80)>;
        status = "okay"; // Is only to be enable when actually using external flash.
        //NOT IN USE// reset-gpios = <&gpiod 3 GPIO_ACTIVE_LOW>;
        //NOT IN USE// reset-gpios-duration = <1>; // The duration (in ms) for the flash memory reset pulse
        spi-bus-width = <4>;
        requires-ulbpr;     
        page-size = <4096>; // Force “Erase 4 Kbytes” (0x20) to insure using smalles possible page size possible to support
        writeoc = "PP_1_1_4";

        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;

            partition@0 {
                label = "nor";
                reg = <0x00000000 DT_SIZE_M(4)>;
            };
        };
    };
};

Full printout with some path substitutes

COMMAND: west build -p always /home/ ... /samples/drivers/spi_flash -d /home/ ... /build -b my_board@3.0.1  -- -DBOARD_ROOT=/home/ ... /pjt
-- west build: making build dir /home/ ... /build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/ ... /samples/drivers/spi_flash
-- CMake version: 3.30.2
-- Found Python3: /home/ ... /zephyrproject/.venv/bin/python3 (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/ ... /.cache/zephyr
-- Zephyr version: 3.7.99 (/home/ ... /zephyrproject/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: my_board, Revision: 3.0.1, qualifiers: stm32l476xx
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.8 (/home/ ... /zephyr-sdk-0.16.8)
-- Found toolchain: zephyr 0.16.8 (/home/ ... /zephyr-sdk-0.16.8)
-- Found Dtc: /home/ ... /zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")

-- Including generated dts.cmake file: / ... /zephyr/dts.cmake
CMake Warning at /home/ ... /zephyrproject/zephyr/cmake/modules/dts.cmake:405 (message):
  dtc raised one or more warnings:

  /home/ ... / ... /zephyr/zephyr.dts:446.29-485.5:
  Warning (spi_bus_bridge): /soc/quadspi@a0001000: node name for SPI buses
  should be 'spi'

  <stdout>: Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge'

Call Stack (most recent call first):
  /home/ ... /zephyrproject/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
  /home/ ... /zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/ ... /zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:4 (find_package)

...

'/home/ ... / ... /zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/ ... /zephyr-sdk-0.16.8/arm-zephyr-eabi/arm-zephyr-eabi/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/ ... /zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Setting build type to 'MinSizeRel' as none was specified.
-- Using ccache: /usr/bin/ccache
-- Configuring done (7.8s)
-- Generating done (0.3s)
-- Build files have been written to: /home/ ... /build
-- west build: building application
[1/165] Preparing syscall dependency handling

[3/165] Generating include/generated/zephyr/version.h
-- Zephyr version: 3.7.99 (/home/ ... /zephyrproject/zephyr), build: v3.7.0-3720-g9c0f92db475f
[165/165] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       42444 B         1 MB      4.05%
             RAM:        5888 B        96 KB      5.99%
        IDT_LIST:          0 GB        32 KB      0.00%
FRASTM commented 1 month ago

Not sure the reason for that warning, but adding pre_dt_board.cmake in the boards/st/ [board folder] will avoid that DTS message

# SPI is implemented via octospi so node name isn't spi@...
list(APPEND EXTRA_DTC_FLAGS "-Wno-spi_bus_bridge")
tt0776 commented 1 month ago

@FRASTM thanks it looks to work for my board

FRASTM commented 1 month ago

@FRASTM thanks it looks to work for my board

Should also with the new version of the related PR