Adapted SPI NOR driver not accepted by configuration

Hello,

for my project I need a secondary image for McuBoot on an external flash drive, so I integrated the examples in the partitions.yml, the device tree and SPI NOR configuration. With the generic spi_nor driver it compiled fine. The SPI flash we need to use in our project because of the low power requirements is not entirely compatible with this, as the commands and write-protect handling is fairly different. So I adapted the spi_nor driver for my specific use and gave it a new id: 'renesas,at25pe80'. I added this in the device tree as well.

But now it does not build anymore, it does not get to the compiling stage even:

warning: SPI_NOR (defined at drivers/flash/Kconfig.nor:4) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: DT_HAS_JEDEC_SPI_NOR_ENABLED (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_SPI_NOR and/or look up SPI_NOR in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: SPI_NOR_FLASH_LAYOUT_PAGE_SIZE (defined at drivers/flash/Kconfig.nor:56) was assigned the
value '4096' but got the value ''. Check these unsatisfied dependencies: SPI_NOR (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE and/or look
up SPI_NOR_FLASH_LAYOUT_PAGE_SIZE in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.

The first error, that DT_HAS_JEDEC_SPI_NOR_ENABLED is set to no is the culprit, the error with SPI_NOR_FLASH_LAYOUT_PAGE_SIZE is just the result of the first error.

I have attached my driver and the DeviceTree and Config generated for the build. Maybe someone can find the error.

DT_HAS_JEDEC_SPI_NOR_ENABLED is not documented anywhere, so I cannot find help in official sources.

Thanks,

Rico

  • Here is the partitions.yml:

    app:
      address: 0x10200
      region: flash_primary
      size: 0x5FE00
    mcuboot:
      address: 0x0
      region: flash_primary
      size: 0x10000
    mcuboot_pad:
      address: 0x10000
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x10000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      size: 0xe0000
      span: *id001
    mcuboot_primary_app:
      address: 0x10200
      orig_span: &id002
      - app
      region: flash_primary
      size: 0x5FE00
      span: *id002
    mcuboot_secondary:
      address: 0x10000
      size: 0xF0000
      device: flash_at25pe80
      region: external_flash
    external_flash:
      address: 0x0
      size: 0x100000
      device: flash_at25pe80
      region: external_flash
    sram_primary:
      address: 0x20000000
      size: 0x20000
      region: sram_primary
    

    I have tried to keep it simple for now.

  • Hi,

    Does your external flash device have the "size" property?
    It seems like num_bits is zero here: partition_manager.cmake#L238-L239, resulting in this error:

    math cannot parse the expression: " / 8": syntax error, unexpected

    Here is an example of the mx25r64 device, where you see the size property:

    mx25r64: mx25r6435f@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0>;
    		spi-max-frequency = <8000000>;
    		jedec-id = [c2 28 17];
    		sfdp-bfp = [
    			e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
    			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
    			10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
    			30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
    		];
    		size = <67108864>;
    		has-dpd;
    		t-enter-dpd = <10000>;
    		t-exit-dpd = <35000>;
    	};

    Best regards,
    Marte

Related