Azure SphereデバイスをTP4.2.1から18.11にアップデート

これの続きです。

matsujirushi.hatenablog.jp

バイスのOSをTP4.2.1から18.11にアップデートします。

リリースノートの手順に沿って、実行します。

docs.microsoft.com

バイスのOSバージョンを確認

バイスのOSバージョンを確認します。

C:\>azsphere device show-ota-status
warn: Your device's Azure Sphere OS version (TP4.2.1) is deprecated. Recover your device using 'azsphere device recover' and try again. See aka.ms/AzureSphereUpgradeGuidance for further advice and support.
Your device is running Azure Sphere OS version TP4.2.1.
The Azure Sphere Security Service is targeting this device with Azure Sphere OS version 18.11.
warn: Your device is running an older Azure Sphere OS version (TP4.2.1). It has not yet started receiving the available update to version 18.11.
warn: Your device is not connected to Wi-Fi. Please check the Wi-Fi configuration on your device and try again.
Go to aka.ms/AzureSphereUpgradeGuidance for further advice and support.
Command completed successfully in 00:00:03.6789809.

「Azure Sphereセキュリティサービスの対象は18.11」で、
「あなたのデバイス、TP4.2.1で廃止されるよ」と脅されますw

バイスグループを変更

TP4.2.1で作ったアプリケーションがOTAでインストールされないようにするため?に、デバイスのデバイスグループをSystem Software Onlyに設定します。

C:\>azsphere device update-device-group -d cd037ae5-27ca-4a13-9e3b-2a9d87f9d7bd
warn: Your device's Azure Sphere OS version (TP4.2.1) is deprecated. Recover your device using 'azsphere device recover' and try again. See aka.ms/AzureSphereUpgradeGuidance for further advice and support.
Successfully moved device '961B0F3AF5C4EA9581512975F8E21A81DFED93BEF7A73854D802C8BDEFF7F5A8516639B653E6F082009F5C660C9B96BB1B16F49A56D7DE51A089AC01AE3376EC' to device group 'cd037ae5-27ca-4a13-9e3b-2a9d87f9d7bd' in your Azure Sphere tenant.
Command completed successfully in 00:00:02.9167273.

はい、あいかわらずバージョンで脅されますが、デバイスグループが変更できました。

ちなみに、-dで指定しているcd037ae5-27ca-4a13-9e3b-2a9d87f9d7bdSystem Software Onlyの意味です。

バイスのOSをアップデート

では、OSをアップデートしましょう。

azsphere device recoverを実行せよ、ということですが、TP4.2.1では-iパラメータが必須でした。
どうやら、18.11でオプションになったようです。

C:\>azsphere device recover
Starting device recovery. Please note that this may take up to 10 minutes.
Board found. Sending recovery bootloader.
Erasing flash.
Sending images.
Sending image 1 of 16.
Sending image 2 of 16.
...
Sending image 16 of 16.
Finished writing images; rebooting board.
Device ID: 961B0F3AF5C4EA9581512975F8E21A81DFED93BEF7A73854D802C8BDEFF7F5A8516639B653E6F082009F5C660C9B96BB1B16F49A56D7DE51A089AC01AE3376EC
Device recovered successfully.
Command completed successfully in 00:02:40.9711364.

イメージファイルはここに展開されていました。 C:\Program Files (x86)\Microsoft Azure Sphere SDK\RecoveryImages

バイスのOSバージョンを確認(2回目)

バイスのOSバージョンを確認します。

C:\>azsphere device show-ota-status
Your device is running Azure Sphere OS version 18.11.
The Azure Sphere Security Service is targeting this device with Azure Sphere OS version 18.11.
Your device has the expected version of the Azure Sphere OS: 18.11.
Command completed successfully in 00:00:03.4614457.

アップデート完了!!

TP4.2.1のプロジェクトが実行できない

TP4.2.1で作ったプロジェクトを18.11で実行してみようとしたところ、プロジェクトにターゲットAPIセットが設定されていないとエラーになりました。

1>------ ビルド開始: プロジェクト: SteppingMotor, 構成: Debug ARM ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\AzureSphere.targets(38,5): error : 'Target API Set' project property is not set. Open the Project Properties and set this field using the drop-down box. Ensure that the Configuration selected on that page includes the active build configuration (e.g. Debug, Release, All Configurations).
1>プロジェクト "SteppingMotor.vcxproj" のビルドが終了しました -- 失敗。
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========

ターゲットAPIセットを1に設定したところ、問題なくコンパイル、実行できました。