soc: xtensa: add support for specifying the service port
Add specifying the port for the remote cavstool remote service. Ex. west flash --remote-host {host}:{port} \ --pty {host}:{port} Specify the port is optional when running west. And another major change is now we have to specify the remote log service by --pty to make it output the log message immediately. Previously it will output directly. Why we make this change is because this is more close to the behavior we use west flash. Fixes. #46865 Signed-off-by: Enjia Mai <enjia.mai@intel.com>
This commit is contained in:
parent
ae7f349367
commit
e33fd73546
3 changed files with 33 additions and 14 deletions
|
@ -482,8 +482,6 @@ class DeviceHandler(Handler):
|
|||
command.append("--tool-opt=-SelectEmuBySN %s" % (board_id))
|
||||
elif runner == "stm32cubeprogrammer":
|
||||
command.append("--tool-opt=sn=%s" % (board_id))
|
||||
elif runner == "intel_adsp":
|
||||
command.append("--pty")
|
||||
|
||||
# Receive parameters from runner_params field.
|
||||
if hardware.runner_params:
|
||||
|
|
|
@ -68,9 +68,9 @@ class IntelAdspBinaryRunner(ZephyrBinaryRunner):
|
|||
help='the default basename of the key store in board.cmake')
|
||||
parser.add_argument('--key',
|
||||
help='specify where the signing key is')
|
||||
parser.add_argument('--pty', action="store_true",
|
||||
help='the log will not output immediately to STDOUT, you \
|
||||
can redirect it to a serial PTY')
|
||||
parser.add_argument('--pty',
|
||||
help=''''Capture the output of cavstool.py running on --remote-host \
|
||||
and stream it remotely to west's standard output.''')
|
||||
|
||||
@classmethod
|
||||
def do_create(cls, cfg, args):
|
||||
|
@ -122,15 +122,20 @@ class IntelAdspBinaryRunner(ZephyrBinaryRunner):
|
|||
|
||||
# Copy the zephyr to target remote ADSP host and run
|
||||
self.run_cmd = ([f'{self.cavstool}','-s', f'{self.remote_host}', f'{send_bin_fw}'])
|
||||
self.log_cmd = ([f'{self.cavstool}','-s', f'{self.remote_host}', '-l'])
|
||||
|
||||
self.logger.debug(f"cavstool({self.cavstool}), fw('{send_bin_fw})")
|
||||
self.logger.debug(f"rcmd: {self.run_cmd}")
|
||||
|
||||
self.check_call(self.run_cmd)
|
||||
|
||||
# If the self.pty assigned, the output the log will
|
||||
# not output to stdout directly. That means we can
|
||||
# make the log output to the PTY.
|
||||
if not self.pty:
|
||||
# If the self.pty is assigned, the log will output to stdout
|
||||
# directly. That means you don't have to execute the command:
|
||||
#
|
||||
# cavstool_client.py -s {host}:{port} -l
|
||||
#
|
||||
# to get the result later separately.
|
||||
if self.pty is not None:
|
||||
self.log_cmd = ([f'{self.cavstool}','-s', f'{self.pty}', '-l'])
|
||||
|
||||
self.logger.debug(f"rcmd: {self.log_cmd}")
|
||||
|
||||
self.check_call(self.log_cmd)
|
||||
|
|
|
@ -9,9 +9,11 @@ import argparse
|
|||
import socket
|
||||
import struct
|
||||
import hashlib
|
||||
from urllib.parse import urlparse
|
||||
|
||||
RET = 0
|
||||
HOST = None
|
||||
PORT = 0
|
||||
PORT_LOG = 9999
|
||||
PORT_REQ = PORT_LOG + 1
|
||||
BUF_SIZE = 4096
|
||||
|
@ -110,14 +112,14 @@ def main():
|
|||
log.info("Monitor process")
|
||||
|
||||
try:
|
||||
client = cavstool_client(HOST, PORT_LOG, args)
|
||||
client = cavstool_client(HOST, PORT, args)
|
||||
client.send_cmd(CMD_LOG_START)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
else:
|
||||
log.info("Uploading process")
|
||||
client = cavstool_client(HOST, PORT_REQ, args)
|
||||
client = cavstool_client(HOST, PORT, args)
|
||||
client.send_cmd(CMD_DOWNLOAD)
|
||||
|
||||
ap = argparse.ArgumentParser(description="DSP loader/logger client tool")
|
||||
|
@ -133,7 +135,21 @@ args = ap.parse_args()
|
|||
if args.quiet:
|
||||
log.setLevel(logging.WARN)
|
||||
|
||||
HOST = args.server_addr
|
||||
if args.server_addr:
|
||||
url = urlparse("//" + args.server_addr)
|
||||
|
||||
if url.hostname:
|
||||
HOST = url.hostname
|
||||
|
||||
if url.port:
|
||||
PORT = int(url.port)
|
||||
else:
|
||||
if args.log_only:
|
||||
PORT = PORT_LOG
|
||||
else:
|
||||
PORT = PORT_REQ
|
||||
|
||||
log.info(f"REMOTE HOST: {HOST} PORT: {PORT}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue