RTAppを2つ動かしてみる
前記事。
あぁ、この記事のシリーズ、写真も無いし画像も少ないし、ちょっとマニアックな内容で、、、誰か読む人いるんだろうか?と思いながら、備忘的に書いています。
今回はRTAppを2つ同時に動かしてみましょう。
RTApp 2つ = RTCore 2つ
RTApp、というかRTCoreは、アプリケーションの実行を管理する「OS」というものが存在しません。
ので、RTAppを2つ動かすということは、必然的にRTCoreを2つ使うことになります。1つ目のRTAppがRTCore #0で動いているとすると、2つ目のRTAppはRTCore #1で動かすこと。
実行するRTApp
前記事と同様、サンプルのSamples/HelloWorld/HelloWorld_RTApp_MT3620_BareMetalを使います。
1つ目のRTAppは、サンプルを未修正で使います。ビルドして出来たHelloWorld_RTApp_MT3620_BareMetal.imagepackageを、別ファイル名にコピーしておきます。
copy HelloWorld_RTApp_MT3620_BareMetal.imagepackage c:\azuresphere\HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage 1 個のファイルをコピーしました。
2つ目のRTAppは、app_manifest.jsonのComponentIdを良い感じに変更して(w)、ついでにmain.cのシリアル送信メッセージも変更して、ビルド、コピーします。
1つ目 ... d3b80666-feaf-433a-b294-6a5846853b4a、"Tick"/"Tock"
2つ目 ... d3b80666-feaf-433a-b294-6a5846853b4b、"One"/"Two"
実行!
念のためdeleteしてから、2つのRTAppを手動でデプロイします。
C:\AzureSphere>azsphere device sideload delete C:\AzureSphere>azsphere device sideload deploy --imagepackage HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage Deploying 'HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage' to the attached device. warn: This app targets Beta APIs that may change or be removed in future. Image package 'HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage' has been deployed to the attached device. C:\AzureSphere>azsphere device sideload deploy --imagepackage HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage Deploying 'HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage' to the attached device. warn: This app targets Beta APIs that may change or be removed in future. Image package 'HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage' has been deployed to the attached device. C:\AzureSphere>
どれどれ、、、
C:\AzureSphere>azsphere device app show-status d3b80666-feaf-433a-b294-6a5846853b4a: App state: running d3b80666-feaf-433a-b294-6a5846853b4b: App state: running C:\AzureSphere>
動いているっぽい。
ロジアナで測定すると、
オォー!動いてる♪
IO0_TXDがサンプル無修正品で、IO1_TXDがサンプル修正品。
実行しているRTCoreを入れ替え
それでは、RTAppの起動順を変えてみて、実行するRTCoreが入れ替わるか見てみましょう。
C:\AzureSphere>azsphere device app stop -i d3b80666-feaf-433a-b294-6a5846853b4a d3b80666-feaf-433a-b294-6a5846853b4a: App state: stopped C:\AzureSphere>azsphere device app stop -i d3b80666-feaf-433a-b294-6a5846853b4b d3b80666-feaf-433a-b294-6a5846853b4b: App state: stopped C:\AzureSphere>azsphere device app start -i d3b80666-feaf-433a-b294-6a5846853b4b d3b80666-feaf-433a-b294-6a5846853b4b App state: running Core : 1 C:\AzureSphere>azsphere device app start -i d3b80666-feaf-433a-b294-6a5846853b4a d3b80666-feaf-433a-b294-6a5846853b4a App state: running Core : 0 C:\AzureSphere>
あれ!?
入れ替わらねー
デプロイ順かな?試してみます。
C:\AzureSphere>azsphere device sideload delete Component 'd3b80666-feaf-433a-b294-6a5846853b4a' deleted or was not present beforehand. Component 'd3b80666-feaf-433a-b294-6a5846853b4b' deleted or was not present beforehand. C:\AzureSphere>azsphere device sideload deploy --imagepackage HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage Deploying 'HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage' to the attached device. warn: This app targets Beta APIs that may change or be removed in future. Image package 'HelloWorld_RTApp_MT3620_BareMetal-one.imagepackage' has been deployed to the attached device. C:\AzureSphere>azsphere device sideload deploy --imagepackage HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage Deploying 'HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage' to the attached device. warn: This app targets Beta APIs that may change or be removed in future. Image package 'HelloWorld_RTApp_MT3620_BareMetal-tick.imagepackage' has been deployed to the attached device. C:\AzureSphere>
入れ替わった!!
ということは、デプロイ時に実行するRTCoreの割り当てがされているんですね。
おまけ
RTAppを3つデプロイするとエラー。(ふむふむ)
Visual StudioでRTApp(RTCore)をデバッグ実行したときの振る舞い
Seeeduino->IoT PnP Bridge (RasPi4)->Azure IoT Central、構築手順
先月末から、IoT PnP Bridgeをゴニョゴニョとやっていたわけですが、やっとIoT PnP BridgeのUARTを動かす方法が確立できたので書いておきます。
やること
Seeeduino(Arduino Uno互換機)からUART出力する(疑似温度データ)を、IoT PnP Bridgeを動かしたRaspberry Pi 4を経由して、Azure IoT Centralへ送り、グラフ表示します。
続きを読むサイドロードを有効にできない
azsphere device enable-development
コマンドでサイドロードを有効にしようとしたところ、
error: Device group 'Development' for product 'POTestSKU' cannot be found.
というエラーが発生しました。
C:\>azsphere device enable-development Getting device group 'Development' for product 'POTestSKU'. error: Device group 'Development' for product 'POTestSKU' cannot be found. Ensure that you have the right permissions to execute this command in the selected Azure Sphere tenant. Please see https://aka.ms/AzureSphereSDKHelp/Cloud for troubleshooting or suggestions. error: Trace ID: 42fcf6a8-4d49-4625-bc8e-a6baed0bd71d error: Can't retrieve the target device group. error: Product 'POTestSKU' does not have a 'Development' device group. Run 'azsphere product device-group create-defaults --productname "POTestSKU"' and then retry. C:\>
新しい認証モデルへ移行する前に、特定SKUに割り当てているとエラーが出るのかな?
続きを読む