Segger J-Link and OSX

Segger has native OSX support for their J-Link devices, but what nobody tells you is that OSX’s built-in CDC driver prevents the JLinkExe and JLinkGDBServer from actually being able to communicate with the J-Link:

$ JLinkExe
SEGGER J-Link Commander V4.86 ('?' for help)
Compiled Jun  6 2014 19:09:03
Can not connect to J-Link via USB.
J-Link>

Christopher Mason has a GCC development setup for nRF51822 and in there is a script which unloads the OSX CDC driver. The script is called disable_cdc.sh and its contents are pretty straightforward:

#!/bin/bash

sudo kextunload /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBCDCACMData.kext
sudo kextunload /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBCDCECMData.kext
sudo kextunload /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBCDCACMControl.kext
sudo kextunload /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBCDC.kext

Once the CDC drivers are out of the way, JLinkExe finds the device just fine:

$ JLinkExe
SEGGER J-Link Commander V4.86 ('?' for help)
Compiled Jun  6 2014 19:09:03
DLL version V4.86, compiled Jun  6 2014 19:08:58
Firmware: J-Link OB-SAM3U128 V1 compiled Dec 11 2013 20:20:11
Hardware: V1.00
S/N: 480207023
VTarget = 3.300V
Info: Could not measure total IR len. TDO is constant high.
Info: Could not measure total IR len. TDO is constant high.
No devices found on JTAG chain. Trying to find device on SWD.
Info: Found SWD-DP with ID 0x0BB11477
Info: Found Cortex-M0 r0p0, Little endian.
Info: FPUnit: 4 code (BP) slots and 0 literal slots
Cortex-M0 identified.
Target interface speed: 100 kHz

Note that Christopher Mason’s repo isn’t required for nrf51822 development under Linux or OSX; they’ve moved toward a standard development environment now, although if you don’t want to use CodeSourcery you should probably look at the nrf51-pure-gcc-setup github repo, as it has a good set of templates for getting nrf51822 projects up without the CodeSourcery-specifc libcs3 linker environment.

Add picture from clipboard (Maximum size: 1 GB)