From: Andrei Gherzan <[email protected]>

Signed-off-by: Andrei Gherzan <[email protected]>
---
 classes/zephyr-flash-pyocd.bbclass | 7 +++++--
 1 file 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"
-- 
2.30.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#52343): https://lists.yoctoproject.org/g/yocto/message/52343
Mute This Topic: https://lists.yoctoproject.org/mt/80680679/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to