Another Workaround for the "Yosemite Problem"

Mac OS X 10.10 (Yosemite) currently does not properly handle HDK-based mbed devices. When we connect such an mbed (e.g., FRDM-KL25) to a Mac running Yosemite, a dialog saying "OS X can't repair the disk ..." appears and the device is mounted in read-only mode. Fortunately for us, Okano-san already brought out an easy-to-use droplet that helps copying files into such devices.

Here is another workaround inspired by Okano-san's droplet; a launchd daemon version. The daemon continuously watches the file system of your Mac and automatically fixes the mode of an mbed to be writable when the device is connected. This also enables direct drag & drop copying of files into the mbed drive.

Warning

You need to be able to execute sudo for setting up this daemon. Incorrect sudo operations may cause serious damage to your system. The author tested this with only a limited number of mbeds and Macs. Please use this at your own risk.

Installation

  1. Download the package
  2. Unzip the package and execute install.sh as root
    • unzip mbedremounter.zip
    • cd mbedremounter
    • sudo sh install.sh

Uninstallation

  1. Execute uninstall.sh as root
    • sudo sh uninstall.sh

Usage

  1. Connect your (HDK-based) mbed devices. You can ignore the warning dialog by pressing "OK".
  2. Now your mbed drives are writable and you are ready to copy your executables to them. Drag-and-drop copying is also possible.

Tested Platforms

I've briefly tested that this daemon works with the following mbed platforms.

  • NXP mbed LPC1768 (this device works well without the daemon)
  • NXP LPC00-MAX
  • Freescale FRDM-KL25Z
  • Freescale FRDM-KL46Z
  • Freescale FRDM-K46F
  • ST Nucleo F401RE
  • Nordic nRF51822
  • Switch Science mbed HRM1017

I'm thankful to Okano-san who reported that this works with the following platforms.

  • Switch Science mbed LPC824
  • Switch Science mbed LPC1114FN28

Code

The daemon continuously watches the file system of your Mac and start the following Python script every time a disk is mounted. If the disk is mounted on /Volumes/MBED* (or /Volumes/NUCLEO*) and is read-only, the script re-mount it with appropriate settings.

mbedremounter.py

import re, subprocess

p = re.compile(r'(/dev/\S+) on (\S*(MBED|NUCLEO).*) \(msdos.*read-only.*\)')
for r in p.finditer(subprocess.check_output('mount')):
    (d, m) = r.group(1,2)
    subprocess.check_call(['umount', d])
    subprocess.check_call(['mkdir', m])
    subprocess.check_call(['mount', '-w', '-o', 'sync', '-t', 'msdos', d, m])

The code is also available at https://github.com/wtakuo/mbedremounter.


6 comments on Another Workaround for the "Yosemite Problem":

16 Dec 2014

Quote:

The mount point for mbed drives is fixed to /Volumes/MBED. This means that you cannot connect two or more mbeds at once.

Here is an improved version of the script:

A ruby script that will remount all read-only MBEDs

#!/usr/bin/ruby
IO.popen("mount").grep(%r{(\S+) on (/Volumes/MBED.*)\s\(.*read-only}) {
  d=$1
  m="\"#{$2}\""
  system("umount #{d}; mkdir -p #{m}; mount -w -o sync -t msdos #{d} #{m}")
}

And the corresponding plist

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.bikenomad.mbedremounter</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/ruby</string>
      <string>-e</string>
      <string>IO.popen("mount").grep(%r{(\S+) on (/Volumes/MBED.*)\s\(.*read-only}) { d=$1; m="\"#{$2}\""; system("umount #{d}; mkdir -p #{m}; mount -w -o sync -t msdos #{d} #{m}") }
      </string>
    </array>
    <key>StartOnMount</key>
    <true/>
  </dict>
</plist>
17 Dec 2014

Thank you very much. I'd just done similar thing before finding your comment! Your Ruby script looks smarter than my old fashioned shell script :) I hope it will be OK to adopt Ruby in future versions.

20 Dec 2014

Hi, Thank you very much for your solution!! I've tried that on Mac OSX 10.10.1 and a SeeedStudio Arch BLE board (with nRF51822 BLE chip) and the writing of hex files failed. Then I've downloaded the zip file from github, unistalled & re-installed it and everything worked fine! Do you mind if I share your solution and your github link? :-)

22 Dec 2014

Thank you for your comment. Of course I don't mind sharing this. I wonder why your first attempt was failed because the contents of the zip file linked above and those available at the github should be the same. I suspect that the reason is my usage of launchctl in install.sh is not correct. I will try to read the manual carefully.

22 Dec 2014

Actually I found that it often happens need I have to disconnect, reconnect the board and copy again the .hex file to succeed, even using the code on Github. I don't know why it happens but I admit I don't care at this stage, it's much more comfortable to use this workaround than give up my Mac!

08 Jan 2015

A quick note, when trying to flash the firmware (of the loader and not the device) it presents itself as BOOTLOADER.

It might be worth adding BOOTLOADER to the Volume names.

Please log in to post comments.