This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: SPI flash partitioning

Part Number: AM5728


Tool/software: Linux

Hai,

i am using am5728 custom board which is connected to windbond NOR flash memory through SPI interface. I want to partition the NOR flash memory using partition table

is it possible to create such table using any file formats like csv format which is then converted to binary format for flashing the table to NOR flash memory.

My requirement is, i should be able to update the partition table stored initially in flash memory after a period of time without compromising on-device software.

Thanks & Regards ,

R venkat

  • Hello Venkat,

    I have asked your question to our experts and I will keep you posted on any updates.

    Regards,
    Krunal
  • please provide the support as soon as possible.
  • Hello Venkat,

    Can you share more details?

    What is the size of NOR chip?
    How many partitions you are planing to create? With what data? Are you planing to re-partition them all? Can you give us an example?
    How big is your board's DDR memory?
    Do you have any other non-volatile memory on that board where you can stage the updating data?

    Best regards,
    Kemal

  • thank you for reply, size of nor chip is 512 Mbit , i am planning to create 10 partitions, MLO, uboot.img, dtb , u-boot env, zimage, rootfs, filesystem for normal data storage like storing files like audio and other files(like a general memory to store files) and other partitions are backup partitions.

    thanks & Regards

    Venkat R.
  • I think you can refer to Android's OTA and A/B system update mechanisms and try to implement similar one on your board.

  • Hello Venkat,

    1.
    if you see the current Android partitions (For Oreo) :
    git.ti.com/.../am57xx_evm.h

    It is not possible to have all android partitions inside the nor chip with the size you mentioned.
    May be a good idea to do a SPI(Bootloader and Boot image) + eMMC (Rest of the Android Images ) boot.
    --
    Can you tell us which Proc SDK Android release you are intending to use?
    --

    2. A/B System support is not part of current android release.
  • thanks for inputs, but my work is not related to android, i am willing to check the feature that i asked about updating partition table and use it in my project. please tell me if it is possible and how it can be done by providing some references. i think that is independent of my system details apart from the details i provided.

    Thanks & regards
    Venkat R.
  • The Linux MTD partition table for the SPI can be configured in your device tree. For example, here's a snippet from am57xx-idk-common.dtsi:

    &qspi {
    status = "okay";

    spi-max-frequency = <76800000>;
    m25p80@0 {
    compatible = "s25fl256s1", "jedec,spi-nor";
    spi-max-frequency = <76800000>;
    reg = <0>;
    spi-tx-bus-width = <1>;
    spi-rx-bus-width = <4>;
    #address-cells = <1>;
    #size-cells = <1>;

    /* MTD partition table.
    * The ROM checks the first four physical blocks
    * for a valid file to boot and the flash here is
    * 64KiB block size.
    */
    partition@0 {
    label = "QSPI.SPL";
    reg = <0x00000000 0x000040000>;
    };
    partition@1 {
    label = "QSPI.u-boot";
    reg = <0x00040000 0x00100000>;
    };
    partition@2 {
    label = "QSPI.u-boot-spl-os";
    reg = <0x00140000 0x00080000>;
    };
    partition@3 {
    label = "QSPI.u-boot-env";
    reg = <0x001c0000 0x00010000>;
    };
    partition@4 {
    label = "QSPI.u-boot-env.backup1";
    reg = <0x001d0000 0x0010000>;
    };
    partition@5 {
    label = "QSPI.kernel";
    reg = <0x001e0000 0x0800000>;
    };
    partition@6 {
    label = "QSPI.file-system";
    reg = <0x009e0000 0x01620000>;
    };
    };
    };

    When you boot the device these correspondingly become /dev/mtd0, /dev/mtd1, etc. within Linux. Is this the sort of thing you were looking for?
  • Hello Venkat,

    I will be closing the ticket and if you are still experiencing issues, please feel free to open the ticket in the future.

    Regards,
    Krunal
  • thank you for the inputs yes this is the way i am looking for , but how can i transfer this table after modifying remotely to the board.

    thanks & Regards
    Venkat R
  • The dtb file resides in your root file system. You can update any time.

  • I want to make sure you understand exactly what this changes. These partitions are just virtual borders that the Linux kernel observes. Changing the partitions will not cause any data to move at all. It will only cause the virtual borders to change. If there is already data in any of these partitions you will have to be very careful with how you handle it. For example, if you shifted one of the partitions that would do nothing to the data. You would be responsible for any data handling before or after the partition changes.