Skip to content

cannot import devicetree.edtlib for bossac runner #56435

@2bndy5

Description

@2bndy5

Describe the bug
Building off the solution for #37538, I'm finding that the bossac runner cannot import devicetree.edtlib, as evident from the warning generated by

if MISSING_EDTLIB:
self.logger.warning(
'could not import edtlib; something may be wrong with the '
'python environment')

Manually installing the devicetree pkg fixed this problem

python -m pip install scripts/dts/python-devicetree

But I'm wondering if there is a more runner specific solution instead of manually installing the pkg.

To Reproduce
I'm using samples/basic/blinky targeting the adafruit_itsybitsy_m4_express
Steps to reproduce the behavior:

  1. west build -b adafruit_itsybitsy_m4_express samples/basic/blinky
    
  2. west -v flash --bossac='C:\Program Files (x86)\BOSSA\bossac.exe' --bossac-port='COM16'
    
    Notes:
    • -v is only used to get the trace back for the warning about not importing edtlib.
    • the path to the bossac.exe is using v1.9.1 x64 from official releases, but I also was able to use the executable shipped with the Adafruit Arduino core for the SAMD v1.7.1 (which seems to use bossac.exe v1.8.0-48-gb176eee)
  3. Observe error via Python's trace back output.
  4. Manually install the lib and repeat step 2
    python -m pip install scripts/dts/python-devicetree
    
  5. Observe the led blinking on the board 🎉

Expected behavior
Since other modules in the scripts dynamically add the devicetree pkg to sys.path, I would expect the bossac runner to do something similar.

sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-devicetree',
'src'))
from devicetree import edtlib

But, maybe there's a more elegant solution.

Impact
Unable to flash programs using the bossac executable.

Environment (please complete the following information):

Additional context
The samples/hello_world seems to require extra config to enumerate the USB CDC serial device (for the adafruit_itsybotsy_m4_express), but I haven't delved into that. Not sure if that is even specific to the bossac runner; I'm still rather new to the zephyr project but I'm highly motivated to learn.

Metadata

Metadata

Assignees

Labels

Stalearea: WestWest utilitybugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions