3rd Party Utilities
Other Software You May Find Useful
This is a collection of third-party utilities that we have found to be useful. These are not Microchip products and we cannot endorse or support them. These links are provided for your convenience only.
Terminal Emulators
A "terminal emulator" is a software application that emulates a text terminal or system console. Think of the old CRT displays used to interface with a mainframe in the 1980s.
Today, embedded developers can use a terminal emulator to send and receive ASCII characters or data via a serial port (UART) on the development board.
There are many different terminal emulation programs to choose from. The following are a couple of examples that have worked well for us.
Static Analyzers
Fun With Static Analyzers!
Anyone who writes code, either professionally or as a hobby, has encountered the pain of debugging an issue that later proves to be caused by a well-known, common programming mistake. Some of us thrive on the thrill of hunting down and squashing these bugs but most of us would prefer to prevent these problems from occurring in the first place.
What if there were tools that could help us identify and fix these common bugs before they became a thorn in our side? What if there were tools to make the code more readable for other humans out there? Static-analysis tools are here to the rescue and one of them has caught our attention lately. Clang-tidy is part of the clang-based static-analysis tool suite, along with the more powerful Clang Static Analyzer and Clang Format tools. Although clang-tidy is presented as a C++ linter tool, it is definitely more than that, providing a framework for running robust analysis on C or C++ code. The errors reported by the tool can help you solve various bugs or fix coding-style issues.
“How can I use the clang-tidy on my code?” “Where can I get the tool?” “Where can I go to get more information?” Keep reading and your questions will be answered.
Using clang-tidy
Clang-tidy is currently available as a command-line tool. To run basic checks on source code files, you can:
- Instruct clang-tidy what file to analyze.
- Select which checks to run with the –checks option.
- Specify, at the end of the command line, the compilation options that are used to build the code (for example, include directories or reprocessor macro definitions).
A simple example of running checks in the clang-analyzer category:
To list all available checks, use the –list-checks option.
When running checks, clang-tidy generates warnings for your code. These warnings identify the places in your code where the check rule matched.
An output example reporting a place where the C++ auto specifier should be used:
As we mentioned earlier, you have the option to automate the process of fixing the potential problems that are detected by adding the –fix option to the command line.
The power of clang-tidy stands in its ability to be easily extended and adapted to detect new issues that may interest you. For that, custom checks can be added to clang-tidy by following their tutorial. The framework facilitates adding new checks through helper Python scripts that create the skeleton source files with classes where the checks will be implemented. The interface that Clang presents in these extension modules gives you access to the Abstract Syntax Tree (AST) level and thus offers the opportunity to implement powerful checks on your code.
Where to Get and Build It
Clang-tidy is part of the clang release and pre-built binaries are available.
Source code can be found in the extra Clang tools (clang-tools-extra) LLVM repository, git mirror. After cloning the tree, the tool can be built as a standalone target following their instructions.
Give it a Try
To conclude, clang-tidy brings a series of benefits to the development process such as: identifying and fixing suspicious coding constructs or even bugs, improving quality through code style checks, and the opportunity to expand the checking features to custom requirements. Give it a try on your MPLAB® XC application code and tell us what you think in the Microchip forums! Also, which other static analyzers have you tried?
Anaconda® Python Distribution
Anaconda® is a free and open-source distribution of Python. It also includes a package manager and Jupyter Notebook. Jupyter Notebook is an application that enables you to interact with a running Python program (provide input and observe output).
All Microchip Secure Products Group products are interfaced through the CryptoAuthLib (CAL) library. Python CrytoAuthLib (pyCAL) is the same library wrapped up for Python. As a result, all current and future Microchip Secure Products Group products are supported through either embedded C code (CAL) or high-level Python code (pyCAL). All interactive tools are built on top of pyCAL.
Installing Anaconda
On the Anaconda download page, click on your operating system's icon. All the steps followed here are for Windows but should be similar for other operating systems.
Anaconda has both 32-bit and 64-bit installers for different platforms. Download the latest Python 3.x version for your platform.
Once the installer is downloaded, double-click it to start the setup window as shown in the accompanying figure and click Next.
It will take you to the user agreement page, click I Agree to proceed.
Select the Installation type and then click Next.
Click the Next button for the default installation directory, otherwise choose the installation directory by clicking the Browse button and then click Next.
Make sure to have the check box for the Register Anaconda as my default Python 3.x selected and click Install.
The windows in the following images show the status of the installation. Click Next once the installation is complete.
Uncheck both checkboxes and click Finish to complete the installation.
Installing the AWS Command Line Interface (CLI) from Anaconda
The Amazon Web Services (AWS) CLI is a unified tool to manage your AWS services. You can control multiple AWS services from the command line and automate them through scripts. Refer to the "Install or update the latest version of the AWS CLI" page for more details.
The AWS CLI is installed using pip in the Anaconda environment.
Open Anaconda Command Prompt.
Run pip3 install awscli.