-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatic template update of MCS-04 Analyzer
- Loading branch information
1 parent
7ba5f20
commit aaf3277
Showing
7 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Logic style | ||
Language: Cpp | ||
# manually added flags | ||
FixNamespaceComments: 'false' | ||
SortIncludes: 'false' | ||
|
||
|
||
# flags copied from web editor, https://zed0.co.uk/clang-format-configurator/ | ||
AllowShortBlocksOnASingleLine: 'false' | ||
AllowShortCaseLabelsOnASingleLine: 'false' | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: 'false' | ||
AllowShortLoopsOnASingleLine: 'false' | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: 'true' | ||
BreakBeforeBraces: Allman | ||
ColumnLimit: '140' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' | ||
ContinuationIndentWidth: '4' | ||
Cpp11BracedListStyle: 'false' | ||
IndentWidth: '4' | ||
KeepEmptyLinesAtTheStartOfBlocks: 'false' | ||
MaxEmptyLinesToKeep: '2' | ||
NamespaceIndentation: All | ||
PointerAlignment: Left | ||
SpaceBeforeParens: Never | ||
SpaceInEmptyParentheses: 'false' | ||
SpacesInCStyleCastParentheses: 'true' | ||
SpacesInParentheses: 'true' | ||
SpacesInSquareBrackets: 'true' | ||
TabWidth: '4' | ||
UseTab: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- 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@v3 | ||
with: | ||
name: windows | ||
path: ${{github.workspace}}/build/Analyzers/Release/*.dll | ||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: | | ||
cmake -B ${{github.workspace}}/build/x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 | ||
cmake --build ${{github.workspace}}/build/x86_64 | ||
cmake -B ${{github.workspace}}/build/arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 | ||
cmake --build ${{github.workspace}}/build/arm64 | ||
- name: Upload MacOS x86_64 build | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: macos_x86_64 | ||
path: ${{github.workspace}}/build/x86_64/Analyzers/*.so | ||
- name: Upload MacOS arm64 build | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: macos_arm64 | ||
path: ${{github.workspace}}/build/arm64/Analyzers/*.so | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: | | ||
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release | ||
cmake --build ${{github.workspace}}/build | ||
env: | ||
CC: gcc-10 | ||
CXX: g++-10 | ||
- name: Upload Linux build | ||
uses: actions/upload-artifact@v3 | ||
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@v3 | ||
with: | ||
path: ${{github.workspace}}/artifacts | ||
- name: zip | ||
run: | | ||
cd ${{github.workspace}}/artifacts | ||
zip -r ${{github.workspace}}/analyzer.zip . | ||
- uses: actions/upload-artifact@v3 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cmake_minimum_required (VERSION 3.11) | ||
project(mcs04_analyzer) | ||
|
||
add_definitions( -DLOGIC2 ) | ||
|
||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum supported MacOS version" FORCE) | ||
|
||
# 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/MCS04Analyzer.cpp | ||
src/MCS04Analyzer.h | ||
src/MCS04AnalyzerResults.cpp | ||
src/MCS04AnalyzerResults.h | ||
src/MCS04AnalyzerSettings.cpp | ||
src/MCS04AnalyzerSettings.h | ||
src/MCS04Disasm.cpp | ||
src/MCS04Disasm.h | ||
src/MCS04SimulationDataGenerator.cpp | ||
src/MCS04SimulationDataGenerator.h | ||
) | ||
|
||
add_analyzer_plugin(mcs04_analyzer SOURCES ${SOURCES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Saleae | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Saleae MCS-04 Analyzer | ||
|
||
Saleae MCS-04 Analyzer | ||
|
||
## Getting Started | ||
|
||
The following documentation describes how to build this analyzer locally. For more detailed information about the Analyzer SDK, debugging, CI builds, and more, check out the readme in the Sample Analyzer repository. | ||
|
||
https://github.com/saleae/SampleAnalyzer | ||
|
||
### MacOS | ||
|
||
Dependencies: | ||
|
||
- XCode with command line tools | ||
- CMake 3.13+ | ||
- git | ||
|
||
Install 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'. | ||
|
||
Install 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._ | ||
|
||
Build the analyzer: | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . | ||
``` | ||
|
||
### Ubuntu 18.04+ | ||
|
||
Dependencies: | ||
|
||
- CMake 3.13+ | ||
- gcc 4.8+ | ||
- git | ||
|
||
Misc dependencies: | ||
|
||
``` | ||
sudo apt-get install build-essential | ||
``` | ||
|
||
Build the analyzer: | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . | ||
``` | ||
|
||
### Windows | ||
|
||
Dependencies: | ||
|
||
- Visual Studio 2019 | ||
- CMake 3.13+ | ||
- git | ||
|
||
**Visual Studio 2019** | ||
|
||
_Note - newer and older versions of Visual Studio are likely to work._ | ||
|
||
Setup options: | ||
|
||
- Workloads > Desktop & Mobile > "Desktop development with C++" | ||
|
||
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/ | ||
|
||
**git** | ||
|
||
Download and install git here. | ||
https://git-scm.com/ | ||
|
||
Build the analyzer: | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake .. -A x64 | ||
``` | ||
|
||
Then, open the newly created solution file located here: `build\mcs04_analyzer.sln` | ||
|
||
Optionally, build from the command line without opening Visual Studio: | ||
|
||
``` | ||
cmake --build . | ||
``` | ||
|
||
The built analyzer DLLs will be located here: | ||
|
||
`build\Analyzers\Debug` | ||
|
||
`build\Analyzers\Release` | ||
|
||
For debug and release builds, respectively. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
include(FetchContent) | ||
|
||
# Use the C++11 standard | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
set(CMAKE_CXX_STANDARD_REQUIRED YES) | ||
|
||
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY OR NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/) | ||
endif() | ||
|
||
# Fetch the Analyzer SDK if the target does not already exist. | ||
if(NOT TARGET Saleae::AnalyzerSDK) | ||
FetchContent_Declare( | ||
analyzersdk | ||
GIT_REPOSITORY https://github.com/saleae/AnalyzerSDK.git | ||
GIT_TAG master | ||
GIT_SHALLOW True | ||
GIT_PROGRESS True | ||
) | ||
|
||
FetchContent_GetProperties(analyzersdk) | ||
|
||
if(NOT analyzersdk_POPULATED) | ||
FetchContent_Populate(analyzersdk) | ||
include(${analyzersdk_SOURCE_DIR}/AnalyzerSDKConfig.cmake) | ||
|
||
if(APPLE OR WIN32) | ||
get_target_property(analyzersdk_lib_location Saleae::AnalyzerSDK IMPORTED_LOCATION) | ||
if(CMAKE_LIBRARY_OUTPUT_DIRECTORY) | ||
file(COPY ${analyzersdk_lib_location} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) | ||
else() | ||
message(WARNING "Please define CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_LIBRARY_OUTPUT_DIRECTORY if you want unit tests to locate ${analyzersdk_lib_location}") | ||
endif() | ||
endif() | ||
|
||
endif() | ||
endif() | ||
|
||
function(add_analyzer_plugin TARGET) | ||
set(options ) | ||
set(single_value_args ) | ||
set(multi_value_args SOURCES) | ||
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN} ) | ||
|
||
|
||
add_library(${TARGET} MODULE ${_p_SOURCES}) | ||
target_link_libraries(${TARGET} PRIVATE Saleae::AnalyzerSDK) | ||
|
||
set(ANALYZER_DESTINATION "Analyzers") | ||
install(TARGETS ${TARGET} RUNTIME DESTINATION ${ANALYZER_DESTINATION} | ||
LIBRARY DESTINATION ${ANALYZER_DESTINATION}) | ||
|
||
set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION} | ||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${ANALYZER_DESTINATION}) | ||
endfunction() |