# Saleae Analyzer SDK Sample Analyzer The Saleae Analyzer SDK is used to create custom plugins for the Saleae Logic software. These plugins are used to decode protocol data from captured waveforms. To build your own protocol decoder plugin, first fork, clone, or download this repository. Then, make sure you have the required software installed for development. See the [Prerequisites](#-Prerequisites) section below for details. ## Renaming your Analyzer Once downloaded, first run the script rename_analyzer.py. This script is used to rename the sample analyzer automatically. Specifically, it changes the class names in the source code, it changes the text name that will be displayed once the custom analyzer has been loaded into the Saleae Logic software, and it updates the visual studio project. There are two names you need to provide to rename_analyzer. The first is the class name. For instance, if you are developing a SPI analyzer, the class names would be SPIAnalyzer, SPIAnalyzerResults, SPIAnalyzerSettings, etc. The file names would be similar, like SPIAnalyzer.cpp, etc. All analyzer classes should end with "Analyzer," so the rename script will add that for you. In the first prompt after starting the script, enter "SPI". The analyzer suffix will be added for you. This needs to be a valid C++ class name - no spaces, it can't start with a number, etc. Second, the script will prompt you for the display name. This will appear in the software in the list of analyzers after the plugin has loaded. This string can have spaces, since it will always be treated as a string, and not as the name of a class. After that, the script will complete the renaming process and exit. python rename_analyzer.py SPI Mark's SPI Analyzer Once renamed, you're ready to build your analyzer! See the [Building your Analyzer](##-Building-your-Analyzer) section below. ## Prerequisites ### Windows Dependencies: - Visual Studio 2017 (or newer) with C++ - CMake 3.13+ **Visual Studio 2017** *Note - newer versions of Visual Studio should be fine.* Setup options: - Programming Languages > Visual C++ > select all sub-components. Note - if CMake has any problems with the MSVC compiler, it's likely a component is missing. **CMake** Download and install the latest CMake release here. https://cmake.org/download/ ### MacOS Dependencies: - XCode with command line tools - CMake 3.13+ Installing command line tools after XCode is installed: ``` xcode-select --install ``` Then open XCode, open Preferences from the main menu, go to locations, and select the only option under 'Command line tools'. Installing CMake on MacOS: 1. Download the binary distribution for MacOS, `cmake-*-Darwin-x86_64.dmg` 2. Install the usual way by dragging into applications. 3. Open a terminal and run the following: ``` /Applications/CMake.app/Contents/bin/cmake-gui --install ``` *Note: Errors may occur if older versions of CMake are installed.* ### Linux Dependencies: - CMake 3.13+ - gcc 5+ Misc dependencies: ``` sudo apt-get install build-essential ``` ## Building your Analyzer ### Windows ```bat mkdir build cd build cmake .. -A x64 cmake --build . :: built analyzer will be located at SampleAnalyzer\build\Analyzers\Debug\SimpleSerialAnalyzer.dll ``` ### MacOS ```bash mkdir build cd build cmake .. cmake --build . ``` ### Linux ```bash mkdir build cd build cmake .. cmake --build . ```