Skip to content

Commit c124f11

Browse files
committed
add target scripts to flash adl/tgl
Signed-off-by: Kieran Levin <[email protected]>
1 parent 037d2f2 commit c124f11

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

scripts/flash_adl_ec.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+

scripts/flash_tgl_ec.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+

0 commit comments

Comments
 (0)