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/TDA2SX: Peripheral Device Flashing over USB Interface

Part Number: TDA2SX
Other Parts Discussed in Thread: DRA742, PMP

Tool/software: Linux

Dear TI,

I am now trying to flashing eMMC over USB interface.

My operations:
step1: host$ sudo ./usbboot -S spl/u-boot-spl.bin

step2: set sw2[7:0] at cpu board as [0 0 0 0 0 0 0 0], and then power on the evm.

host machine output:

reading ASIC ID
CHIP: 5641
rom minor version: 02
IDEN: 0000000000000000000000000000000000000000
MPKH: 0000000000000000000000000000000000000000000000000000000000000000
CRC0: 51d2f9a7
CRC1: 00000000
device is GP
sending 2ndstage to target...



evm output:

U-Boot SPL 2016.05-00008-g1fbee98-dirty (Jun 06 2019 - 20:35:16)
DRA752-GP ES2.0
Trying to boot from USB DFU
Using default environment

UNKNOWN IRQ type 1715168365                    <----------------------It looks like an USB IRQ error showing from the code, but i don't know why.

step3:  host$   sudo dfu-util -l

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/.../

Found DFU: [0451:d022] ver=0223, devnum=38, cfg=1, intf=0, path="1-7", alt=2, name="ramdisk", serial="UNKNOWN"
Found DFU: [0451:d022] ver=0223, devnum=38, cfg=1, intf=0, path="1-7", alt=1, name="fdt", serial="UNKNOWN"
Found DFU: [0451:d022] ver=0223, devnum=38, cfg=1, intf=0, path="1-7", alt=0, name="kernel", serial="UNKNOWN"

step4: host$ sudo dfu-util -D boot.img -c 1 -i 0 -a 0    

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/.../

dfu-util: File size is too big: Success

The file boot.img was generated by issue:

           dd if=/dev/sdb1 of=boot.img bs=1M count=4096 &

           dd if=/dev/sdb2 of=boot.img bs=1m count=4096 &

/dev/sdb1 & /dev/sdb2 are my bootable SD card device. I just replaced uenv.txt in the boot partition with uenv-emmc.txt.

step5:  host$ sudo dfu-util -D u-boot.img -c 1 -i 0 -a 0  -R                  <-----------------------------------------I try to debug the problem show in step 4. 

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/.../

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0451:d022
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download    [=========================] 100%       837964 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

step 6: target output:

U-Boot 2016.05-00008-g1fbee98-dirty (Jun 06 2019 - 20:35:16 +0800)

CPU  : DRA752-GP ES2.0
Model: TI DRA742
Board: DRA74x EVM REV H.0
DRAM:  4 GiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
** First descriptor is NOT a primary desc on 1:1 **
*** Warning - bad CRC, using default environment

GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
ERROR: cannot find partition: 'userdata'

at arch/arm/cpu/armv7/omap-common/utils.c:195/mmc_get_part_size()
Warning: fastboot.userdata_size: unable to calc
SCSI:  SATA link 0 timeout.
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: 64bit ncq stag pm led clo only pmp pio slum part ccc apst
scanning bus for devices...
Found 0 device(s).
Net:   
Warning: ethernet@48484000 using MAC address from ROM
eth0: ethernet@48484000
Hit any key to stop autoboot:  0
=>

step7: uboot $ printenv

=> printenv
arch=arm
args_fit=setenv bootargs console=${console}
args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
baudrate=115200
board=dra7xx
board_name=dra7xx
board_rev=H.0
boot_fdt=try
boot_fit=0
boot_os=0
bootargs=androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard
bootcmd=if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot 0; fi;if test ${boot_fit} -eq 1; then run update_to_fit;fi;run findfdt; run envboot; run mmcboot;run emmc_android_boot;
bootdelay=2
bootdir=/boot
bootenvfile=uEnv.txt
bootfile=zImage
bootm_size=0x10000000
bootpart=0:2
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttyO0,115200n8
cpu=armv7                                                 --------------------------------------------------------The size of boot.img is 4GB, so i modify the rawemmc raw parameters. I don't know whether it's right or not.
dfu_alt_info_emmc=rawemmc raw 0 4294967296;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1
dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
dfu_alt_info_qspi=MLO raw 0x0 0x040000;u-boot.img raw 0x040000 0x0100000;u-boot-spl-os raw 0x140000 0x080000;u-boot-env raw 0x1C0000 0x010000;u-boot-env.backup raw 0x1D0000 0x010000;kernel raw 0x1E0000 0x800000
dfu_alt_info_ram=kernel ram 0x80200000 0x4000000;fdt ram 0x80f80000 0x80000;ramdisk ram 0x81000000 0x4000000
dfu_bufsiz=0x10000
dofastboot=0
emmc_android_boot=setenv eval_bootargs setenv bootargs $bootargs; run eval_bootargs; setenv mmcdev 1; setenv fdt_part 3; setenv boot_part 9; if test $reboot_image = recovery; then setenv boot_part 8; setenv reboot_image boot; saveenv; fi;setenv machid fe6; mmc dev $mmcdev; mmc rescan; part start mmc ${mmcdev} ${fdt_part} fdt_start; part size mmc ${mmcdev} ${fdt_part} fdt_size; part start mmc ${mmcdev} ${boot_part} boot_start; part size mmc ${mmcdev} ${boot_part} boot_size; mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; mmc read ${loadaddr} ${boot_start} ${boot_size}; echo Booting from eMMC ...; bootm $loadaddr $loadaddr $fdtaddr;
envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
ethaddr=0c:b2:b7:f6:ff:bc
fastboot.board_rev=H.0
fastboot.cpu=J6
fastboot.secure=GP
fastboot.userdata_size=unknown
fdt_addr_r=0x88000000
fdtaddr=0x88000000
fdtcontroladdr=fdf0a598
fdtfile=undefined
findfdt=if test $board_name = omap5_uevm; then setenv fdtfile omap5-uevm.dtb; fi; if test $board_name = dra7xx; then setenv fdtfile dra7-evm.dtb; fi;if test $board_name = dra72x-revc; then setenv fdtfile dra72-evm-revc.dtb; fi;if test $board_name = dra72x; then setenv fdtfile dra72-evm.dtb; fi;if test $board_name = dra71x; then setenv fdtfile dra71-evm.dtb; fi;if test $board_name = dra76x; then setenv fdtfile dra76-evm.dtb; fi;if test $board_name = beagle_x15; then setenv fdtfile am57xx-beagle-x15.dtb; fi;if test $board_name = beagle_x15_revb1; then setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;if test $board_name = am57xx_evm; then setenv fdtfile am57xx-evm.dtb; fi;if test $board_name = am57xx_evm_reva3; then setenv fdtfile am57xx-evm-reva3.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = no; then setenv fdtfile am572x-idk.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = osd101t2045; then setenv fdtfile am572x-idk-lcd-osd.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = osd101t2587; then setenv fdtfile am572x-idk-lcd-osd101t2587.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = no; then setenv fdtfile am571x-idk.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = osd101t2045; then setenv fdtfile am571x-idk-lcd-osd.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = osd101t2587; then setenv fdtfile am571x-idk-lcd-osd101t2587.dtb; fi;if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
finduuid=part uuid mmc ${bootpart} uuid
fit_bootfile=fitImage.itb
fit_loadaddr=0x88000000
importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
kernel_addr_r=0x82000000
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr
loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadfit=run args_fit; bootm ${loadaddr}#${fdtfile};
loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
mmcboot=if mmc dev ${mmcdev}; then setenv devtype mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run loadfdt; echo Booting from mmc${mmcdev} ...; run args_mmc; bootz ${loadaddr} - ${fdtaddr}; fi; fi; fi;
mmcdev=0
mmcloados=run args_mmc; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcrootfstype=ext4 rootwait
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
netloadfdt=tftp ${fdtaddr} ${fdtfile}
netloadimage=tftp ${loadaddr} ${bootfile}
nfsopts=nolock
partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
partitions_android=uuid_disk=${uuid_gpt_disk};name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};name=bootloader,size=2304K,uuid=${uuid_gpt_bootloader};name=environment,size=256K,uuid=${uuid_gpt_environment};name=misc,size=128K,uuid=${uuid_gpt_misc};name=reserved,size=384K,uuid=${uuid_gpt_reserved};name=efs,size=16M,uuid=${uuid_gpt_efs};name=crypto,size=16K,uuid=${uuid_gpt_crypto};name=recovery,size=10M,uuid=${uuid_gpt_recovery};name=boot,size=10M,uuid=${uuid_gpt_boot};name=system,size=768M,uuid=${uuid_gpt_system};name=vendor,size=256M,uuid=${uuid_gpt_vendor};name=cache,size=256M,uuid=${uuid_gpt_cache};name=ipu1,size=8M,uuid=${uuid_gpt_ipu1};name=ipu2,size=8M,uuid=${uuid_gpt_ipu2};name=dsp1,size=8M,uuid=${uuid_gpt_dsp1};name=dsp2,size=8M,uuid=${uuid_gpt_dsp2};name=userdata,size=-,uuid=${uuid_gpt_userdata}
pxefile_addr_r=0x80100000
ramdisk_addr_r=0x88080000
rdaddr=0x88080000
reboot_image=boot
rootpath=/export/rootfs
scriptaddr=0x80000000
scsidevs=0
serial#=0400d00f147400e2
soc=omap5
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial@4806a000
stdin=serial@4806a000
stdout=serial@4806a000
update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile ${fit_bootfile}
usbtty=cdc_acm
vendor=ti
ver=U-Boot 2016.05-00008-g1fbee98-dirty (Jun 06 2019 - 20:35:16 +0800)
vram=16M

Environment size: 7479/131067 bytes
=>

That's all what i have done.

I want to know what can i do next to make eMMC flashed successful over DFU tools?

Regards,

Liu Gan

  • Hi Liu Gan,

    did you checked those documents:

    Also can you clarify if it is a custom board or an EVM?

    Regards,

    Yordan

  • Hi Yordan,

    Sorry for the late reply.

    I try to flash the eMMC on the EVM board.

    And also I have checked the doc you list above.

    When i try to choose eMMC as memory device. I get the following error:

             => dfu 0 mmc 1

    ERROR: Couldn't find part #1 on mmc device #1

    I debuged this problem by adding some log, then it looks like this:

    => dfu 0 mmc 1
    dfu_fill_entity: rawemmc raw 0 3751936 interface: mmc dev: 1
    [LG_dfu_fill_entity_mmc]: argv[0]: raw.
    [LG_dfu_fill_entity_mmc]: argv[1]: 0.
    [LG_dfu_fill_entity_mmc]: argv[2]: 3751936.
    dfu_fill_entity: boot part 1 1 interface: mmc dev: 1
    [LG_dfu_fill_entity_mmc]: argv[0]: part.
    [LG_dfu_fill_entity_mmc]: argv[1]: 1.
    [LG_dfu_fill_entity_mmc]: argv[2]: 1.
    ERROR: Couldn't find part #1 on mmc device #1

    at drivers/dfu/dfu_mmc.c:365/dfu_fill_entity_mmc()
    ERROR: DFU entities configuration failed!

    at drivers/dfu/dfu.c:70/dfu_init_env_entities()
    dfu - Device Firmware Upgrade

    Now i know, this error is related to environment variable 'dfu_alt_info_emmc'.

    => printenv dfu_alt_info
    dfu_alt_info=rawemmc raw 0 3751936;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1

    So i think this is caused by my eMMC is not partitioned. Am i right?

    My question is that how should i flash the raw eMMC for the first time?

    Regards,

    Liu Gan

  • Hi Liu Gan,

    can you check if this instructions can help you:

    Regards,

    Yordan

  • Hi Yordan,

    Yes i have checked the wiki link you give and the doc Flashing Binaries to DRA7xx Factory Boards Using Device Firmware Upgrade(DFU).pdf

    But they are not much help to solve my problem.

    Finally i get the dfu interfaces by set the uboot env "dfu_alt_info" as:

    setenv dfu_alt_info "rawemmc raw 0 3751936;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x200 0x400"

    Then i could flash the rawemmc partition by dfu-util.

    It almost succeed, but i got one more problem:

    kb@kb:~/tmp$ sudo dfu-util -D boot.img -c 1 -i 0 -a 0
    dfu-util 0.5

    (C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
    (C) 2010-2011 Tormod Volden (DfuSe support)
    This program is Free Software and has ABSOLUTELY NO WARRANTY

    dfu-util does currently only support DFU version 1.0

    Opening DFU USB device... ID 0451:d022
    WARNING: Can not find cached DFU functional descriptor
    Warning: Assuming DFU version 1.0
    Run-time device DFU version 0100
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=0, name="rawemmc"
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    Error obtaining cached DFU functional descriptor
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Could not seek to DFU suffix
    boot.img: Resource temporarily unavailable

    The boot.img was created by dd command. The size of boot.img is 8GByte.

    I give the file size here because i successed to flash the u-boot.img in this step by issue:

      kb@kb:~/tmp$ sudo dfu-util -D u-boot.img -c 1 -i 0 -a 0

    In my opinion, the only difference here is the file size.

    What's your idea about this " Resource temporarily unavailable" problem?

    Regards,

    Liu Gan

  • Hi Liu,

    Have you defined the partition boot.img in include/environment/ti/dfu.h? You need to list this partition along with the offset and size of the image to be flashed.

    Regards

    Shravan

  • Hi, Shravan

    Thanks for your reply. Is that necessary to add the partiton exactly same as the file name to load?

    I mean, if i want to load the file boot.img, then i have to define the boot.img partition info in include/environment/ti/dfu.h?

    My boot.img file is created as the raw image. Why cannot i just use the rawemmc partition?

    I got another question on how to create the boot.img file.

    I have a 16G memory card recognized as /dev/sdc for example. Then i created two partitions on it. 

    The first partiton is labeld as boot with 256MB storage, recognized as /dev/sdc1.

    The second partiton is labeld as rootfs with 2GB storage, recognized as /dev/sdc2.

    The other space in the memory card remain unused.

    Then i try to make the boot.img by issue the commond:

    `dd if=/dev/sdc of=boot.img bs=1M count=2304`

    Does the output boot.img can be used as the raw image flash in to the eMMC?

    Regards,

    Liu Gan.

  • Hi Liu,

    No you don't need to define the partition name the same as the file. I misread the command you were using in the previous post. 

    I think the error you're getting is due to the limit on the size of data that can be transferred. You may find the below link useful.

    https://e2e.ti.com/support/processors/f/791/t/353119?About-DFU-Device-Firmware-Update-for-LINUXEZSDK-AM335X-V07-00

    Yes, you can use the specified dd command to create the raw image, however, please ensure the size is exactly that of the entire SD card (modify count appropriately).


    Regards

    Shravan