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.

AM6442: Production Flash programming recommendations

Part Number: AM6442


Hi,
do we have any recommendations or paper on the possibilities (DFU tool, JTAG, ...) to program the flash in production?

Regards, Holger

  • hi,

    yes we do have a dfu based flashing recommendation, give me some time to proof read the readme and share the tool with you.

    Regards

    Anshu

  • hi,

    Please refer to git link below

    https://git.ti.com/cgit/processor-sdk/uboot-flash-writer/

    Readme Below

    Regards

    Anshu

    U-Boot Flash Writer

    U-Boot Flash Writer is a tool used to flash binaries to the on-chip flash memory. This application note provides instructions on how to use U-boot flash writer script for flashing on AM62x. Flash writer script will use DFU to boot the board and then flash the binaries to flash memory. Script also supports flashing multiple EVMs via DFU one by one.

    Requirements

    • AM62x EVM / AM64x EVM
    • Linux Development PC that can access serial console.
    • u-boot_flashwriter.sh script and uEnv.txt files packaged inside AM62x Processer SDK Installer.
    • Type C USB cable
    • dfu-util installed on Linux host.
    • USB hub to connect multiple boards (Optional)
    • UART to read the logs from the EVM (Optional)

    Important files

    • Download and install AM62x/AM64x Processer SDK Installer from here.am62x am64x.

    • u-boot_flashwriter.sh script for flashing via DFU is located at following path inside the SDK.

    • For more info please refer to sdk docs. am62x am64x.

    /bin/DFU_flash/u-boot_flashwriter.sh
    • The text files for setting up environment variables in U-Boot for DFU flash are located at following path inside the SDK.
    /bin/DFU_flash/am62xx-evm/ /bin/DFU_flash/am64xx-evm/

    Requirements on Host PC

    dfu-util software package provides Device firmware update (DFU) USB programmer, you can install in your Linux PC by running the commands given below on the terminal.

    $ sudo apt-get update $ sudo apt-get install dfu-util

    Building bootloader binaries for DFU

    • For flashing and using the script we need to override the bootcmd command to receive the environment variable text file after DFU boot and flash the binaries/images.
    • Following change needs to be done to am62x_evm_a53_defconfig/am64x_evm_a53_defconfig file located at following path inside the SDK.
    /board-support/u-boot-*/configs/
    • Add or update the CONFIG_BOOTCOMMAND
    CONFIG_BOOTCOMMAND="setenv dfu_alt_info_flashenv uEnv.txt ram 0x82000000 0x10000000; setenv dfu_alt_info ${dfu_alt_info_flashenv}; dfu 0 ram 0; env import -t ${loadaddr} $filesize; run user_commands;"
    • It will enable script to send uEnv.txt file, import the environment variables from the uEnv.txt file and run user_commands after DFU boot. The user_commands variable is defined in the uEnv.txt file and the value assigned will be based on the on what flashing memory.
    • If you have saved environment variables in your board (or saved during earlier boot), u-boot takes the environment variables (saved during earlier boot) which will override the bootcmd which will cause the flashing to fail. To make u-boot not to take the saved environment variables you can do following changes in am62x_evm_a53_defconfig or am64x_evm_a53_defconfig.
    Add below line. CONFIG_ENV_IS_NOWHERE=y Remove below line. CONFIG_ENV_IS_IN_MMC=y
    • For DFU boot you need to build the bootloader images using “am62x_evm_r5_usbdfu_defconfig”. no change is needed in case of am64x. Following change is needed in Rules.make file present in the top level of SDK.
    UBOOT_MACHINE_R5=am62x_evm_r5_usbdfu_defconfig
    • Now generate the bootloader images for DFU boot using top-level makefile by running following commands on the terminal from the top-level of the SDK.
    $ make u-boot_clean $ make sysfw-image_clean $ make u-boot $ make sysfw-image

    Making changes in the environment variable text file for flashing

    • It is used to set environment variables in U-Boot for flashing.
    • It assigns a set of U-Boot commands to variable user_commands. Ex. for DFU transfer to eMMC following commands are assigned to variable user_commands.
    user_commands=echo Flashing_on_eMMC; setenv dfu_alt_info ${dfu_alt_info_emmc}; dfu 0 mmc 0;
    • The user_commands variable defined in the text file contains the commands to setup environment variables in U-Boot for DFU transfer.
    • You can also add your own U-Boot commands but make sure to not to remove the existing commands.

    Export path to files

    • Before starting the actual script, you need to export the path of DFU boot binaries, path to uEnv.txt and path to the actual binaries which will be flashed to the board. You can define them in a bash script and then call the u-boot_flashwriter.sh script from your script.
    • Assign the path of bootloader binaries for flashing and DFU boot (as created in previous section) to variables as shown below. Not defining these variables or providing wrong path will throw an error.
    $ export DFU_BOOT_TIBOOT=<path to tiboot3.bin for flashing & DFU boot> $ export DFU_BOOT_TISPL=<path to tispl.bin for flashing & DFU boot> $ export DFU_BOOT_UBOOT=<path to u-boot.img for flashing & DFU boot>
    • Assign the path of environment variable text file to below variable and export. The environment variable path will depend on the memory you want to flash. Not defining this variable or providing wrong path will throw an error. You can make your own uEnv.txt file using the uEnv.txt files packaged in SDK ( /bin/DFU_flash/am62xx-evm/ ) as an example.
    $ export UENV_TXT=<path to environment variable txt file for setting environment for flashing>
    • Assign the path of the files you want to flash in the given variables and export them. It is not mandatory to assign all the below variables with a path. Script will skip flashing files for which corresponding variable is undefined.
    $ export FLASH_TIBOOT=<path to tiboot3.bin to be flashed> $ export FLASH_TISPL=<path to tispl.bin to be flashed> $ export FLASH_UBOOT=<path to u-boot.img to be flashed> $ export FLASH_ENV=<path to uenv.txt to be flashed> $ export FLASH_ROOTFS=<path to rootfs to be flashed>
    • The script will use the same files/binaries for all boards connected while flashing. If you want to flash different files/binaries, then you will need to run the script again with their respective paths.

    Flashing the files

    • The script u-boot_flashwriter.sh takes 2 arguments - Flash memory and Device.
    • Run u-boot_flashwriter.sh to use the flash writer on Linux host with suitable arguments. All of the examples below assume that you are running commands from the top-level of the SDK.
    $ sudo ./bin/DFU_flash/u-boot_flashwriter.sh Flash_memory Device

    Flashing to eMMC

    • eMMC needs to be partitioned (2 partitions) before running the script. A reset is required for the partition table to be visible. Otherwise, you will get an error during flashing.
    • The eMMC device typically ships without any partition table We make use of the GPT support in U-Boot to write a GPT partition table to eMMC. In this case we need to use the uuidgen program on the host to create the UUIDs used for the disk and each partition.
    • Enter below commands in Linux host to generate uuid
    $ uuidgen first_uuid $ uuidgen second_uuid
    • Flash default wic image to SD Card. Boot the board using the SD Card. Press any key to enter the U-Boot prompt. Enter following commands in U-Boot prompt.
    # setenv uuid_gpt_disk first_uuid # setenv uuid_gpt_rootfs second_uuid # gpt write mmc 0 ${partitions}
    • After the eMMC is partitioned, you can now flash to eMMC without error. (After doing all the pre-steps as mentioned in previous sections)
    • Use uEnv_dfu_emmc.txt as environment variable file for flashing. Give the path of this file to variable UENV_TXT. All the example environment variables text files are packaged SDK (/bin/DFU_flash/am62xx-evm/) (/bin/DFU_flash/am64xx-evm/)
    • Run following command in Linux host from the top level of SDK.
    sudo ./bin/DFU_flash/u-boot_flashwriter.sh emmc am62x sudo ./bin/DFU_flash/u-boot_flashwriter.sh emmc am64x

    Flash to SD card

    • SD Card needs to be partitioned before running the script. A reset is required for the partition table to be visible. Otherwise, you will get an error during flashing.
    • For this purpose, the Processor SDK Linux AM62x, AM64x package includes a script in the /bin directory named create-sdcard.sh. Connect your SD Card to your host PC then run the script from the top level of SDK.
    $ sudo ./bin/create-sdcard.sh
    • After the SD Card is partitioned, you can now flash to SD Card without error. (After doing all the pre-steps as mentioned in previous sections).
    • Insert the SD Card on the SD Card slot on the board.
    • Use uEnv_dfu_sdcard.txt as environment variable text file for flashing. Give the path of this file to variable UENV_TXT. All the example environment variables text files are packaged SDK (/bin/DFU_flash/am62xx-evm/) or (/bin/DFU_flash/am64xx-evm/)
    • Run following command in Linux host from the top level of SDK.
    $ sudo ./bin/DFU_flash/u-boot_flashwriter.sh sdcard am62x $ sudo ./bin/DFU_flash/u-boot_flashwriter.sh sdcard am64x

    Flash to OSPI NOR

    • Use uEnv_dfu_ospi-nor.txt as environment variable file for flashing. Give the path of this file to variable UENV_TXT. All the example environment variables text files are packaged SDK (/bin/DFU_flash/am62xx-evm/).
    • Do all the pre-steps as mentioned in previous sections for flashing.
    • Run following command in Linux host from the top level of SDK.
    $ sudo ./bin/DFU_flash/u-boot_flashwriter.sh ospi-nor am62x $ sudo ./bin/DFU_flash/u-boot_flashwriter.sh ospi-nor am64x

    Flashing multiple devices via USB Device Firmware Upgrade (DFU)

    • The script supports flashing multiple EVMs via DFU one by one. The steps for flashing for multiple devices is same as single device. User needs to connect all the boards to the host PC in DFU boot mode.
    • Script checks for existing DFU device(s) connected. It will detect the devices connected to your host(in DFU mode), boot the board, flash the files, detach the device and repeat the same steps for other devices. After flashing the initial set of device(s), it will then wait for new device(s) for next iteration of flashing.
    • If a new device is connected to host pc while the script is flashing to the connected devices or while the script is waiting for new devices, the script will detect the device and then flash to that device. You can exit the script by pressing Ctrl C.