Exercise - Deploy an Azure RTOS real-time sensor application to monitor the room environment
In this exercise, we'll deploy a real-time application to your Azure Sphere.
Step 1: Delete the existing applications on the Azure Sphere
There will be peripheral reassignments between the existing high-level application that is running on the Azure Sphere and the new real-time application that will be deployed to the Azure Sphere in this exercise. So you need to delete any existing applications on the Azure Sphere to avoid clashes.
From the Windows PowerShell command line or Linux Terminal, delete the existing application by running
azsphere device sideload delete
You must restart the Azure Sphere device to clear the existing silicon firewall settings. From the Windows PowerShell command line or Linux Terminal, run
azsphere device restart
Step 2: Open the project
Start Visual Studio Code.
From the menu, click File, then Open Folder.
Open the Azure-Sphere lab folder.
Open the Lab_6_AzureRTOS_Environment folder.
Click Select Folder or the OK button to open the project.
If you installed the Visual Studio Code Peacock extension, then Visual Studio Code will turn red. We will be connecting two instances of Visual Studio Code to the Azure Sphere. The red colored instance is connected to the real-time core.
Step 3: Set your developer board configuration
These labs support developer boards from AVNET and Seeed Studio. You need to set the configuration that matches your developer board.
The default developer board configuration is for the Avnet Azure Sphere Starter Kit Revision 1. If you have this board, there's no additional configuration required.
Open the CMakeList.txt file.
Add a
#
at the beginning of the set Avnet line to disable it.Uncomment the
set
command that corresponds to your Azure Sphere device developer board.set(AVNET TRUE "AVNET Azure Sphere Starter Kit Revision 1 ") # set(AVNET_REV_2 TRUE "AVNET Azure Sphere Starter Kit Revision 2 ") # set(SEEED_STUDIO_RDB TRUE "Seeed Studio Azure Sphere MT3620 Development Kit (aka Reference Design Board or rdb)") # set(SEEED_STUDIO_MINI TRUE "Seeed Studio Azure Sphere MT3620 Mini Dev Board")
Save the file. This will autogenerate the CMake cache.
Step 4: Deploy the Azure RTOS application to Azure Sphere
Select CMake: [Debug]: Ready from the Visual Studio Code Status Bar.
From Visual Studio Code, press F5 to build, deploy, start, and attached the remote debugger to the application now running the Azure Sphere device.
Step 5: Debugging real-time core applications
You can debug the Azure RTOS application running on Azure Sphere Cortex M4 real-time Core.
From Visual Studio Code, navigate to the demo_threadx directory, and open the demo_azure_rtos.c file.
Scroll down to the function named intercore_thread.
Note
Use Go to Symbol in Editor in Visual Studio Code. Use the keyboard shortcut Ctrl+Shift+O and start typing intercore_thread. You'll often see a function name listed twice in the drop-down. The first is the function prototype or forward signature declaration, and the second is the implementation of the function.
Set a breakpoint in the intercore_thread function on the line that reads switch (ic_control_block.cmd)
Note
You can learn how to set breakpoints from this Visual Studio Code Debugging article.
Leave Visual Studio Code and the app running with the breakpoint set. Next we are going to deploy a high-level app application to the Cortex A7 core that will request environment telemetry from the Real Time app running on the Cortex M4 core.