Advanced Features
Software Development Kits > Platform IO
Debugging
Note: the debug feature is not supported by MM-IoT-SDK2.0.x. Please update to MM-IoT-SDK 2.1.x or newer.
The Debug view can be opened by clicking the Run and Debug button on the toolbar on the left side (Figure 25). Click on the green play button on the top to initiate a debug session. The project will be built in debug configuration and uploaded on the board automatically. Once this completes the debug session is started and the program is halted at the entry point.
It is important that the correct environment is chosen to match the board under evaluation so that PlatformIO can configure the debug session correctly. In the status bar, at the bottom of Visual Studio Code ensure your Project Environment is selected. Default refers to the first environment in the platformio.ini, which is typically mm-ekh08-u575.
Figure 25. PlatformIO project environment selection
You can find more information about the debugging features on the following links:
https://docs.platformio.org/en/stable/integration/ide/vscode.html#debugging
https://code.visualstudio.com/docs/editor/debugging
Figure 26. Run and Debug
Inspection Tool
The PlatformIO inspection tool provides more insight into the composition of the program and its resource usage. It provides static code and memory usage analysis of the application. The inspection tool can be started by clicking Inspect in the Quick access menu (Figure 27). On the Project Inspection dialogue, select the project and the environment that you want to inspect. Click on the Inspect button and wait for the process to complete.
Figure 27. Quick access menu
After the tool completes the analysis, you can see the overview page (Figure 28). On this you will see the summary of the memory usage (RAM and Flash) and any defects that are found during the static code analysis.
Figure 28. Overview page of the inspection tool
Static Code Analysis
The static code analysis is by default performed by a tool called Cppcheck. By default the tool is run with --enable=all flags and runs all the available checks. The result of the analysis can be seen on the Defects page (Figure 29). The location of the defect in the source code is provided with a link on the Location column which can be clicked to view the defect. For more information on static code analysis in PlatformIO, refer to:
https://docs.platformio.org/en/stable/advanced/static-code-analysis/index.html
Figure 29. Defects page
Memory Analysis
The symbols view lists all the symbols of the program, the memory section on which they are located, the address, size, symbol type and binding attributes (Figure 30). Similar information could be obtained with a tool such as readelf of GNU binutils. This information can be useful for example in memory usage analysis or other advanced debugging scenarios. The Sections view lists all memory sections of the program (Figure 31). This information could be used when analysing memory consumption and its division between volatile and non-volatile memory. Similar information could be obtained with the readelf tool by running the dump section headers command.
Figure 30. Symbols view
Figure 31. Sections view