Skip to content

Commit cf5388b

Browse files
Merge pull request #3 from FrameworkComputer/lotus
Add azalea and lotus scripts
2 parents ba88441 + d2167bc commit cf5388b

3 files changed

Lines changed: 120 additions & 0 deletions

File tree

scripts/flash_azalea_ec.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
CTRLUART=/dev/ttyACM0
4+
FLASHUART=ttyACM1
5+
6+
if [ $# -eq 0 ]; then
7+
#no argument, try default locations
8+
search_paths=("${HOME}/software/ec-lotus/src/platform/ec/build/zephyr/azalea/output"\
9+
"${HOME}/chromiumos/src/platform/ec/build/zephyr/azalea/output")
10+
11+
for search in ${search_paths[@]}
12+
do
13+
if [ -d $search ]
14+
then
15+
echo "${search} exists"
16+
FLASH_SRC="${search}/ec.bin"
17+
MONITOR="${search}/npcx_monitor.bin"
18+
fi
19+
done
20+
else
21+
#allow specifying a file as argument
22+
FLASH_SRC="$1/ec.bin"
23+
MONITOR="$1/npcx_monitor.bin"
24+
fi
25+
echo "USING ${FLASH_SRC} to flash EC"
26+
27+
#clear any invalid commands from uart buffer
28+
echo -e "\n" > ${CTRLUART}
29+
#put ec into reset
30+
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
31+
#read INPUT < /dev/ttyACM0
32+
sleep 1
33+
34+
#enable 10k external pulldown on UART RX wired to pin 20
35+
echo -e "\npin 4 0 opendrain\n" > ${CTRLUART}
36+
sleep 1
37+
38+
# take out of reset
39+
echo -e "\npin 21 1\n" > ${CTRLUART}
40+
sleep 1
41+
#### DO FLASH
42+
echo "Using NUVOTON Tool ./uartupdatetool"
43+
./uartupdatetool --port ${FLASHUART} --opr wr --addr 0x200c3020 --file ${MONITOR}
44+
./uartupdatetool --port ${FLASHUART} --opr wr --auto --addr 0x0000 --file ${FLASH_SRC}
45+
46+
47+
#### TAKE OUT OF RESET
48+
49+
#put ec into reset
50+
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
51+
#read INPUT < /dev/ttyACM0
52+
sleep 1
53+
54+
#disable 10k external pulldown on UART RX wired to pin 20
55+
echo -e "\npin 4 1 opendrain\n" > ${CTRLUART}
56+
sleep 1
57+
58+
59+
# take out of reset
60+
echo -e "\npin 21 1\n" > ${CTRLUART}

scripts/flash_lotus_ec.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
CTRLUART=/dev/ttyACM0
4+
FLASHUART=ttyACM1
5+
6+
if [ $# -eq 0 ]; then
7+
#no argument, try default locations
8+
search_paths=("${HOME}/software/ec-lotus/src/platform/ec/build/zephyr/lotus/output"\
9+
"${HOME}/chromiumos/src/platform/ec/build/zephyr/lotus/output")
10+
11+
for search in ${search_paths[@]}
12+
do
13+
if [ -d $search ]
14+
then
15+
echo "${search} exists"
16+
FLASH_SRC="${search}/ec.bin"
17+
MONITOR="${search}/npcx_monitor.bin"
18+
fi
19+
done
20+
else
21+
#allow specifying a file as argument
22+
FLASH_SRC="$1/ec.bin"
23+
MONITOR="$1/npcx_monitor.bin"
24+
fi
25+
echo "USING ${FLASH_SRC} to flash EC"
26+
27+
#clear any invalid commands from uart buffer
28+
echo -e "\n" > ${CTRLUART}
29+
#put ec into reset
30+
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
31+
#read INPUT < /dev/ttyACM0
32+
sleep 1
33+
34+
#enable 10k external pulldown on UART RX wired to pin 20
35+
echo -e "\npin 4 0 opendrain\n" > ${CTRLUART}
36+
sleep 1
37+
38+
# take out of reset
39+
echo -e "\npin 21 1\n" > ${CTRLUART}
40+
sleep 1
41+
#### DO FLASH
42+
echo "Using NUVOTON Tool ${software/ec/build/hx30/util/uartupdatetool}"
43+
~/software/ec/build/hx30/util/uartupdatetool --port ${FLASHUART} --opr wr --addr 0x200c3020 --file ${MONITOR}
44+
~/software/ec/build/hx30/util/uartupdatetool --port ${FLASHUART} --opr wr --auto --addr 0x0000 --file ${FLASH_SRC}
45+
46+
47+
#### TAKE OUT OF RESET
48+
49+
#put ec into reset
50+
echo -e "\npin 21 0 opendrain\n" > ${CTRLUART}
51+
#read INPUT < /dev/ttyACM0
52+
sleep 1
53+
54+
#disable 10k external pulldown on UART RX wired to pin 20
55+
echo -e "\npin 4 1 opendrain\n" > ${CTRLUART}
56+
sleep 1
57+
58+
59+
# take out of reset
60+
echo -e "\npin 21 1\n" > ${CTRLUART}

scripts/uartupdatetool

89.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)