Serial and Zephyr support for Visual Studio and VS Code
We are continuing to improve our embedded development support in Visual Studio and VS Code. We have recently introduced a serial monitor and RTOS support for Zephyr. These capabilities are present in Visual Studio 17.3 Preview 1 as part of the Linux and embedded development workload. The Embedded Tools extension for VS Code also includes these capabilities, though the serial monitor is available as a stand-alone extension as well. This post illustrates these new capabilities in Visual Studio and VS Code.
To start the serial monitor in Visual Studio in the Debug > Windows > Serial Monitor.
To start the serial monitor in Visual Studio Code go to the command palate Ctrl + Shift + P and enter “serial” then select Focus on Serial Monitor View.
The serial monitor enumerates the available ports in the Port dop down box. You can set the baud rate and line ending mode in their own drop down boxes. Select start monitoring to connect to the selected device.
There are toggle buttons to clear output, prefix time stamps to the output, and select whether the output scrolls or not.
There is a text box at the bottom of the monitor you can use to send message to the connected serial port.
When you are done you can select stop monitoring.
We have added support to our RTOS objects view for Zephyr.
To start the RTOS objects views in Visual Studio, go to the menu Debug > Windows > RTOS Objects. In Visual Studio Code go to the command palate Ctrl + Shift + P and enter “rtos” then select Focus on RTOS viewer view.
Our extension detects the type of RTOS you are using automatically, there is nothing to set to get the correct view across Azure RTOS, FreeRTOS, or Zephyr.
We do not have a prepared example using vcpkg for project activation, we used the Zephyr projects instructions to configure our environment. Note that there are some Zephyr projects which do not use threads, in those cases our RTOS viewer will not activate as there is nothing for it to display. You also need to ensure that your build includes the necessary debugging symbols, for example:
west build -p auto -b mimxrt1060_evk samples\basic\threads -DCONFIG_DEBUG_THREAD_INFO=y -DCONFIG_INIT_STACKS=y -DCONFIG_THREAD_STACK_INFO=y
Send us your feedback
We hope that these new capabilities will enable you to choose Visual Studio or VS Code for your embedded development needs and make you more productive. We are very interested in your feedback to continue to improve this experience. The comments below are open, or you can find us on Twitter (@VisualC), or via email at firstname.lastname@example.org.