#!/usr/bin/python
import fileinput, re, sys
#
# It turns out the "Trusty Secure OS" Crippleware on the Nexus 9 is
# good for least something. It is thankfully pretty chatty, meaning
# you can use it for logging from code where it's inconvenient
# or impossible to write to the UART directly, like MMU bringup code ;-).
#
# A sequence like:
# mov x0, #'V'
# smc #0xFFFF
#
# ...will result in the following getting emitted. I am guessing x1...x3
# get printed here as param0..2 but I am too lazy to check.
#
# smc_undefined:67: Undefined monitor call!
# smc_undefined:67: SMC: 0x56 (Stdcall entity 0 function 0x56)
# smc_undefined:67: param0: 0xf77c2e69
# smc_undefined:67: param1: 0xf77c2e68
# smc_undefined:67: param2: 0x0
#
# Now you can do basic logging to debug early bring-up. The following
# Python will turn your giant Minicom capture into something more
# sensible.
#
def process(line):
m = re.match('\s*smc_undefined:67: SMC: (0x[0-9a-f]+)', line)
if m:
sys.stdout.write(chr(int(m.groups()[0], 16)))
for line in fileinput.input():
process(line)
print("\n");
Friday, November 28, 2014
Using the Nexus 9 secure agent for debug logging
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment