Skip to content

Commit

Permalink
Merge branch 'Marcus10110-cmake-and-ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo committed Apr 26, 2022
2 parents d4d5f5b + 4cb12fb commit 5fa136f
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 680 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build

on:
push:
branches: [master]
tags:
- '*'
pull_request:
branches: [master]

jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: |
cmake -B ${{github.workspace}}/build -A x64
cmake --build ${{github.workspace}}/build --config Release
- name: Upload windows build
uses: actions/upload-artifact@v2
with:
name: windows
path: ${{github.workspace}}/build/Analyzers/Release/*.dll
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build
- name: Upload MacOS build
uses: actions/upload-artifact@v2
with:
name: macos
path: ${{github.workspace}}/build/Analyzers/*.so
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build
- name: Upload Linux build
uses: actions/upload-artifact@v2
with:
name: linux
path: ${{github.workspace}}/build/Analyzers/*.so
publish:
needs: [windows, macos, linux]
runs-on: ubuntu-latest
steps:
- name: download individual builds
uses: actions/download-artifact@v2
with:
path: ${{github.workspace}}/artifacts
- name: zip
run: |
cd ${{github.workspace}}/artifacts
zip -r ${{github.workspace}}/analyzer.zip .
- uses: actions/upload-artifact@v2
with:
name: all-platforms
path: ${{github.workspace}}/artifacts/**
- name: create release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{github.workspace}}/analyzer.zip
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.*
!.gitignore
debug/
release/
build/
.DS_Store
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required (VERSION 3.13)

project(SDMMCAnalyzer)

add_definitions( -DLOGIC2 )

# enable generation of compile_commands.json, helpful for IDEs to locate include files.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# custom CMake Modules are located in the cmake directory.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

include(ExternalAnalyzerSDK)

set(SOURCES
src/SDMMCAnalyzer.cpp
src/SDMMCAnalyzerResults.cpp
src/SDMMCAnalyzerSettings.cpp
src/SDMMCHelpers.cpp
src/SDMMCSimulationDataGenerator.cpp
src/SDMMCAnalyzer.h
src/SDMMCAnalyzerResults.h
src/SDMMCAnalyzerSettings.h
src/SDMMCHelpers.h
src/SDMMCSimulationDataGenerator.h
)

add_analyzer_plugin(${PROJECT_NAME} SOURCES ${SOURCES})
113 changes: 82 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,102 @@
SD/MMC Analyzer for Saleae Logic
================================
# SD/MMC Analyzer for Saleae Logic

** this is a fork of the original project by dirker **

This implements an SD/MMC protocol analyzer for the Logic
(http://www.saleae.com) software for Saleae logic analyzers.

Compiling
---------
Documentation for the Saleae Logic Analyzer SDK can be found here:
https://github.com/saleae/SampleAnalyzer

In order to compile the code the Saleae Analyzer SDK is needed which can be
download via the Saleae Community pages (http://www.saleae.com/community/). The
code is tested against version 1.1.32 of the SDK.
That documentation includes:

Prior to compiling the SDK zip file should be unpacked into the directory
containing the cloned sdmmc-analyzer repository, e.g.:
- Detailed build instructions
- Debugging instructions
- Documentation for CI builds
- Details on creating your own custom analyzer plugin

+-rootdir/
+-SaleaeAnalyzerSdk-1.1.32/
+-sdmmc-analyzer/
# Installation Instructions

### Mac OS X
To use this analyzer, simply download the latest release zip file from this github repository, unzip it, then install using the instructions found here:

Use the Xode project in xcode4/.
https://support.saleae.com/faq/technical-faq/setting-up-developer-directory

### Linux
# Publishing Releases

This repository is setup with Github Actions to automatically build PRs and commits to the master branch.

However, these artifacts automatically expire after a time limit.

To create and publish cross-platform releases, simply push a commit tag. This will automatically trigger the creation of a release, which will include the Windows, Linux, and MacOS builds of the analyzer.

# A note on downloading the MacOS Analyzer builds

This section only applies to downloaded pre-built protocol analyzer binaries on MacOS. If you build the protocol analyzer locally, or acquire it in a different way, this section does not apply.

Any time you download a binary from the internet on a Mac, wether it be an application or a shared library, MacOS will flag that binary for "quarantine". MacOS then requires any quarantined binary to be signed and notarized through the MacOS developer program before it will allow that binary to be executed.

Because of this, when you download a pre-compiled protocol analyzer plugin from the internet and try to load it in the Saleae software, you will most likely see an error message like this:

> "libSimpleSerialAnalyzer.so" cannot be opened because th developer cannot be verified.
Signing and notarizing of open source software can be rare, because it requires an active paid subscription to the MacOS developer program, and the signing and notarization process frequently changes and becomes more restrictive, requiring frequent updates to the build process.

The quickest solution to this is to simply remove the quarantine flag added by MacOS using a simple command line tool.

run ./build_analyzer.py
Note - the purpose of code signing and notarization is to help end users be sure that the binary they downloaded did indeed come from the original publisher and hasn't been modified. Saleae does not create, control, or review 3rd party analyzer plugins available on the internet, and thus you must trust the original author and the website where you are downloading the plugin. (This applies to all software you've ever downloaded, essentially.)

To remove the quarantine flag on MacOS, you can simply open the terminal and navigate to the directory containing the downloaded shared library.

This will show what flags are present on the binary:

```sh
xattr libSimpleSerialAnalyzer.so
# example output:
# com.apple.macl
# com.apple.quarantine
```

This command will remove the quarantine flag:

```sh
xattr -r -d com.apple.quarantine libSimpleSerialAnalyzer.so
```

To verify the flag was removed, run the first command again and verify the quarantine flag is no longer present.

## Building your Analyzer

CMake and a C++ compiler are required. Instructions for installing dependencies can be found here:
https://github.com/saleae/SampleAnalyzer

The fastest way to use this analyzer is to download a release from github. Local building should only be needed for making your own changes to the analyzer source.

### Windows

Not yet supported
```bat
mkdir build
cd build
cmake .. -A x64
cmake --build .
:: built analyzer will be located at SampleAnalyzer\build\Analyzers\Debug\SimpleSerialAnalyzer.dll
```

Debugging
---------
### MacOS

### Mac OS X
```bash
mkdir build
cd build
cmake ..
cmake --build .
# built analyzer will be located at SampleAnalyzer/build/Analyzers/libSimpleSerialAnalyzer.so
```

* Configure Xcode to place build products in locations specified by targets
* Xcode -> Preferences -> Locations Tab -> Build Location
* Edit SDMMCAnalyzer Scheme to launch Logic upon debugging
* Product -> Edit Scheme -> Debug -> Info -> Executable
* Browse for Logic.app (e.g. /Applications/Logic.app)
* Configure Logic to look for the Analyzer Plugin
* Launch Logic manually
* Options -> Preferences
* Under [For Developers], "Search this path for Analyzer Plugins"
* Browse for the ../sdmmc-analyzer/xcode4/build/Debug directory
* Click "Save" and close Logic
### Linux

```bash
mkdir build
cd build
cmake ..
cmake --build .
# built analyzer will be located at SampleAnalyzer/build/Analyzers/libSimpleSerialAnalyzer.so
```
126 changes: 0 additions & 126 deletions build_analyzer.py

This file was deleted.

Loading

0 comments on commit 5fa136f

Please sign in to comment.