What needs to be contained in UBOOT to start/access nand0 (SOM Flash)

  • Hello gentleman,


    I made some changes in uboot. But nothing regarding the flash nand memory (to my way of thinking). But afterwards I can not access the nand flash any more. I also checked the original uboot from F+S and compared the sourced and enviroment variables. My modified UBootEnv can be seen under [1].


    I also noticed that some variables are not there anymore (see [2]). But when I set them and try to work with the nand flash they disappear and I get the following error:
    unexpected character 'r' at the end of partition

    What variables needs to be set to access the nand flash memory?



    Thanks so far.



    [2]:
    mtddevnum=0
    partition=nand0,0



    [1]:

  • Is the U-Boot based on our U-Boot sources only with some modifications? Or is this a different U-Boot source and you are trying to port all our changes?


    One of the changes we did was to increase the size of the buffer for the command line. So maybe when the mdtparts variable is evaluated at startup, this results in a too long command line and is truncated. So maybe only a final 'r' from a 'ro' for "read-only" is visible and the whole partition list is ignored. This would explain the error and also the missing NAND support because of the missing partitions.


    EDIT: Is 'rw' allowed after partition UBootEnv? I think it is automatically read-write if there is no suffix and suffix 'ro' after the parenthesis is for read-only. I do not think that other suffixes are possible.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Yes. It is only a modified version of the original F+S uboot image. I tried not to change any FLASH related options (only make UBootEnv rw). But my image only access the nand flash when I use the enviroment on the original uboot image from F+S.


    As you can see in [1] there is no difference in variable mtdparts. The command "mtdparts" shows the same behavior as you can see in [2].


    [1]:
    myUBOOT:
    mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)


    F+S UBOOT:
    mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)ro,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)



    [2]:

  • [1] shows the only change from my side regarding on modul nand flash in the F+S uboot sou res. I made a test and yes: If UBootEnv is 'rw' the bootloader is not able to access the nand flash. If I change the mode back to 'ro' my bootloader is working and can access the nand flash.


    Can you confirm this behavior on your side to?



    [1] in include/configs/fsimx6sx.h:
    /* Define MTD partition info */
    #if CONFIG_SYS_MAX_NAND_DEVICE > 1
    #define MTDIDS_DEFAULT "nand0=gpmi-nand0,nand1=gpmi-nand1"
    #define MTDPART_DEFAULT "nand0,0"
    #define MTDPARTS_PART1 "fsnand1:256k(NBoot)ro\\\\;fsnand0:768k@256k(UserDef)"
    #else
    #define MTDIDS_DEFAULT "nand0=gpmi-nand"
    #define MTDPART_DEFAULT "nand0,1"
    #define MTDPARTS_PART1 "gpmi-nand:256k(NBoot)ro,768k(UserDef)"
    #endif
    //#define MTDPARTS_PART2 "256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)ro"
    #define MTDPARTS_PART2 "256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw"
    #define MTDPARTS_PART3 "8m(Kernel)ro,1792k(FDT)ro"
    #define MTDPARTS_PART4 "-(TargetFS)"
    #define MTDPARTS_STD "setenv mtdparts mtdparts=" MTDPARTS_PART1 "," MTDPARTS_PART2 "," MTDPARTS_PART3 "," MTDPARTS_PART4
    #define MTDPARTS_UBIONLY "setenv mtdparts mtdparts=" MTDPARTS_PART1 "," MTDPARTS_PART2 "," MTDPARTS_PART4


  • mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)rw,8m(Kernel)ro,1792k(FDT)ro,-(TargetFS)


    What I meant was: To have read-write, you must not write "rw", you have to leave the place empty. So simply remove this "rw", then you have the partition read-write. "rw" is an invalid suffix to a partition. The suffix is either empty or "ro". See partitions UserDef and TargetFS for example, these two partitions are both read-write and have no suffix. A partition is read-write by default, so you only have to append something to the declaration if it should *not* be read-write.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.