summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei.gherzan@huawei.com>2021-02-16 15:33:07 +0000
committerNaveen Saini <naveen.kumar.saini@intel.com>2021-02-17 11:51:02 +0800
commit7dcb47371b59392bedef98f5b202970e91422983 (patch)
treeeba3d0e573acca555353a734724ffa58f9b611ab
parentbdbe1a04c1b6595d2c530e49656dbb6d6755e4b6 (diff)
downloadmeta-zephyr-7dcb47371b59392bedef98f5b202970e91422983.tar.gz
meta-zephyr-7dcb47371b59392bedef98f5b202970e91422983.tar.bz2
meta-zephyr-7dcb47371b59392bedef98f5b202970e91422983.zip
zephyr-flash-pyocd.bbclass: Handle import error for pyocd modules
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
-rw-r--r--classes/zephyr-flash-pyocd.bbclass7
1 files changed, 5 insertions, 2 deletions
diff --git a/classes/zephyr-flash-pyocd.bbclass b/classes/zephyr-flash-pyocd.bbclass
index df3b631..4d24e6a 100644
--- a/classes/zephyr-flash-pyocd.bbclass
+++ b/classes/zephyr-flash-pyocd.bbclass
@@ -1,8 +1,11 @@
CONNECT_TIMEOUT_SECONDS ?= "30"
python do_flash_usb() {
- from pyocd.core.helpers import ConnectHelper
- from pyocd.flash.file_programmer import FileProgrammer
+ try:
+ from pyocd.core.helpers import ConnectHelper
+ from pyocd.flash.file_programmer import FileProgrammer
+ except ImportError:
+ bb.fatal("Flashing with pyocd needs the relevant python package. Make sure your host provides it or consult your distribution packages for how to install this prerequisite.")
timeout = int(d.getVar('CONNECT_TIMEOUT_SECONDS'))
image = f"{d.getVar('DEPLOY_DIR_IMAGE')}/{d.getVar('PN')}.elf"