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.

Updating Uboot from Uboot prompt for dm365

HI,

We have designed our board with DM365 processor and we are in the production mode.

We want to update Uboot in our DM365 based board from U-boot serial port prompt.

We have hardwired the nand boot mode and we can only update ubl/uboot using JTAG Emulator.  We have a production lot of 100 boards with uboot, which does not have Ethernet support. We have recently added the Ethernet support in updated U-boot and we want to update all 100 boards without JTAG Emulator. 

We tried following script to create an uboot.bin image with header  but the resulted image does not solve our problem. The U-boot is written at 0x19 block

#####################################################################################

#!/bin/bash -e

PAGESIZE=2048
FIRSTBLOCK=25
MAGIC=0xA1ACED66
SIZE=$(stat --format '%s' u-boot.bin)
ENTRYPOINT=$(readelf -h u-boot | grep "Entry point" | cut -d : -f 2)

binary() {
printf '\\x%02x' $(( $1 & 0xff ))
printf '\\x%02x' $(( ($1 >> 8) & 0xff ))
printf '\\x%02x' $(( ($1 >> 16) & 0xff ))
printf '\\x%02x' $(( ($1 >> 24) & 0xff ))
}

printf $(binary $MAGIC) > u-boot.ubl
printf $(binary $ENTRYPOINT) >> u-boot.ubl
printf $(binary $(( ($SIZE / $PAGESIZE)+1 ))) >> u-boot.ubl
printf $(binary FIRSTBLOCK) >> u-boot.ubl
printf $(binary 1) >> u-boot.ubl
printf $(binary $ENTRYPOINT) >> u-boot.ubl
dd if=u-boot.bin of=u-boot.ubl bs=$PAGESIZE seek=1
echo "Created u-boot.ubl"

########################################################################################

After updating the image using following command

loady 0x80700000

nand write 0x320000 0x40000

When we reboot the system using reset command it gives following error

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

DM36x initialization passed!
TI UBL Version: 1.50
Booting Catalog Boot Loader
BootMode = NAND
Starting NAND Copy...
No valid boot image found!
NAND Boot failed.
Aborting...

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Can anyone  please suggest us the solution for this problem?

Regards,

Jagdish

  • Hi Jagdish,

    Can you send me the logs for your update procedure? Also can you let me know the size of the ubl, u-boot.bin and u-boot.ubl binares?

  • Hi Renjit,

    Thanks for your quick support.

    When the uboot is written with JTAG emulator it does not any error and log message is as below

    ###############################################################################

    TI UBL Version: 1.50
    Booting Catalog Boot Loader
    BootMode = NAND
    Starting NAND Copy...
    Valid magicnum, 0xA1ACED66, found in block 0x00000019.
       DONE
    Jumping to entry point at 0x81080000.


    U-Boot 2009.03 (Jun 21 2010 - 15:55:57)

    I2C:   ready
    DRAM:  128 MB
    NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit)
    Bad block table found at page 65472, version 0x01
    Bad block table found at page 65408, version 0x01
    NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit)
    Bad block table found at page 65472, version 0x01
    Bad block table found at page 65408, version 0x01
    256 MiB
    *** Warning - bad CRC or NAND, using default environment

    In:    serial
    Out:   serial
    Err:   serial
    No ETH PHY detected!!!
    ethernet init failed!
    Hit any key to stop autoboot:  4  3  2  0
    DM365 EVM >

    ###############################################################################

    I have changed script little bit because, when  last command dd executes for writing header to u-boot.ubl it writes header and skips first page. Ideally the skipped bytes should be 0xFF but it fills it with 0x00. So i changed the script as below..

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


    PAGESIZE=2048
    FIRSTBLOCK=25
    MAGIC=0xA1ACED66
    SIZE=$(stat --format '%s' u-boot.bin)
    ENTRYPOINT=$(readelf -h u-boot  | grep "Entry point" | cut -d : -f 2)
    echo $ENTRYPOINT
    echo $SIZE
    binary() {
            printf '\\x%02x' $(( $1 & 0xff ))
            printf '\\x%02x' $(( ($1 >> 8) & 0xff ))
            printf '\\x%02x' $(( ($1 >> 16) & 0xff ))
            printf '\\x%02x' $(( ($1 >> 24) & 0xff ))
    }

    printf $(binary $MAGIC) > header
    printf $(binary $ENTRYPOINT) >> header
    printf $(binary $(( ($SIZE / $PAGESIZE)+1 ))) >> header
    printf $(binary FIRSTBLOCK) >> header
    printf $(binary 1) >> header
    printf $(binary $ENTRYPOINT) >> header



     tr  "\000" "\377" < /dev/zero | dd ibs=1k count=384 of=paddedfile.bin
     dd if=u-boot.bin of=paddedfile.bin  bs=2048  seek=1 conv=notrunc

     dd if=header of=paddedfile.bin  bs=2048  conv=notrunc

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

    The size in bytes  of the

    1. Ubl = 20480

    2. u-boot.bin  =  297712

    3. size of u-boot.ubl = 393216

    The nand command sequence is as below.

    1. loady 0x80700000

    2. nand erase 0x320000 0x60000

    3 nand write 0x80700000 0x320000 0x60000

    4. reset

    After resetting the board, i get following message.

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

    DM36x initialization passed!
    TI UBL Version: 1.50
    Booting Catalog Boot Loader
    BootMode = NAND
    Starting NAND Copy...
    No valid boot image found!
    NAND Boot failed.
    Aborting...

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


    Please let me know if i am missing something. 

    One more question, is it possible to update Uboot on Dm365 based board by this method ?

    FYI : we are using 128Mbyte Micron of Nand Flash with same block size of 128KBytes and Page size 2K

    Regards,

    Jagdish

  • Jagdish,

    Why are you flashing the image to 0x320000? It should be flashed to 0x0 instead. The UBL logs that you are seeing is from the older ubl which was already there in flash. Since you've not erased that it will come up. 

    Try flashing it to 0x0. If your script is correct(I've not verified) it should boot-up properly. Atleast UBL should comeup.

  • Renjith,

    Thanks for looking in to the matter.

    I am not updating ubl. I am only updating uboot.bin file in nand flash. The script  i have posted adds header to  uboot.bin file with is required by ubl progrma while running uboot.

    If you see in the log, which runs ubl/uboot properly . It shows below line

    Starting NAND Copy...
    Valid magicnum, 0xA1ACED66, found in block 0x00000019.

    This means ubl copies data from block 0x19 . The block size is of 128K and calculating the address it gives 128K*25 = 0x320000 starting address of U-boot, which should have proper header which contains the information about magicnum number and starting block number

    The reference was taken from below link.

    https://linuxlink.timesys.com/docs/gsg/dm365_evm

    Regards,

    Jagdish

    If you see closely,

  • Jagdish,

    I overlooked the script. You are right.

    Can you upload the files u-boot.bin, header, paddedfile.bin?

    Also can you send the logs of the commands.

    1. loady 0x80700000

    2. nand erase 0x320000 0x60000

    3 nand write 0x80700000 0x320000 0x60000

    4. reset

  • Renjit,

    Regards,

    Jagdish

  • Renjith,

    Please find the log herewith as you have asked 

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

    DM365 EVM > loady 0x80700000
    ## Ready for binary (ymodem) download to 0x80700000 at 115200 bps...
    CCCC xyzModem - CRC mode, 2(SOH)/384(STX)/0(CAN) packets, 6 retries
    ## Total Size = 0x00060000 = 393216 Bytes
    DM365 EVM >
    DM365 EVM > nand erase 0x320000 0x60000

    NAND erase: device 0 offset 0x320000, size 0x60000
    Erasing at 0x360000 -- 100% complete.
    OK
    DM365 EVM > nand write 0x80700000 0x320000 0x60000

    NAND write: device 0 offset 0x320000, size 0x60000
    393216 bytes written: OK
    DM365 EVM > reset
    resetting ...
    DM36x initialization passed!
    TI UBL Version: 1.50
    Booting Catalog Boot Loader
    BootMode = NAND
    Starting NAND Copy...
    No valid boot image found!
    NAND Boot failed.
    Aborting...

    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

    I could not upload all the files you asked for here so I have mailed it you on your email address.

    Regards,

    Jagdish

  • Hi Jagdish,

    I got the binaries. Can you do this small experiment and send me the logs?

    run the command "nand dump 0x320000" from u-boot prompt, before flashing the image and after flashing the image? 

  • Renjith,

    Please find the nand dump log from uboot prompt.

    1. Before flashing u-boot 

    DM365 EVM > nand dump 0x320000
    Page 00320000 dump:
    66 ed ac a1 00 00 08 81 4a 00 00 00 19 00 00 00
    01 00 00 00 00 00 08 81 ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB:
    ff ff ff ff ff ff 27 42
    7f 1a 80 60 b8 41 b6 e9
    ff ff ff ff ff ff 3f 27
    56 f5 29 d8 61 d9 9d 14
    ff ff ff ff ff ff 3f 27
    56 f5 29 d8 61 d9 9d 14
    ff ff ff ff ff ff 3f 27
    56 f5 29 d8 61 d9 9d 14

    ###########################################################################################

    2. After writing flash memory the nand dump is 

    ###########################################################################################

    DM365 EVM >  nand dump 0x320000
    Page 00320000 dump:
    66 ed ac a1 00 00 08 81 91 00 00 00 19 00 00 00
    01 00 00 00 00 00 08 81 ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB:
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    a5 bb da cd ae ee 77 30
    24 78 3f 27 56 f5 29 d8
    61 d9 9d 14 3f 27 56 f5
    29 d8 61 d9 9d 14 3f 27
    56 f5 29 d8 61 d9 9d 14


    ###########################################################################################

    is something wrong is writing the flash memory ? 

    Regards,

    Jagdish

  • Jagdish,

    Its clear now. The ECC layout of u-boot is different from the layout what UBL expects. If you compare the OOB area of the dump you'll get it. In case of CCS the spare area is organized like, (6 + 10), (6 + 10), (6 + 10), (6 + 10) whereas in u-boot its (24 + 10 + 10 + 10 + 10). There will be ECC error when UBL tries to read from the NAND. That's the reason why you are not able to see the U-boot magic number.

    To solve this, you've to change the NAND driver of either UBL or u-boot for this layout. Chaning u-boot makes sense as UBL is following same layout as ROM Bootloader follows. 

  • Jagdish,

    If you are changing the u-boot layout, then if you are flashing your file system from u-boot, you'll face issues in mounting as kernel might be already following the u-boot layout. Do remember to change both if you are trying this.

  • Renjith,

    Thanks a lot for pointing out the problem. 

    Will update uboot nand drivier according to ubl lay out you suggested. 

    You are right, i also need to update nand driver for kernel otherwise will get problems in mounting and re-writing filesystem.

    Thanks once again for all the help and support. 

    I will update you about the issue after testing changed ECC layout.

    Regards,

    Jagdish

  • Renjith,

    I changed Uboot code to update ECC layout to be (6 + 10), (6 + 10), (6 + 10), (6 + 10).  But I faced the same problem. It did not work. 

    1. If i update my new u-boot.bin (with (24 + 10 + 10 + 10 + 10 ECC layout ) using JTAG Emulator, it works well But if try to write the same u-boot.bin using uboot prompt, it does not work.

    2. Even I created new padderfile.bin with original u-boot.bin(is provided with dm365 evm board and having ECC layout same as ubl) it also gives same oob out put

    OOB:
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    a5 bb da cd ae ee 77 30
    24 78 3f 27 56 f5 29 d8
    61 d9 9d 14 3f 27 56 f5
    29 d8 61 d9 9d 14 3f 27
    56 f5 29 d8 61 d9 9d 14

    Can please  suggest  what might be  going wrong in this case ? 

    I have also tried a different way to update u-boot memory area in to flash memory.  I have one board with new u-boot.bin updated using JTAG Emulator. I logged in to the  board and create blcok file using following command.

     dd if=/dev/mtd1 of=uboot_mtd1.bin   (checked the partition from linux partition table from board support file)

    Even I checked the content of uboot_mtd1.bin file using hexdump -C command, it's same as the data written by JTAG emulator, but when i update the binary at 0x320000 location from uboot prompt, and give the reset command then the on the start ubl is not able to find uboot image and the device hangs. And i have to use JTAG emulator for updating the uboot in the device.

    Regards,

    Jagdish 


  • Jagdish,

    If the oob layout is like what you've given in the post, it will not work. The oob has to look like this.

    ff ff ff ff ff ff a5 bb

    da cd ae ee 77 30 24 78 

    ff ff ff ff ff ff 3f 27

    56 f5 29 d8 61 d9 9d 14

    ff ff ff ff ff ff 3f 27

    56 f5 29 d8 61 d9 9d 14

    ff ff ff ff ff ff 3f 27

    56 f5 29 d8 61 d9 9d 14


    After updating the u-boot image from your new u-boot the nand dump oob layout should like the above. Can you double check this?


  • Renjith,

    I double checked it. It does not work. 

    Somehow the oob layout changes. The common thing in all the experiments is my script, which creates a uboot.bin file with a proper header. Is something wrong with the script ? 

    Can you please let me know, why the new uboot.bin works if i update using JTAG emulator ? The uboot is having 24+10+10+10+10 oob layout. ? 

    Regards,

    Jagdish

  • Jagdish,

    From the binaries that you've sent, I couldn't find any issues. Its looks to be fine. 

    The JTAG flashes the image in 6 +10, 6 +10, 6 +10, 6 +10 layout. According to your new u-boot,  the layout is 24+10+10+10+10 which is wrong.  You've to change it to 6 +10, 6 +10, 6 +10, 6 +10. Please double check this. 

    The NAND dump after flashing from JTAG and the NAND dump after flashing from u-boot should exactly looks same. If this is proper, there is not reason for UBL to fail reading the u-boot binary.

  • Renjith,

    Is oob layout of the image depends on uboot.bin image or it depends on the flashing method used ? 

    If I flash the uboot.bin image ( with proper oob layout ) using JTAG emulator, it gives right oob layout output on nand dump. When i try same thing by creating a uboot.bin+header file and writing the image using nand write command it writes the uboo.bin+header with 24+10+10+10+10 manner, when i run nand dump command.

    Does it depends on nand write command writes my uboot.bin+header image with wrong oob layout on the flash memory ? 

    Regards,

    Jagdish

  • Jagdish,

    The OOB layout depends on the NAND driver. The driver generally chooses the layout. In case of CCS it chooses the layout 6+10 and whereas u-boot has chosen the layout 24+40. Since u-boot is writing in a layout and at the same time if it reads it back, there will be no issues. But here since UBL is the one who reads it back, how can it interpret the layout what u-boot understands? That's why u-boot's layout has to be changed according to what UBL understands. Also it is the same layout that RBL(ROM bootloader) also understands. So it will be good to change the u-boot's layout. 

    Typically the code is located in drivers/mtd/nand/ directory. You have to change the code here.  

  • Renjith,

    Thanks for the briefing.

    The original ECC layout in the uboot file driver/mtd/nand/davinci_nand.c was as under

    Case 1 :
        .eccbytes = 40,

        .eccpos = {
            24, 25, 26, 27, 28,
            29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
            39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
            49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
            59, 60, 61, 62, 63,
            },
        .oobfree = {
             {.offset = 2, .length = 22, },
        },

    The above layout cause the oob to be 24+10+10+10+10.

    I have changed the ECC layout as below.

    Case 2 :
    .eccbytes = 40,

      .eccpos = { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
                22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
                38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
                54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
                },
     .oobfree = {{2, 4}, {16, 6}, {32, 6}, {48, 6}},

    But this is not solving the problem and one more thing when i run nand dump 0x320000 oob seems to be 24+10+10+10+10.

    As per TI below link, the above patch should work. Please find the reference from below link.

    http://processors.wiki.ti.com/index.php/DM365_Nand_ECC_layout

    We did following tests after updating the U-boot.bin with right ECC layout.

    1. We programmed u-boot.bin with right ECC layout (Case 2) using JTAG emulator and then we updated the same by adding header file and created padderfile.bin and updated it into nand flash from U-boot prompt: it works fine. The output of oob was correct i.e 6+10

    2. But when we programmed DM365 board with JTAG Emulator with wrong (Case 1) U-boot.bin and then crated the padderfile.bin from uboot.bin from case 2 ecc layout and updated it into nand flash from U-boot prompt:using nand write 0x320000 0x60000 : it gives wrong oob out put 24+10.

    The above test shows that if the new u-boot is with the different ECC layout then i can not update Uboot from Uboot prompt.

    Is there anyway out of this situation ?

    Regards,

    Jagdish

  • Jagdish,

    Jagdish Suyani said:
     But this is not solving the problem and one more thing when i run nand dump 0x320000 oob seems to be 24+10+10+10+10. 

    Did you erase and write into the offset before doing the dump 0x320000? Don't worry about the u-boot header file etc etc, just write any data to NAND from u-boot and verify whether the ECC layout is correct or not. Once we fix this then let's go ahead with the booting part.

  • Renjith,

    Yes, I erased offset before writing nand dump command on u-boot prompt.

    Today, i fixed the ECC layout in u-boot driver and tested different cases.

    1. I changed uboot driver and made ubl and  uboot ECC layout  same (6+10).(6+10).(6+10).(6+10) and  wrote UBL/Uboot using JTAG Emulator..

    2. Then I updated Uboot (with header )  using nand write 0x320000 0x60000 command

    3. It gives right oob out put by writing nand dump command on Uboot prompt.

    4. Then reset the board and the board boots up and gives Uboot prompt

    So, I can update the Uboot only when UBL and Uboot both are having same ECC layout.

    Now in my case, all the 100 boards are with Uboot ECC layout (24+10+10+10+10) and I do not have JTAG emulator for updating all these boards. If I try to update Uboot from Uboot prompt in this case, using nand write command after erase the offset area, it always gives oob output in (24+10+10+10+10) 

    Regards,
    Jagdish 

  • Jagdish,

    Good to know that it works for you!! 

    Unfortunately there is no way out here. Have you explored the option of using bulk NAND programmer? That may not be really useful now, but might be useful when you have more number of boards.Can you verify this post as answered?

  • Renjith,

    Thanks a lot for your time and support.

    Our manufacturer is using nand bulk programmer for programing all boards. So, I need to update all 100  boards using JTAG Emulator. There's no way out :( 

    Once agin thanks for your help 

    Regards,
    Jagdish 

  • Renjith,

    I was working on this matter. UBoot/ Kernel goes well with the same ECC lay out which is (6+10).(6+10).(6+10).(6+10)

    It seems like Ubl ECC lay out and Uboot ECC layout are not matching..

    When i write ubl using JTAG emulator. it gives different oob out put.. 

    Can you please let me know, where can i find ECC layout in ubl source code..

    Regards,

    Jagdish

  • Jagdish,

    When you are writing using the JTAG using the tool nandwriter.out, its not UBL who is writing it. It is written by the program nandwriter.out. So you have to go and change the program for modifying the layout.

  • Renjith,

    Thanks for your quick reply.

    Which file should i change to make ecc layout to be 

    .eccbytes = 40,

      .eccpos = { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
                22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
                38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
                54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
                },
     .oobfree = {{2, 4}, {16, 6}, {32, 6}, {48, 6}},


    Regards,

    Jagdish

  • Renjith,

    We are going for production for around 1000 boards  and i need to right uboot before we proceed further. Can you please look at this warning message ? 

    I am getting this warning when i turn on the device, i get this warning 

    Bad block table written to 0x000007fe0000, version 0x01
    Bad block table written to 0x000007fc0000, version 0x01

    Whenver Uboot is finished, i get this warning message.

    If i go with this U-boot with discussed ECC layout i get above message on the serial port terminal.

    Is it a problem or NAND ECC lay out mismatching ? 

    Regards,

    Jagdish

  • Jagdish,

    I'm not sure about the NAND writer code. I don't have the with me. You can verify it yourself, its a simple code base.

  • Jagdish,

    You can ignore this message, this is the bad block table stored generally at the end of NAND flash. This will contain the list of all NAND bad blocks maintained by u-boot. Not really significant w.r.t kernel. You can also make kernel use the same table again. 

    Another thing to note is the u-boot will purposefully mark these two blocks as bad, to avoid getting used by kernel or getting erased by mistake.

  • Renjith,

    We are going for mass production for DM365 based board with 1GB Micron NAND flash memory.  We have some random problem in booting the board. We have tested the booting issue by changing the NAND ECC layout of U-boot and Kernel as per the following link. for  DM365. 

    http://processors.wiki.ti.com/index.php/DM365_Nand_ECC_layout

    The above link includes Changes in ECC layout of U-boot as well as Linux kernel. ( I changed ECC layout according to our previous discussion )

    After changing NAND  ECC layout we tested the Board. We powered ON/OFF the device more then 500 times and we found out below error once which lead the board to hung up at the below error.  

    DM36x initialization passed!
    TI UBL Version: 1.50
    Booting Catalog Boot Loader
    BootMode = NAND
    Starting NAND Copy...
    NAND Boot failed.
    Aborting...

    After this error, when we power reset the board, it is working properly. 

    Sometimes when this error comes up board hangs and we have to flash the board again because UBL could not find proper boot image. 

    What would be possible reason for the above error and possible solution for the problem ? 

    Thanks in advance. 


    Regards, 
    Jagdish

  • Jagdish,

    Glad to know that you've reached mass production!!

    I remember seeing this issue long back on couple of IPNC devices based on DM365. I'm not sure about this. May we need to spend some time debugging this. I've seen many people reporting this issue. 

    If you can share couple couple of devices, I can assign someone from my team to look into this. Just mail me, if this works out for you.

  • Hi,

    Just wondering if you solved this problem or not?  In case you are still dealing with it, I would suggest you do a read back and compare of what you've programmed.   You can automate this by scripting all the programming and verification in a preset uboot env variable.  Default uboot commands are sufficient to accomplish all of this.

    Hope this helps.

    Wil

  • Hello,

    Is it possible to update binraties of ecc fix (for u-boot, kernel, ubl) from linux or u-boot ?

    Or does it required to boot with the fixed ubl/u-boot and then do the programming ?

    Regards,

    Ran