Sign in

OSX Analyzer SDK Xcode setup

Follow

This guide was written using the 1.1.32 Analyzer SDK, Xcode version 7.2.1, and OSX 10.10.5. however it is likely to work with other versions as well.

  • Start Xcode
  • Click "Create a new Xcode project"

1

  • select "Other" from the left column, and "Empty" from the templates list.
  • Click next.

2

  • Enter a name for your Xcode Project.

2.5

  • The location should be set to the analyzer SDK folder recently downloaded, "SaleaeAnalyzerSdk-1.1.32". Do not create a new folder, this will be done for you by Xcode.
  • Click "Create"

2.75

  • Back in Finder, copy the file "rename_analyzer.py" and "source" from the downloaded SDK directory into the freshly created folder, which will have the same name as your new analyzer. Shown here the name is "XcodeAnalyzer"

3

  • Open a terminal, and browse to the new project folder in the downloaded SDK folder.
  • Run the python script with:

    python rename_analyzer.py

  • first, it will prompt you for the class prefix for all of the source files. All classes and files will be re-named with this prefix. If you type "I2C" the classes and files will be named with "I2CAnalyzer". Please avoid using analyzer in this name, as it will get repeated like this: "I2CAnalyzerAnalyzer"

  • Second, it will ask you for the name to display to the user in the "Add Analyzers" menu. This should be the user facing name, and can include spaces.

4

  • Next, we need to add a target to the Xcode project. Be sure that the project is selected in the Project Navigator on the left, and then click the menu highlighted below to add a target.

5

  • This is the target menu.

6

  • Select "Framework & Library" under "OS X" in the left column, and select "Library" in the main area.
  • Click Next.

7

  • Enter a product name, we recommend the the same name as the project, since there will only be one product.
  • Under framework, select "None (Plain C/C++ Library)
  • For Type, select "Dynamic"

8

  • Next, we need to add the source files. Click File -> Add Files to ""...
  • Note: if this is disabled, it is because you do not have the project selected in the Project Navigator.

8.5

  • Browse to the source folder in the Xcode project folder, and select it. Don't select the contents, be sure to select the folder itself.
  • select "Create groups" in the "added folders" section.
  • Click Add.

9

  • Verify that the files were automatically added to the build phases "Compile Sources" and "Headers".
  • Select the project from the Project Navigator if not already selected.
  • Click "Build Phases".
  • Expand "Compile Sources" and "Headers"
  • Under "Headers", also expand "Project".
  • Verify that each has 4 files.

9.5

  • Click "Build Settings"
  • If "Levels" is selected, switch it to "Combined"

10

  • Expand the section "Search Paths"
  • Locate "Header Search Paths" and edit the value.
  • Click the "+" button and enter "../include" in the new entry.

11

  • Locate "Library Search Paths" in the same section, and edit its value.
  • Click the "+" button and enter "../lib" in the new entry.

11.5

  • Return to "Build Phases" and expand the section "Link Binary with Libraries"
  • Click the "+" button

12

  • Click "Add Other..."

13

  • Browse to the original SDK folder which contains our Xcode folder.
  • Open the "lib" folder
  • Select "libAnalyzer.dylib"
  • Click Open.

14

  • At this point, you should build the project, so that the resulting library will be created.
  • It's worth mentioning that new Xcode versions do not save build outputs in the project directory. Instead, the default output directory looks like this:

    ~/Library/Developer/Xcode/DerivedData

  • You may want to change it. The following steps are optional

Optional: change build output folder

  • Optional step 1: From the file menu, select "Project Settings..."

optional 1

  • Optional step 2: in the "Derived Data" dropdown, select "Project-relative Location"
  • Click "Done"

optional 2

  • That's it for the optional steps.
  • Next we will setup debugging for the project. Be sure to have the latest Saleae Logic Software installed.
  • On the Product menu at the top of the screen, select "Scheme" -> "Edit Scheme..." 15

  • Make sure "Run" is selected on the left.

  • Under "Executable" select "Other..." 16

  • Browse to the "Applications" folder (or wherever Logic is installed) and select "Logic.app"

  • Click Choose.

17

  • Set a breakpoint in the software so that we can test debugging.
  • Open "XcodeAnalyzer.cpp" on the left. The name will reflect what you selected as the class prefix in a previous step. In this example, the class prefix was "Xcode".
  • In the source file, add a break point to the first line of code in the WorkerThread method. This code runs when the analyzer starts processing data.

18

  • Before proceeding, see this article with instructions to configure the software to load your new analyzer: How to set the developer directory in the Saleae software to use third party or user created analyzers.
  • Be sure to select the folder where the debug version of the custom analyzer is is saved.

  • Once the Saleae logic software has been configured, and has been closed, click run from Xcode.

  • The Saleae software should launch a few seconds later. Click the "+" button on the analyzers panel, and then select your analyzer. In this case, the user facing name of the analyzer was set by the Python script to "Xcode Analyzer". Yours may be different.
  • If your analyzer is missing, it could indicate that the dylib was not created, or that the developer path was not set properly. Please review the previous steps for any possible errors.
  • The settings dialog for your custom analyzer will appear. Click "Save".

19

  • Here is your fresh new analyzer, now added to the software. Note that our breakpoint hasn't fired yet. If you had captured data previously, it might fire now, since analyzers will automatically start processing if they are added to an existing analyzer.

20

  • Press start to start a simulation.
  • Since your analyzer has already been added, the simulator will call your simulation data generator code. The analyzer also starts processing the moment data has been captured, so your breakpoint should fire immediately.

21

  • Here you can see that the debugger was attached and your break point has been hit. You can examine variables, set new break points, or press continue from the debug menu at the bottom.

22

  • Congratulations! You now have an Xcode project for which you can use to develop a custom analyzer for the Saleae software.

If you have any questions, please contact support.


trello ID: 56b91491ba4869819221c3a5
Have more questions? Submit a request

Comments

Powered by Zendesk