servo_updater: allow differing console enpoints

servo_micro has the console on intf 3, while servo_v4
has it's console on intf 0. Abstract this into the
config file rather than hardcoding.

BUG=b:37513705
BRANCH=None
TEST=update servo_micro

Signed-off-by: Nick Sanders <nsanders@chromium.org>
Change-Id: I0090a0d081e001e62ffa7235eebbd6131ea00dcf
Reviewed-on: https://chromium-review.googlesource.com/769794
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
Nick Sanders
2017-11-13 14:57:41 -08:00
committed by chrome-bot
parent 054c4ea83a
commit 5cee174602
3 changed files with 8 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
"board": "servo micro",
"vid": "0x18d1",
"pid": "0x501a",
"console": "3",
"Comment on flash": "This is the base address of writeable flash",
"flash": "0x8000000",
"Comment on region format": "name: [baseoffset, length]",

View File

@@ -33,7 +33,7 @@ def flash(brdfile, serialno, binfile):
p.stop()
def select(vidpid, serialno, region, debuglog=False):
def select(vidpid, iface, serialno, region, debuglog=False):
if region not in ["rw", "ro"]:
raise Exception("Region must be ro or rw")
@@ -41,7 +41,8 @@ def select(vidpid, serialno, region, debuglog=False):
c.wait_for_usb(vidpid, serialname=serialno)
# make a console
pty = c.setup_tinyservod(vidpid, 0, serialname=serialno, debuglog=debuglog)
pty = c.setup_tinyservod(vidpid, iface,
serialname=serialno, debuglog=debuglog)
cmd = "sysjump %s\nreboot" % region
pty._issue_cmd(cmd)
@@ -71,12 +72,13 @@ def main():
data = json.load(data_file)
vidpid = "%04x:%04x" % (int(data['vid'], 0), int(data['pid'], 0))
iface = int(data['console'], 0)
select(vidpid, serialno, "ro", debuglog=debuglog)
select(vidpid, iface, serialno, "ro", debuglog=debuglog)
flash(brdfile, serialno, binfile)
select(vidpid, serialno, "rw", debuglog=debuglog)
select(vidpid, iface, serialno, "rw", debuglog=debuglog)
flash(brdfile, serialno, binfile)

View File

@@ -3,6 +3,7 @@
"board": "servo v4",
"vid": "0x18d1",
"pid": "0x501b",
"console": "0",
"Comment on flash": "This is the base address of writeable flash",
"flash": "0x8000000",
"Comment on region format": "name: [baseoffset, length]",