Difference between revisions of "Reset U-Boot environment on AMC1"

From DSignT Support Database
Jump to: navigation, search

m (Claus moved page Reset U-Boot environment to Reset U-Boot environment on AMC1 without leaving a redirect)
Line 3: Line 3:
 
     run resetenv
 
     run resetenv
  
The script [[Reset_U-Boot_environment#Script AMC1_ClearEnvironment.ser|AMC1_ClearEnvironment.ser]] (s. below) is used to reset the AMC1 U-Boot environment. Use a serial terminal to send this script to your board. The script is executed automatically, no further commands are necessary. After the script succeeds, the AMC1 is re-bootet and you should see the following boot message:
+
The script [[Reset_U-Boot_environment_on_AMC1#Script_AMC1_ClearEnvironment.ser|AMC1_ClearEnvironment.ser]] (s. below) is used to reset the AMC1 U-Boot environment. Use a serial terminal to send this script to your board. The script is executed automatically, no further commands are necessary. After the script succeeds, the AMC1 is re-bootet and you should see the following boot message:
  
 
<syntaxhighlight lang=c style="border:1px blue">
 
<syntaxhighlight lang=c style="border:1px blue">
Line 158: Line 158:
  
 
== Additional Tags ==
 
== Additional Tags ==
  [[AMC1 serial FLASH mapping]]
+
  [[Serial FLASH mapping on AMC1]]
  [[AMC1 U-Boot: serial FLASH programming]]
+
  [[Serial FLASH programming via U-Boot on AMC1]]
 
  http://www.denx.de/wiki/U-Boot/TaskSetEnvironmentDefaults
 
  http://www.denx.de/wiki/U-Boot/TaskSetEnvironmentDefaults
 
  http://processors.wiki.ti.com/index.php/Modifying_U-boot
 
  http://processors.wiki.ti.com/index.php/Modifying_U-boot

Revision as of 10:10, 15 November 2017

1 Reset AMC1 U-Boot environment

   setenv resetenv 'env default -f -a && saveenv && reset'
   run resetenv

The script AMC1_ClearEnvironment.ser (s. below) is used to reset the AMC1 U-Boot environment. Use a serial terminal to send this script to your board. The script is executed automatically, no further commands are necessary. After the script succeeds, the AMC1 is re-bootet and you should see the following boot message:

<debug_uart>

U-Boot 2017.01 (Aug 29 2017 - 13:35:23 +0200)

CPU  : AM437X-GP rev 1.2
I2C:   ready
DRAM:  512 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
In:    serial
Out:   serial
Err:   serial
Net:   cpsw
Hit any key to stop autoboot:  0
========= D.SignT U-Boot first boot ==========
AMC1>

No further program is booted and the U-Boot command processor is waiting for configuration steps.

If you enter the print environment command printenv, all factory settings will be displayed on your terminal:

AMC1> printenv
arch=arm
autoconf=off
autoload=n
baudrate=115200
board=amc1
board_name=amc1
bootcmd=run firstboot;
bootdelay=2
bootm_size=0x20000000
console=ttyS2,115200n8
cpu=armv7
device=eth1
eth1addr=c4:be:84:cb:1f:ff
ethact=cpsw
ethaddr=c4:be:84:cb:1f:fd
fdt_addr_r=0x88000000
fdt_high=0xffffffff
fdtaddr=0x88000000
firstboot=echo ========= D.SignT U-Boot first boot ==========
hostname=AMC1-10004
kernel_addr_r=0x82000000
loadaddr=0x80200000
ramdisk_addr_r=0x88080000
rdaddr=0x88080000
soc=am33xx
stderr=serial
stdin=serial
stdout=serial
vendor=D.SignT GmbH & Co. KG

Environment size: 617/65532 bytes
AMC1>


Arr u.png    back to top


2 bootcmd

The macro bootcmd is automatically executed when the U-Boot command processor is activated after boot. After executing AMC1_ClearEnvironment.ser the bootcmd is set to execute the firstboot macro which in turn prints the ========= D.SignT U-Boot first boot ========== message after booting. To change the boot behaviour, you simply need to change the bootcmd environment variable to a reasonable boot macro.


Arr u.png    back to top


3 Problems sending the script

You can either enter the commands by hand on your terminal or send the entire script at once via text file upload. Since the serial UART on the AMC1 uses a small cache and each command is interpreted after receiving a CR or LF immediately, it may happen that the one or the other line is broken. This may happen particularly if a long operation is in progress (e.g. a FLASH erase command). To avoid this situation all commands are usually stored as macros via setenv command and executed at the end of the script with the run command.

If you observe such broken lines despite this, you can add some delay after sending a line in your terminal. E.g. in TeraTerm:

TeraTerm delay settings


Arr u.png    back to top


4 Script AMC1_ClearEnvironment.ser

The full script is listed here:

###################################################################//##
#
# @file       AMC1_ClearEnvironment.ser
# @verbatim                 _         _             _
#                        __| |    ___(_) ____ _ __ | |_
#                       / _` |   / __| |/ _` | '_ \| __|
#                      | (_| | _ \__ \ | (_| | | | | |_
#                       \__,_|(_) ___/_|\__, |_| |_|\__|
#                      Signalprocessing |___/ Technology
# @endverbatim
# @brief      U-Boot script to clear AMC1 U-Boot environment
# @author     D.SignT GmbH & Co. KG, Claus Hermbusche
# @date       2017-08-29 01:42 PM
#
# This script resets and clears all U-Boot environment variables on the
# AMC1 to its default values and restarts the board with the clean en-
# vironment.
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#! Warnings:                                                          !
#! - your network settings will be cleared and need to be reconfigured!
#! - your boot settings will be cleared and need to be set            !
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# The environment space on the AMC1 is located in serial QSPI FLASH at
# address 0x100000 and is 0x10000 bytes large. If this script succeeds,
# only this specific area is erased and re-written with default values.
# No other space on eMMC or USB or I2C is affected.
#
# Variables after env default command:
#   arch=arm
#   autoconf=off
#   baudrate=115200
#   board=amc1
#   board_name=amc1
#   bootcmd=setenv autoload n; run nfsboot;
#   bootdelay=2
#   bootm_size=0x20000000
#   console=ttyS2,115200n8
#   cpu=armv7
#   device=eth1
#   fdt_addr_r=0x88000000
#   fdt_high=0xffffffff
#   fdtaddr=0x88000000
#   kernel_addr_r=0x82000000
#   loadaddr=0x80200000
#   nfsboot=echo Booting from network disabled;
#   ramdisk_addr_r=0x88080000
#   rdaddr=0x88080000
#   soc=am33xx
#   vendor=D.SignT GmbH & Co. KG
#
# After reset some more variables are added:
#   autoload=n
#   eth1addr=c4:be:84:cb:1f:ff       <- depends on chip ID
#   ethact=cpsw
#   ethaddr=c4:be:84:cb:1f:fd        <- depends on chip ID
#   hostname=AMC1-10004              <- depends on serial number
#   stderr=serial
#   stdin=serial
#   stdout=serial
#
#######################################################################

setenv resetenv 'env default -f -a && saveenv && reset'
run resetenv


Arr u.png    back to top


5 Additional Tags

Serial FLASH mapping on AMC1
Serial FLASH programming via U-Boot on AMC1
http://www.denx.de/wiki/U-Boot/TaskSetEnvironmentDefaults
http://processors.wiki.ti.com/index.php/Modifying_U-boot


Contact Post.png Support Tool.png