File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ CTRLUART=/dev/ttyACM0
3+ FLASHUART=/dev/ttyACM2
4+ if [ $# -eq 0 ]; then
5+ # no argument, try default location
6+ FLASH_SRC=~ /ec/build/hx30/ec.bin
7+ else
8+ # allow specifying a file as argument
9+ FLASH_SRC=$1
10+ fi
11+
12+ if [ -f " $FLASH_SRC " ]; then
13+ cp $FLASH_SRC ec.bin.tmp
14+ else
15+ echo " No source file to flash was found at $FLASH_SRC "
16+ exit 1
17+ fi
18+
19+ # clear any invalid commands from uart buffer
20+ echo -e " \n" > ${CTRLUART}
21+ # put ec into reset
22+ echo -e " \npin 21 0 opendrain\n" > ${CTRLUART}
23+ # read INPUT < /dev/ttyACM0
24+ sleep 1
25+ # put teensy into serprog mode
26+ echo -e " \nterm 2 8\n" > ${CTRLUART}
27+ # read INPUT < /dev/ttyACM0
28+ sleep 1
29+ # flashrom --programmer ch341a_spi -w ec.bin
30+
31+ truncate -s 1M ec.bin.tmp
32+ flashrom -p serprog:dev=${FLASHUART} :115200,spispeed=2000000 -w ec.bin.tmp
33+ rm ec.bin.tmp
34+ # disable flashrom
35+ echo -e " \nterm 2 2\n" > ${CTRLUART}
36+ # read INPUT < /dev/ttyACM0
37+ sleep 1
38+ # take ec out of reset
39+ echo -e " \npin 21 1\n" > ${CTRLUART}
40+ # read INPUT < /dev/ttyACM0
41+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ CTRLUART=/dev/ttyACM0
3+ FLASHUART=/dev/ttyACM2
4+ if [ $# -eq 0 ]; then
5+ # no argument, try default location
6+ FLASH_SRC=~ /ec/build/hx20/ec.bin
7+ else
8+ # allow specifying a file as argument
9+ FLASH_SRC=$1
10+ fi
11+
12+ if [ -f " $FLASH_SRC " ]; then
13+ cp $FLASH_SRC ec.bin.tmp
14+ else
15+ echo " No source file to flash was found at $FLASH_SRC "
16+ exit 1
17+ fi
18+
19+ # clear any invalid commands from uart buffer
20+ echo -e " \n" > ${CTRLUART}
21+ # put ec into reset
22+ echo -e " \npin 17 0 opendrain\n" > ${CTRLUART}
23+ # read INPUT < /dev/ttyACM0
24+ sleep 1
25+ # put teensy into serprog mode
26+ echo -e " \nterm 2 8\n" > ${CTRLUART}
27+ # read INPUT < /dev/ttyACM0
28+ sleep 1
29+ # flashrom --programmer ch341a_spi -w ec.bin
30+
31+ truncate -s 1M ec.bin.tmp
32+ flashrom --noverify -p serprog:dev=${FLASHUART} :115200 -w ec.bin.tmp
33+ rm ec.bin.tmp
34+ # disable flashrom
35+ echo -e " \nterm 2 2\n" > ${CTRLUART}
36+ # read INPUT < /dev/ttyACM0
37+ sleep 1
38+ # take ec out of reset
39+ echo -e " \npin 17 1\n" > ${CTRLUART}
40+ # read INPUT < /dev/ttyACM0
41+
You can’t perform that action at this time.
0 commit comments