J-Link on VirtualBox
This article describes how to use J-Link on a guest operating system inside a virtual machine of Oracle's VirtualBox.
How to setup
Before using J-Link inside a VirtualBox VM, the Oracle VM VirtualBox Extension Pack needs to be installed.
The extension pack provides support for USB 2.0 and USB 3.0 devices (and more) and as such is mandatory to use J-Link. The steps below describe how to install the extension pack:
- On the host system, navigate to https://www.virtualbox.org/wiki/Downloads
- Download the Oracle VM VirtualBox Extension Pack for All supported platforms
- Make sure no VirtualBox virtual machines are running
- Install the extension pack
- On Windows, this can be done by double-clicking the .vbox-extpack file and following the instructions shown on screen
- After successful installation of the extension pack, open the virtual machine settings
- In the USB category, make sure "USB 2.0" is selected
- Start the virtual machine
- Make sure J-Link is attached to the guest system by right-clicking the USB icon in the task bar and selecting the J-Link USB device, if not already checked
- Now, J-Link will be successfully detected and can be used by J-Link software running on the guest system
How to setup on Ubuntu
The following section quotes an article from the Ubuntu Documentation.
Set up USB
sudo adduser USERNAME vboxusers
Logout and login for this to take effect.
For persistent device connection to VM
- Open VirtualBox, go to Settings for the VM, Go to USB.
- Click USB+ Icon and select device from List.
- This will add a Filter Spec to the List, repeat as necessary for more devices.
- Start VM - Devices should appear in Guest OS, and mount or request drivers etc. as applicable for the OS.
- Devices Mounted in Guest OS will be unavailable in Host OS.
For temporary device connection to VM
- Insert USB Device and Wait for it to activate in Host OS.
- Start or go to VM.
- Right Click USB Icon in the VM Status Bar at bottom of screen, OR from Menu go Devices > USB Devices, and select desired device.
- Devices should appear in Guest OS, and mount or request drivers etc as normal for the OS.