flash_mmc_test.sh 1.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#!/bin/bash

# $1 - PTS path

echo "################################################################################"
echo "Flashing MMC"

RESP=$(openocd -f "./openocd/mmc_openocd.cfg" -c "lpprog ./LPC2136_FreeRTOS_CoreIPM.bin")

echo "RESP : $RESP"

TEST1=`echo $RESP | grep "auto unlock enabled"`
TEST2=`echo $RESP | grep "bytes from file"`
TEST3=`echo $RESP | grep "KiB/s)"`

echo "TEST1: $TEST1"
echo "TEST2: $TEST2"
echo "TEST3: $TEST3"

sleep 2

if [[ -z $TEST1 ]] || [[ -z $TEST2 ]] ||  [[ -z $TEST3 ]];then

  echo "################################################################################"
  echo "Flashing again"
#  RESP=`openocd -f "./openocd/mmc_openocd.cfg" -c "lpprog ./LPC2136_FreeRTOS_CoreIPM.bin"`
  RESP=$(openocd -f "./openocd/mmc_openocd.cfg" -c "lpprog ./LPC2136_FreeRTOS_CoreIPM.bin")
  cd $CURDIR 
  TEST1=`echo $RESP | grep "auto unlock enabled"`
  TEST2=`echo $RESP | grep "bytes from file)"`
  TEST3=`echo $RESP | grep "KiB/s)"`

  if [[ -z $TEST1 ]] || [[ -z $TEST2 ]] || [[ -z $TEST3 ]];then
    echo "PTS_ERROR: MMC flashing failed"
    exit 64
  else
    echo "PTS_OK: MMC flashing finished"
    exit 0
  fi
else
    echo "PTS_OK: MMC flashing finished"
    exit 0
fi