From 63b93335804f4374f2b91b47f41129854814c93e Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Sat, 2 May 2020 10:52:40 -0700 Subject: [PATCH] [uTVM] Reset target and wait for runtime initialization on connect. (#5499) * This ensures a clean runtime environment for tuning and evaluating tasks. * This patch assumes that the code flashed to target executes the ARM BKPT or RISC-V EBREAK instructions after startup. --- src/runtime/micro/openocd_low_level_device.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime/micro/openocd_low_level_device.cc b/src/runtime/micro/openocd_low_level_device.cc index 0f21d6674740..91df8b9006ea 100644 --- a/src/runtime/micro/openocd_low_level_device.cc +++ b/src/runtime/micro/openocd_low_level_device.cc @@ -20,8 +20,8 @@ /*! * \file openocd_low_level_device.cc */ -#include #include +#include #include "micro_common.h" #include "low_level_device.h" @@ -46,7 +46,10 @@ class OpenOCDLowLevelDevice final : public LowLevelDevice { port_ = port; socket_.Connect(tvm::support::SockAddr(server_addr_.c_str(), port_)); - socket_.cmd_builder() << "halt 0"; + socket_.cmd_builder() << "reset run"; + socket_.SendCommand(); + + socket_.cmd_builder() << "halt 500"; socket_.SendCommand(); }