Add errors for detect nand

This commit is contained in:
computermouth 2016-11-28 17:08:58 -08:00
parent 6b331c4306
commit 7c4258145c
2 changed files with 27 additions and 11 deletions

View File

@ -8,7 +8,7 @@ IMAGESDIR=".new/firmware/images"
DL_URL="http://opensource.nextthing.co/chip/images" DL_URL="http://opensource.nextthing.co/chip/images"
WGET="wget -q --show-progress" WGET="wget -q"
FLAVOR=server FLAVOR=server
BRANCH=stable BRANCH=stable
@ -168,7 +168,18 @@ echo == preparing images ==
require_directory "$IMAGESDIR" require_directory "$IMAGESDIR"
rm -rf ${IMAGESDIR} rm -rf ${IMAGESDIR}
require_directory "$DL_DIR" require_directory "$DL_DIR"
dl_probe
##pass
dl_probe || (
##fail
echo -e "\n FLASH VERIFICATION FAILED.\n\n"
echo -e "\tTROUBLESHOOTING:\n"
echo -e "\tIs the FEL pin connected to GND?"
echo -e "\tHave you tried turning it off and turning it on again?"
echo -e "\tDid you run the setup script in CHIP-SDK?"
echo -e "\tDownload could be corrupt, it can be re-downloaded by adding the '-f' flag."
echo -e "\n\n"
)
##pass ##pass
flash_images && ready_to_roll || ( flash_images && ready_to_roll || (

View File

@ -69,6 +69,8 @@ wait_for_fel() {
#------------------------------------------------------------ #------------------------------------------------------------
detect_nand() { detect_nand() {
local RC=0
local tmpdir=`mktemp -d -t chip-uboot-script-XXXXXX` local tmpdir=`mktemp -d -t chip-uboot-script-XXXXXX`
local ubootcmds=$tmpdir/uboot.cmds local ubootcmds=$tmpdir/uboot.cmds
local ubootscr=$tmpdir/uboot.scr local ubootscr=$tmpdir/uboot.scr
@ -76,35 +78,38 @@ detect_nand() {
echo "nand info echo "nand info
env export -t -s 0x100 0x7c00 nand_erasesize nand_writesize nand_oobsize env export -t -s 0x100 0x7c00 nand_erasesize nand_writesize nand_oobsize
reset" > $ubootcmds reset" > $ubootcmds
mkimage -A arm -T script -C none -n "detect NAND" -d $ubootcmds $ubootscr mkimage -A arm -T script -C none -n "detect NAND" -d $ubootcmds $ubootscr || RC=1
if ! wait_for_fel; then if ! wait_for_fel; then
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode" echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
RC=1
exit 1 exit 1
fi fi
$FEL spl $IMAGESDIR/sunxi-spl.bin $FEL spl $IMAGESDIR/sunxi-spl.bin || RC=1
# wait for DRAM initialization to complete # wait for DRAM initialization to complete
sleep 1 sleep 1
$FEL write $UBOOTMEMADDR $IMAGESDIR/u-boot-dtb.bin $FEL write $UBOOTMEMADDR $IMAGESDIR/u-boot-dtb.bin || RC=1
$FEL write $UBOOTSCRMEMADDR $ubootscr $FEL write $UBOOTSCRMEMADDR $ubootscr || RC=1
$FEL exe $UBOOTMEMADDR $FEL exe $UBOOTMEMADDR || RC=1
if ! wait_for_fel; then if ! wait_for_fel; then
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode" echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
exit 1 exit 1
fi fi
$FEL read 0x7c00 0x100 $tmpdir/nand-info $FEL read 0x7c00 0x100 $tmpdir/nand-info || RC=1
echo "NAND detected:" echo "NAND detected:"
cat $tmpdir/nand-info cat $tmpdir/nand-info || RC=1
UBI_TYPE="$(cat $tmpdir/nand-info | awk -F= '/erase/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/write/ {print $2}')" UBI_TYPE="$(cat $tmpdir/nand-info | awk -F= '/erase/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/write/ {print $2}')"
echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type || RC=1
source $tmpdir/nand-info source $tmpdir/nand-info || RC=1
rm -rf $tmpdir rm -rf $tmpdir
return $RC
} }
#------------------------------------------------------------ #------------------------------------------------------------