Yosemite file copier for HDK-based mbed

Try Mac OS X 10.10.3

Mac OS X 10.10.3 has been officially released (09-Apr-2015(JST)) which can mount HDK-based mbed without firmware update.
https://developer.mbed.org/forum/mbed/topic/5149/?page=1#comment-27653

Information

Revised mbed-interface firmware delivery has been started
Please visit a page of your platform and check the updated firmware availability first.

NOTE: For NUCLEO series, you may need to modify the script. Please find here.


mbedインターフェースの改訂版ファームウェアの提供が徐々に始まっています.
まずはご使用になられるプラットフォームの解説ページに行き,ファームウェア更新の有無を御確認ください.

注: NUCLEOにコピーする場合には,スクリプトの変更が必要なようです.こちらを参照ください

Better solution is available now!

New solution has been shared by Mr. WATANABE. Please visit following link.
The new solution is far better than mine :)

新しい解決法がWATANABEさんによって公開されています.下のリンクを御覧ください.
この新しいやり方のほうがはるかに便利です (^ ^)

Click! → Another Workaround for the "Yosemite Problem"

(17-Dec.-2014)

Newer version applet available (2015Jan15 version)

New version is available. Previous version was having a problem which makes a file named MBED under /Volumes/ directory while the mbed is not connected.

If there is a /Volumes/MBED" as a file, not directory, please erase the file and use new version.


以前のバージョンではmbedが接続されていないときに動作させると,/Volumes/下にMBEDという名前のファイルを作ってしまう問題がありました.この 対策版を公開しました.

もし/Volumes/MBEDがディレクトリとしてでなくファイルとして存在しているようなら,一旦これを消して,新しいバージョンを使うようにしてください.

(この問題はこちらの記事でご指摘いただきました.ありがとうございます!)

Information

Japanese version available in lower half of this page.
このページの後半に日本語版が用意されています.

What is this?

/media/uploads/okano/dnd_into_droplet.png

This is just a file copy helper for HDK-based mbed on Mac OS X 10.10 (Yosemite).
At this moment, the HDK-based mbed boards (other than mbed-LPC1768 and mbed-LPC11U24) cannot be mounted correctly on Yosemite.
If you need to do it on Yosemite, you should execute long command on Terminal.app like next example.

sudo mount -u -w -o sync /Volumes/MBED ; cp -X ~/Downloads/mbed_blinky_LPC824_MAX_LPC824.bin /Volumes/MBED/

It is bit troublesome to type those commands for me, so I made a small application (droplet) for copying.

How to use

With this droplet, all you need to do is...

  1. Connect your mbed board to USB on Mac.
  2. You will be warned by Yosemite as "The volume cannot repair" but ignore and press OK button to delete its dialog box window.
  3. Drag&drop the mbed executable file into the droplet.
  4. You will be asked to enter the administrator password (this is necessary to re-mount the mbed volume).
  5. You will see same warning like step-2 when the copy is completed. Ignore again.
  6. Press RESET button on the mbed. You will get the code is running ;)
  7. If you need to copy again, drag&drop the file again

Download / Code

Download

The binary is available here. Unzip and copy on anywhere you want to put.
Please use this app at your own risk.
This program is distributed under Apache-2.0 license

/media/uploads/okano/mbed-on-yosemite.app-20150115.zip


For ST's Nucleo series, it has different volume name. Please use next link to download a version for Nucleo.
/media/uploads/okano/nucleo-on-yosemite.app.zip

(*
 *  mbed executable copier for Yosemite
 *  01-Nov-2014, tedd
 *
 * this program is distributed under Apache-2.0 license
 *   http://opensource.org/licenses/Apache-2.0
 *)

on open newFile
	set targetPath to "/Volumes/MBED/" -- target volume (last '/' added on 2015Jan15)
	set action1 to "sudo mount -u -w -o sync  " & targetPath & ";" -- re-mounting the mbed volume
	
	set newFileName to POSIX path of newFile -- get the file name and path in POSIX format
	set action2 to "cp -X " & newFileName & " " & targetPath -- copy command
	set comm to action1 & action2 -- concatinate all commands in a string
	
	do shell script comm password "" with administrator privileges -- execute all commands on a shell
end open

Customize / Modification

If you need customize the script, you can do it on your Mac.
Just drag&drop the droplet into "Script Editor.app". You can edit the code and save to create new app :)

/media/uploads/okano/editing_script_by_scripteditor_yosemite.png


これはなに?

/media/uploads/okano/dnd_into_droplet.png

これはMac OS X 10.10(Yosemite)上でHDKベースのmbedにファイルをコピーするツールです.
いまのところHDKベースのmbed(mbed-LPC1768とmbed-LPC11u24以外のmbed)はYosemiteで正しくマウントすることができません
どうしてもYosemiteでこれをやりたいときには,次の例のようなコマンドをターミナル上で実行しなくてはなりません.

sudo mount -u -w -o sync /Volumes/MBED ; cp -X ~/Downloads/mbed_blinky_LPC824_MAX_LPC824.bin /Volumes/MBED/

これはちょっと面倒です.そんなわけで簡単なアプリケーション(ドロップレット)を作りました.

どう使うの?

このドロップレットは次のように使います.

  1. mbedをMacに接続します
  2. 「OS Xはディスク"MBED"を修復できません」という警告がでますがOKボタンを押して無視します.
  3. ドロップレットにmbedの実行ファイルをドラッグ・アンド・ドロップします.
  4. 管理者パスワードを聞かれます (面倒ですが,ディスクを再マウントするために必要です).
  5. コピーが終わると,上記の2番の警告がまた出ますが無視します.
  6. mbed基板のリセット・ボタンを押せば,mbedの実行コードが動作するはずです (^▽^)
  7. もし再度コピーをするなら,またファイルをドラッグ・アンド・ドロップします.

ダウンロード / コード

ダウンロード

そのまま使える.appファイルをここに置いておきます.zipを解凍して好きなところに保存して下さい.
このアプリケーションは,ユーザ自身の判断と責任で使用してください.

このプログラムはApache-2.0ライセンス下で配布されています
/media/uploads/okano/mbed-on-yosemite.app-20150115.zip


STのNucleoシリーズではボリューム名が違うため,上のドロップレットは動作しません.Nucleo用は次のリンクからダウンロードしてください.
/media/uploads/okano/nucleo-on-yosemite.app.zip

(*
 *  mbed executable copier for Yosemite
 *  01-Nov-2014, tedd
 *
 * this program is distributed under Apache-2.0 license
 *   http://opensource.org/licenses/Apache-2.0
 *)

on open newFile
	set targetPath to "/Volumes/MBED/" -- target volume (last '/' added on 2015Jan15)
	set action1 to "sudo mount -u -w -o sync  " & targetPath & ";" -- re-mounting the mbed volume
	
	set newFileName to POSIX path of newFile -- get the file name and path in POSIX format
	set action2 to "cp -X " & newFileName & " " & targetPath -- copy command
	set comm to action1 & action2 -- concatinate all commands in a string
	
	do shell script comm password "" with administrator privileges -- execute all commands on a shell
end open

カスタマイズ / 改造

スクリプトの改造が必要な場合はMac上で簡単に変更できます.
このドロップレットを「スクリプトエディタ.app」にドラッグ・アンド・ドロップするだけ.エディタが開くので,これを編集して保存しなおせば新しいappの出来上がりです (^ ^)

/media/uploads/okano/editing_script_by_scripteditor_yosemite.png


17 comments on Yosemite file copier for HDK-based mbed:

01 Nov 2014

@okano, thank you for sharing !

14 Nov 2014

@okana, very nice and it works!

17 Nov 2014

I test , but not work : www:~ xxxxxxx$ sudo mount -u -w -o sync /Volumes/MBED ; cp -X /Downloads/mbed_blinky_LPC824_MAX_LPC824.bin /Volumes/MBED/ Password: cp: /Users/xxxxxx/Downloads/mbed_blinky_LPC824_MAX_LPC824.bin: No such file or directory

How write ReadBearLab : www:~ xxxxxxx$ sudo mount -u -w -o sync /Volumes/MBED ; cp -X /Downloads/my.hex /Volumes/MBED/ Password: cp: /Users/xxxxxxx/Downloads/my.hex: No such file or directory

please one solution !

18 Nov 2014

Hi Francesco,

I think you tried the command on terminal, right? Since I don't have the RedBearLab board, I cannot try.

Your terminal message is meaning "the file cannot be found". Please make sure the file path is correct. If you feel it's troublesome to type the path, you can do it drag&drop also.

It can be done like this.
When you need to type the path, just drag and drop (d&d) the file into the terminal window.
/media/uploads/okano/dnd_bin.png

Then you will get the path in the command line.
/media/uploads/okano/dnd_bin_result.png

Same thing can be done for volume also.
/media/uploads/okano/dnd_vol.png

The result of the d&d. The command line got volume name.
/media/uploads/okano/dnd_vol_result.png

Now you can type [return] to execute.
/media/uploads/okano/executed_fine.png

This is easy way to operate the terminal but I still don't like this. That's why I made this droplet. I hope you will try this also. http://developer.mbed.org/media/uploads/okano/mbed-on-yosemite.app.zip
/media/uploads/okano/dnd_into_droplet.png

18 Nov 2014

OMG thank you!! totally worked. Hope you don't mind but I am sharing this with my computer science class.

19 Nov 2014

C B wrote:

OMG thank you!! totally worked. Hope you don't mind but I am sharing this with my computer science class.

I'm very happy if you like it and share with everyone! :)

19 Nov 2014

Hello. Thank you very much for your cooperation. I have tried both with the shell "sh" is the shell "csh", but I can not copy the file to MBED.

I'll show you the result of the terminal:

[www:/Desktop/MBED] xxxxxxx% sudo mount -u -w -o sync sudo mount -u -w -o sync: Command not found. [www:/Desktop/MBED] xxxxx% cp -X /Users/xxxxx/Desktop/my.hex usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory [www:/Desktop/MBED] xxxxxx% ls -a1r mbed.htm System Volume Information .metadata_never_index .fseventsd .. . [www:/Desktop/MBED] xxxxxx% ls -a1R . .. .fseventsd .metadata_never_index System Volume Information mbed.htm

./.fseventsd: . .. no_log

./System Volume Information: . .. IndexerVolumeGuid [www:/Desktop/MBED] xxxxxx%

20 Nov 2014

Francesco Pavoni wrote:

[www:/Desktop/MBED] xxxxxxx% sudo mount -u -w -o sync sudo mount -u -w -o sync: Command not found.

It says your shell could not find the 'mount' command.
So you need to set "path" first.

I think the shell may be set to have the path in default but you may need to do by yourself.

In my case, the 'mount' command is stored as '/sbin/mount'. If your environment is same as mine, try..
(Please make sure the 'mount' command on your machine)

On 'sh' or 'bash'

export PATH="$PATH:/sbin"


If you want to try same thing on 'csh' or 'tcsh', you may nee to execute

set path = ($path /sbin)


After executing those command, you can check it by

echo $PATH

The list of your path will be shown.

Once you set the correct path, you can execute the command anytime.

To set those path as permanent, you nee to modify preference file. Please refer to..
http://www.cyberciti.biz/faq/unix-linux-adding-path/

20 Nov 2014

sudo mount is recognized by the terminal. the problem of bash is determined by -o. I tried this solution, but not helpful. As you can see, MBED is shown in read-only.

www:MBED xxxxxx$ sudo mount -u -w Password: /dev/disk0s2 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) /dev/disk1s2 on /Volumes/GMobileDrive (hfs, local, journaled) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) /dev/disk2 on /Volumes/MBED (msdos, local, nodev, nosuid, read-only, noowners) www:MBED xxxxxxx$ cp -X /Users/xxxxx/Desktop/my.hex usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory www:MBED xxxxxxx$ ls -a1R . .. .fseventsd .metadata_never_index System Volume Information mbed.htm

./.fseventsd: . .. no_log

./System Volume Information: . .. IndexerVolumeGuid www:MBED xxxxxx$

20 Nov 2014

I'm sorry if sometimes I write things not right, but I was not familiar with Unix.

I tried in every way, but the state is always read only:

www:MBED xxxxx$ cp -X /Users/xxxxx/Desktop/my.hex /Volumes/MBED cp: /Volumes/MBED/my.hex: Read-only file system

www:MBED xxxxx$ sudo mount -u -w -o sync /Volumes/MBED www:MBED xxxxx$ cp /Users/xxxx/Desktop/my.hex /Volumes/MBED www:MBED xxxxxx$ ls -a1R . .. .fseventsd .metadata_never_index System Volume Information mbed.htm

./.fseventsd: . .. no_log

./System Volume Information: . .. IndexerVolumeGuid www:MBED xxxxxxx$

www:MBED xxxxx$ mount -u -w -o sync /dev/disk0s2 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) /dev/disk1 on /Volumes/MBED (msdos, local, nodev, nosuid, read-only, noowners)

or :

www:MBED xxxxx$ sudo mount -u -o -w sync Password: mount: unknown special file or file system sync.

- -u The -u flag indicates that the status of an already mounted file system should be changed. Any of the options discussed above (the -o option) may be changed; also a file system can be changed from read-only to read-write or vice versa. An attempt to change from read-write to read-only will fail if any files on the filesystem are currently open for writing unless the -f flag is also specified. The set of options is determined by first extracting the options for the file system from the filesystem table (see getfsent(3)) then applying any options specified by the -o argument, and finally applying the -r or -w option.

sync All I/O to the file system should be done synchronously.

update The same as -u; indicate that the status of an already mounted file system should be changed.

20 Nov 2014
21 Nov 2014

Hi Francesco,
I'm not sure why the mount command is not working. I think it should be same as mine but difference may be the bed board. If you have different type of bed board, please try.

15 Dec 2014

Just so you are aware neither the Dropplet nor mount command is working for me (OS X Yosemite 10.10.1, Mid 2011 iG iMac). But thank you so much for your hard work

16 Jan 2015

I was getting the error on my ST Nucleo F411RE:

mount: unknown special file or file system /Volumes/NUCLEO/

I had to make the following changes to get this working:

(*
 *  mbed executable copier for Yosemite
 *  01-Nov-2014, tedd
 *
 * this program is distributed under Apache-2.0 license
 *   http://opensource.org/licenses/Apache-2.0
 *)

on open newFile
	set targetPath to "/Volumes/NUCLEO" -- remove trailing slash and change MBED to NUCLEO
	set action1 to "sudo mount -u -w -o sync  " & targetPath & ";" -- re-mounting the mbed volume
	
	set newFileName to POSIX path of newFile -- get the file name and path in POSIX format
	set action2 to "cp -X " & newFileName & " " & targetPath & "/" -- add trailing slash
	set comm to action1 & action2 -- concatinate all commands in a string
	
	do shell script comm password "" with administrator privileges -- execute all commands on a shell
end open
18 Jan 2015

Hi Christopher,

Thank you for sharing the modification.
I recommend to add a slash at end of the string : "/Volumes/NUCLEO/" (in line #10).

The last slash will prevent to make unnecessary file if the Nucleo is not connected to PC.

22 Jan 2015

Hi Tedd,

Adding a slash causes the following error when using Nucleo F411RE (I just tested it again tonight to confirm):

/media/uploads/cdwilson/yosemite-mbed-fail.png

The only way this works on my Mac is to remove the slash from line 10 above and add it back to line 14 above.

Remove trailing slash:

set targetPath to "/Volumes/NUCLEO" -- remove trailing slash and change MBED to NUCLEO

Add it back here:

set action2 to "cp -X " & newFileName & " " & targetPath & "/" -- add trailing slash

After making these changes, everything works just fine.

25 Jan 2015

Hi Christopher,

Thank you for trying and sharing the information.
(Since I don't have NUCLEO, I cannot confirm. Sorry.)

I've got my Nucleo today. (04-Feb-2015)
Now the version for Nucleo is available also ;)

Please log in to post comments.