Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JLinkExe missing during flash build (nrf52840_dongle) #30

Closed
roycewilliams opened this issue Feb 10, 2020 · 12 comments
Closed

JLinkExe missing during flash build (nrf52840_dongle) #30

roycewilliams opened this issue Feb 10, 2020 · 12 comments

Comments

@roycewilliams
Copy link

roycewilliams commented Feb 10, 2020

I'm the "total noob use case" smoke tester this week. 😆

Expected Behavior

  • Missing JLinkExe detected and cleanly handled
  • Note of JLinkExe as a dependency in docs
  • Doc hints (maybe including a link to the Tock Getting Started doc?)
  • If a Segger flasher or other separate flash device is required, doc this as well, including any (brief) info necessary to select a compatible unit

Actual Behavior

  • Uncaught error if JLinkExe is missing (it's not clear to me if the automatic Tock "import" was supposed to also bring in JLinkExe?)

Steps to Reproduce the Problem

  • Run board=nrf52840_dongle ./deploy.sh os app without JLinkExe available

Specifications

[...]
tockloader  flash --address 0x00000 --jlink --board nrf52dk target/thumbv7em-none-eabi/release/nrf52840_dongle.bin
Flashing binar(y|ies) to board...
Using known arch and jtag-device for known board nrf52dk
Traceback (most recent call last):
  File "/home/royce/.local/bin/tockloader", line 11, in <module>
    sys.exit(main())
  File "/home/royce/.local/lib/python3.6/site-packages/tockloader/main.py", line 593, in main
    args.func(args)
  File "/home/royce/.local/lib/python3.6/site-packages/tockloader/main.py", line 216, in command_flash
    tock_loader.flash_binary(binary, args.address)
  File "/home/royce/.local/lib/python3.6/site-packages/tockloader/tockloader.py", line 63, in flash_binary
    self.channel.flash_binary(address, binary)
  File "/home/royce/.local/lib/python3.6/site-packages/tockloader/jlinkexe.py", line 96, in flash_binary
    self._run_jtag_commands(commands, binary)
  File "/home/royce/.local/lib/python3.6/site-packages/tockloader/jlinkexe.py", line 63, in _run_jtag_commands
    p = subprocess.run(jlink_command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'JLinkExe': 'JLinkExe'

Makefile:24: recipe for target 'flash' failed
make: *** [flash] Error 1
make: Leaving directory '/media/S_DATA/data/linux-root/usr/local/src/sec/security-keys/OpenSK/third_party/tock/boards/nordic/nrf52840_dongle'
@roycewilliams
Copy link
Author

roycewilliams commented Feb 10, 2020

Looking more closely, I see that the upstream Tock docs do cover the docs part somewhat. If it is only possible to use the J-Link EDU with the full development board, and not the USB stick version, or what combinations might work, covering that in the README would also be helpful for users who don't have a lot of JTAG experience. 😳

@conashin
Copy link

So, do we need any other things when flashing nrf52840 dongle?

@ibndias
Copy link

ibndias commented Feb 11, 2020

Looking more closely, I see that the upstream Tock docs do cover the docs part somewhat. If it is only possible to use the J-Link EDU with the full development board, and not the USB stick version, or what combinations might work, covering that in the README would also be helpful for users who don't have a lot of JTAG experience.

Do you already have Jlink installed?
If not then install from this .deb
Jlink Linux 64

@conashin
Copy link

Looking more closely, I see that the upstream Tock docs do cover the docs part somewhat. If it is only possible to use the J-Link EDU with the full development board, and not the USB stick version, or what combinations might work, covering that in the README would also be helpful for users who don't have a lot of JTAG experience.

Do you already have Jlink installed?
If not then install from this .deb
Jlink Linux 64

Can I install a jlink flasher?
https://www.segger.com/downloads/flasher/JLink_Linux_x86_64.deb

@ibndias
Copy link

ibndias commented Feb 11, 2020

@conashin if you had an error like
FileNotFoundError: [Errno 2] No such file or directory: 'JLinkExe': 'JLinkExe'
Then yes, but make sure you're downloading the right one for your platform.
JLink Download Page

@conashin
Copy link

conashin commented Feb 12, 2020

@SuperDeron System pop-up this window when I was trying to flash it.
IMG_20200212_162643_965

Does it need something else with hardware?

@jmichelp
Copy link
Collaborator

According to the very first line in the dialog window, your JLink probe is not detected: "No emulators connected via USB"

@jrvanwhy
Copy link

I deployed OpenSK to a nrf52840-DK using OpenOCD rather than JLinkExe. To do so, I needed an up-to-date version of OpenOCD (newer than my distro packages), and I made tweaks to tockloader, tock, and OpenSK's deploy.sh.

I'll work on upstreaming (less hacky versions of) the changes I've made. Upstreaming will take some time, as I expect to make changes serially across three repositories. I'll open a separate issue for OpenOCD support when I've made enough progress to put together a coherent issue title/body.

@jmichelp
Copy link
Collaborator

Thanks Johnathan! Be aware that I'm currently almost done rewriting the deploy.sh script in python3. This should give us more flexibility and portability (python3 is already a dependency for tockloader anyway).

Let's coordinate so that I'm not adding more work to merge your contributions.

@jrvanwhy
Copy link

Thanks Johnathan! Be aware that I'm currently almost done rewriting the deploy.sh script in python3. This should give us more flexibility and portability (python3 is already a dependency for tockloader anyway).

Let's coordinate so that I'm not adding more work to merge your contributions.

I opened #35 to track/coordinate this effort. I don't expect it to collide with your deploy.sh changes. I added a flag to tockloader (tock/tockloader#52) then tweaked deploy.sh and tock so that I could pass the flags through.

@jmichelp
Copy link
Collaborator

PR #40 now checks for JLinkExe.

Thanks to Johnathan and the community, it seems that we're going to be able to support different flashing methods, including using the pre-flashed Nordic bootloader. Covering how to setup the JTAG probes on everyone's environment is in my opinion out of scope for this project.

@roycewilliams
Copy link
Author

roycewilliams commented Feb 20, 2020

Yep, works just as intended - thanks for this!

For the upcoming native Nordic bootloader work - is that tracking under #35 ? Which issue(s) should I follow to track that? (I ask here so that other people with this interest can find the thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants