2017年12月26日火曜日

SwissMicros DM42のfirmware update (w/ dfu-util)

update information:

* 2018-10-15: 2018-10-07にfirmware v3.11がreleaseされた。USB cable接続時にfreezeするbugが解決されたのでupgrade推奨
* 2018-03-26: 2018-03-25にfirmware v3.5がreleaseされた
* 2018-02-19: 2018-02-12にfirmware v3.3がreleaseされた
* 2018-01-07: 2018-01-05にfirmware v3.2がreleaseされた

(追記は以上)


届いたDM42のfirmwareはv3.0だったので、2017-12-26現在の最新版であるv3.1にupgradeした。

upgrade前 (v3.0)

upgrade後 (v3.1)

手順はhttps://www.swissmicros.com/dm42/doc/dm42_user_manual/#_firmware_updateに詳しく解説されているので参照のこと。

たぶん、Windowsでdm_toolを使ったfirmware upgradeは誰かがやっていると思うので、Linux (Debian)からdfu-utilを使ってやってみた。

概要

必要なもの


* SwissMicros DM42
* Linux box (w/ USB)
* USB cable (A-microB)
* 細いピン (或いは伸ばしたゼムクリップ)



手順


準備 ※一度行えば以降は不要


* Linux machineにdfu-utilをinstall (apt-get install dfu-util)
* DM42を認識するようにudevを設定 (あるいはsudoでdfu-utilを使う)

firmware update


* firmwareをdownload (DM42_flash_XX.bin)
* DM42をbootloader modeに移行
* DM42とLinux machineをUSB cableで接続 (DM42側はmicroUSB, PC側はA)
* dfu-utilsで書き込み
* DM42の背面にあるRESET buttonを細いピンのようなもので押してreset

実際のlog


USB cableでDM42 (bootloader mode)を接続した際のdmesg。

% dmesg
...
[676590.811335] usb 1-1.7: new full-speed USB device number 8 using ehci-pci
[676590.890786] usb 1-1.7: New USB device found, idVendor=0483, idProduct=df11
[676590.890789] usb 1-1.7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[676590.890791] usb 1-1.7: Product: STM32  BOOTLOADER
[676590.890792] usb 1-1.7: Manufacturer: STMicroelectronics
[676590.890794] usb 1-1.7: SerialNumber: ************

dfu-utilで認識しているか確認。

% dfu-util -l
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0483:df11] ver=2200, devnum=8, cfg=1, intf=0, path="1-1.7", alt=2, name="@OTP Memory /0x1FFF7000/01*0001Ke", serial="************"
Found DFU: [0483:df11] ver=2200, devnum=8, cfg=1, intf=0, path="1-1.7", alt=1, name="@Option Bytes  /0x1FFF7800/01*040 e/0x1FFFF800/01*040 e", serial="2069328B4834"
Found DFU: [0483:df11] ver=2200, devnum=8, cfg=1, intf=0, path="1-1.7", alt=0, name="@Internal Flash  /0x08000000/512*0002Kg", serial="************"

実際の書き込み。

% dfu-util -D DM42_flash_3.1.bin -d 0483:df11 -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x8000000
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing 
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 865928
Download        [=========================] 100%       865928 bytes
Download done.
File downloaded successfully

蛇足: 失敗例


ちなみに、CLIで実行する場合には手順を説明したpageから (ここからではなく)のcopy'n'pasteを推奨する。著者は-s 0x8000000とすべきところを-s 0x800000と「0」を1つ少なく書いたばかりに「書き込めない」とのerrorを見る羽目になった。


% dfu-util -D DM42_flash_3.1.bin -d 0483:df11 -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x800000
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x00800000, size = 865928
dfu-util: Last page at 0x008d3687 is not writeable


0 件のコメント:

コメントを投稿