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.

PROCESSOR-SDK-AM437X: Issue while booting from NAND

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: AM4376, TPS65218

Hello,

We are working on the AM4376 processor and made a custom board (NAND based) previously we were using TI SDk 8.3 version and customized u-boot  as per our custom board.
Now we want to migrate to TI's latest released SDK 09.01.00, we made all required changes as we did previously, our board is successfully boot from SD card also using u-boot command we flash NAND memory,

on Next power ON cycle board should get boot from NAND as per boot sequence but we are unable to boot our board from NAND memory.

During boot, we got a debug message from SPL that said "Boot memory NAND",but no further  message.
I noticed that it got stuck in the function 'spl_load_image(spl_image, loader)' in common/spl/spl.c  
Please help me to resolve this issue.


Best

Piyush Ghatole

  • Hello Piyush,
    Will you share the full boot log when trying to boot from NAND on the customer board?
    Best,
    -Hong

  • Hello Hong,

    Please note below uboot log details.

    CCCCCCCCCCCCCC
    U-Boot SPL 2023.04-00001-g782d146723-dirty (Jan 10 2024 - 19:19:27 +0530)
    Boot mode as per spl_boot_device is 7
    ---Trying to boot from--- MMC1 - 7
    Trying to load image from device : 7SPL: Please implement spl_start_uboot() for your board
    SPL: Direct Linux boot not active!
    Loading Image Success from device : 7

    U-Boot 2023.04-00001-g782d146723-dirty (Jan 10 2024 - 19:19:27 +0530)

    CPU : AM437X-GP rev 1.2
    Model: TI AM437x ETH
    DRAM: 512 MiB

    Board init is in process ...Please wait 11
    Core: 41 devices, 16 uclasses, devicetree: separate
    Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
    PMIC: TPS65218
    NAND: 512 MiB
    MMC: OMAP SD/MMC: 0
    Loading Environment from FAT... OK
    Net: Could not get PHY for ethernet@4a100000: addr 0

    Warning: ethernet@4a100000 MAC addresses don't match:
    Address in ROM is 88:01:f9:59:b7:54
    Address in environment is 88:01:f9:35:d9:a2
    eth2: ethernet@4a100000
    Hit any key to stop autoboot: 0
    =>

    NAND Writting

    => mtdparts

    device nand0 <nand.0>, # parts = 10
    #: name size offset mask_flags
    0: NAND.SPL 0x00040000 0x00000000 0
    1: NAND.SPL.backup1 0x00040000 0x00040000 0
    2: NAND.SPL.backup2 0x00040000 0x00080000 0
    3: NAND.SPL.backup3 0x00040000 0x000c0000 0
    4: NAND.u-boot-spl-os 0x00080000 0x00100000 0
    5: NAND.u-boot 0x00100000 0x00180000 0
    6: NAND.u-boot-env 0x00040000 0x00280000 0
    7: NAND.u-boot-env.backup10x00040000 0x002c0000 0
    8: NAND.kernel 0x00700000 0x00300000 0
    9: NAND.file-system 0x1f600000 0x00a00000 0

    active partition: nand0,0 - (NAND.SPL) 0x00040000 @ 0x00000000

    defaults:
    mtdids : nand0=nand.0
    mtdparts: mtdparts=nand.0:256k(NAND.SPL),256k(NAND.SPL.backup1),256k(NAND.SPL.backup2),256k(NAND.SPL.backup3),512k(NAND.u-boot-spl-os),1m(NAND.u-boot),256k(NAND.u-boot)

    => nand info

    Device 0: nand0, sector size 128 KiB
    Page size 2048 b
    OOB size 64 b
    Erase size 131072 b
    ecc strength 8 bits
    ecc step size 512 b
    subpagesize 512 b
    options 0x0000400c
    bbt options 0x00008000
    => nand erase.chip

    NAND erase.chip: device 0 whole chip
    Erasing at 0x1ffe0000 -- 100% complete.
    OK
    => fatload mmc 0:1 0x82000000 MLO
    156775 bytes read in 27 ms (5.5 MiB/s)

    => NAND write: device 0 offset 0x0, size 0x26467
    156775 bytes written: OK
    => fatload mmc 0:1 0x82000000 u-boot.img
    640852 bytes read in 64 ms (9.5 MiB/s)

    => nand write 0x82000000 NAND.u-boot 9c754

    NAND write: device 0 offset 0x180000, size 0x9c754
    640852 bytes written: OK


    Here i reset the board.


    CCCCCCCC
    U-Boot SPL 2023.04-00001-g782d146723-dirty (Jan 10 2024 - 19:19:27 +0530)
    Boot mode as per spl_boot_device is 5
    ---Trying to boot from--- NAND - 5
    Trying to load image from device : 5SPL: Please implement spl_start_uboot() for your board
    SPL: Direct Linux boot not active!

    Best

    Piyush Ghatole

  • Hello Piyush,
    Thanks for sharing the log file.
    We recenetly idendified the similar NAND boot issue with SDK 9.1 on AM335x.
    Can we apply the two patchs on top of SDK 9.1, and re-test on your setup?
    1. mtd: nand: omap_gpmc: Fix NAND in SPL for AM335x
    git.ti.com/.../
    2. mtd: rawnand: omap_elm: Fix elm_init definition
    git.ti.com/.../

    Best,
    -Hong

  • Hello Hong,

    Thank you for sharing details.

    I modified files with the given patcmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
     Please check below for compilation errors.

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
      UPD     include/generated/timestamp_autogenerated.h
      ENVC    include/generated/env.txt
      ENVP    include/generated/env.in
      ENVT    include/generated/environment.h
      CC      cmd/version.o
      AR      cmd/built-in.o
      CC      drivers/mtd/nand/raw/omap_gpmc.o
    drivers/mtd/nand/raw/omap_gpmc.c: In function ‘omap_select_ecc_scheme’:
    drivers/mtd/nand/raw/omap_gpmc.c:989:25: error: ‘omap_calculate_ecc_bch’ undeclared (first use in this function); did you mean ‘_omap_calculate_ecc_bch’?
       nand->ecc.calculate = omap_calculate_ecc_bch;
                             ^~~~~~~~~~~~~~~~~~~~~~
                             _omap_calculate_ecc_bch
    drivers/mtd/nand/raw/omap_gpmc.c:989:25: note: each undeclared identifier is reported only once for each function it appears in
    At top level:
    drivers/mtd/nand/raw/omap_gpmc.c:357:12: warning: ‘_omap_calculate_ecc_bch’ defined but not used [-Wunused-function]
     static int _omap_calculate_ecc_bch(struct mtd_info *mtd, const u8 *dat,
                ^~~~~~~~~~~~~~~~~~~~~~~
    scripts/Makefile.build:256: recipe for target 'drivers/mtd/nand/raw/omap_gpmc.o' failed
    make[4]: *** [drivers/mtd/nand/raw/omap_gpmc.o] Error 1
    scripts/Makefile.build:397: recipe for target 'drivers/mtd/nand/raw' failed
    make[3]: *** [drivers/mtd/nand/raw] Error 2
    scripts/Makefile.build:397: recipe for target 'drivers/mtd/nand' failed
    make[2]: *** [drivers/mtd/nand] Error 2
    scripts/Makefile.build:397: recipe for target 'drivers/mtd' failed
    make[1]: *** [drivers/mtd] Error 2
    Makefile:1847: recipe for target 'drivers' failed
    make: *** [drivers] Error 2

    please suggest.

    Best,

    Piyush Ghatole

  • Hello Piyush,
    Is your SW baseline on TI SDK 9.1 release?
    www.ti.com/.../09.01.00.001
    Best,
    -Hong

  • Hello Hong,

    Yes u-boot software base is 09.01.00.001.

    /U-boot-9.0.1/ti-u-boot-2023.04+gitAUTOINC+d74d0993e2-gd74d0993e2 

    Regards,

    Piyush Ghatole

  • Hello Piyush,
    Let me check it on my setup, and get back to you next week.
    Best,
    -Hong

  • Hello Hong,

    The mentioned compilation error has been resolved, the mistake done at my end.

    now with the given patch SPL and uboot is booted from NAND.

    Thank you for your support.

    Best

    Piyush Ghatole

  • Hello Piyush,
    Thanks for the update, and it is good to know you fixed the compilation error.
    Best,
    -Hong

  • Hello Hong, 

    i compiled u-boot with suggested changes and run  (MLO,u-boot,dtb,kernel and FS from nand), by giving manual command, it is working fine.

    but in autoboot i am getting bootcmd error 

    ## Error: "bootcmd_nand0" not defined                                          
    starting USB...                                                                
    No working controllers found         

    i checked for environment variables and i found bootcmd_nand but no variable set as bootcmd_nand0 

    bootcmd_dhcp=devtype=dhcp; run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfil;
    bootcmd_mmc0=devnum=0; run mmc_boot
    bootcmd_nand=run nandboot
    bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi

    please suggest in which file i need to make changes to define bootcmd_nand0.

    Best

    Piyush Ghatole 

  • Hello Piyush,
    You may customise this file for your user case.
    git.ti.com/.../nand.h
    Best,
    -Hong