Update U-Boot Image via TFTP on AMC1

From DSignT Support Database
Jump to: navigation, search



1 Preparation

To update the U-Boot image located in serial FLASH via TFTP you need to do a proper network configuration first. Either enter all necessary environment variables manually on the U-Boot command prompt or use script AMC1_NetConfig.ser to make all these settings automatically.

Required network settings:
eth1addr - own MAC address

   AMC1> setenv eth1addr c4:be:84:cb:1f:ff

ipaddr - own IP address

   AMC1> setenv ipaddr 192.168.168.197

serverip - remote server IP

   AMC1> setenv serverip 192.168.168.158




2 Load U-Boot image from TFTP server

If all network settings are correct, a new U-Boot image can be loaded from TFTP server:

  tftpboot ${loadaddr} u-boot.bin

${loadaddr} is a pre-defined environment variable that specifies a free DDR RAM location for general purpose. We use it here as a temporary storage address for the TFTP transfer.

When the TFTP transfer succeeds, each received block (512 bytes) a '#' is printed on the terminal else a 'T' for timeout signals a problem connecting the server. A successful transmission can look like this (of course the IP addresses vary depending on your network configuration):

tftpboot ${loadaddr} u-boot.bin
link up on port 1, speed 1000, full duplex
Using cpsw device
TFTP from server 192.168.168.158; our IP address is 192.168.168.196
Filename 'u-boot.bin'.
Load address: 0x80200000
Loading: #################################################################
         ########
         981.4 KiB/s
done
Bytes transferred = 368880 (5a0f0 hex)
AMC1>




3 Serial FLASH programming

3.1 sf probe

First check if a serial FLASH is available:

AMC1> sf probe
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
AMC1>



3.2 sf erase

If the probe command finds a serial FLASH, use the erase command to clear the U-Boot FLASH area:

AMC1> sf erase 0x0 0x70000
SF: 458752 bytes @ 0x0 Erased: OK
AMC1>


Warning.png After erasing the FLASH boot area the AMC1 will not be bootable until a new boot image is written. Don't power cycle the board now




3.3 sf write

AMC1> sf write ${loadaddr} 0x0 ${filesize}
device 0 offset 0x0, size 0x5a0f0
SF: 368880 bytes @ 0x0 Written: OK
AMC1>

If the new U-Boot image was successfully written to the serial FLASH, your board will be bootable again.


4 Script AMC1_UBootTFTPUpdate.ser

Use this script to do the above steps at once. Precondition is to run AMC1_NetConfig.ser first.

###################################################################//##
#
# @file       AMC1_UBootTFTPUpdate.ser
# @verbatim                 _         _             _
#                        __| |    ___(_) ____ _ __ | |_
#                       / _` |   / __| |/ _` | '_ \| __|
#                      | (_| | _ \__ \ | (_| | | | | |_
#                       \__,_|(_) ___/_|\__, |_| |_|\__|
#                      Signalprocessing |___/ Technology
# @endverbatim
# @brief      U-Boot configuration script for UBoot update per TFTP
# @author     D.SignT GmbH & Co. KG, Claus Hermbusche
# @date       2017-09-07 12:43 PM
#
# Precondition: AMC1_NetConfig.ser must be executed first
#
# Environment variables and macros set in this script:
#   ubootfile       - U-Boot filename to load
#   tftploaduboot   - macro to execute tftpboot command
#   tftpupdate      - macro to execute all necessary steps
#   savetospi       - macro to write new U-Boot file to FLASH
#   cleanup         - macro to clean up environment
#
#######################################################################

# U-Boot filename to load, please change according to your filename
setenv ubootfile u-boot.bin

# macro to execute tftpboot command
setenv tftploaduboot 'tftpboot \\"${loadaddr}\\" \\"${ubootfile}\\"'

# macro to execute all necessary steps
setenv tftpupdate 'run netconf &&
if test -n \\"${serverip}\\"; then
    true;
else
    false;
fi && run tftploaduboot && run savetospi'

# macro to write new U-Boot file to FLASH
setenv savetospi 'sf probe && sf erase 0x0 0x70000 && sf write \\"${loadaddr}\\" 0x0 \\"${filesize}\\"'

# macro to clean up environment
setenv cleanup 'setenv ubootfile ; setenv tftploaduboot ; setenv tftpupdate ; setenv savetospi ; setenv cleanup ;'

# main script execution
run tftpupdate cleanup && echo success


Arr u.png    back to top

5 Additional Tags

Serial FLASH mapping on AMC1
Network settings for U-Boot on AMC1
Serial FLASH programming via U-Boot on AMC1


Contact Post.png Support Tool.png