LabVIEW Microprocessor SDK Porting Guide Manual

LabVIEW Microprocessor SDK Porting Guide Manual
Pages 150
Views 1,376
Downloads : 4 times
PDF Size : 1.3 MiB

Summary of Contents

LabVIEW Microprocessor SDK Porting Guide Manual

  • Page 1

    LabVIEW™ Microprocessor SDK Porting GuideContents 3,Chapter 3,1 3,Porting 3,LabVIEW 3,to 3,a 3,New 3,Embedded 3,Target.......................................................................3 4,Essential 4,Pieces 4,to 4,Porting 4,LabVIEW..................................................

  • Page 2

    40,Adding 40,Target 40,Syntax 40,to 40,an 40,Embedded 40,Target..............................................................................40 42,Modifying 42,the 42,Target 42,Syntax 42,for 42,an 42,Embedded 42,Target....................................................................

  • Page 3

    86,Debug 86,Database.............................................................................................................................86 86,C 86,Parser.......................................................................................................................................

  • Page 4

    2.Compiling, downloading, running, and debugging a "hello world" application using the toolchainand BSP. This step verifies that the necessary toolchain is installed on the host computer and theboard support package is installed and configured correctly.3.Porting the LabVIEW Run-Time Li...

  • Page 5

    Selecting an Appropriate Example TargetSelecting an appropriate example target is a good place to start when you port LabVIEW to a newembedded target. Use the target that is closest to your target and toolchain. For example, if you are usinga GNU C/C++-based (gcc) toolchain, consider using an eCo...

  • Page 6

    UIIDEIntegrationElementalI/OMemoryMappingStaticMemoryModelPre-BuiltRun-TimeLibraryOn ChipDebuggingInstrumentedDebuggingTarget NameNoNoSimulatedNoYesYesNoTCPWindows ConsoleApplicationSystem Requirements for Example TargetsThe Microprocessor SDK example targets have the following requirements:Softw...

  • Page 7

    LabVIEW Directory HierarchyYou do not need to be familiar with the entire labviewdirectory structure, but the following directoriesare important to porting LabVIEW:•autotest—Contains the LabVIEW C Generator Autotest Framework and test VIs. The VIs arein the tests\Large semi-auto testssubdirec...

  • Page 8

    Example TargetsNational Instruments recommends, but does not require, you follow the same naming convention as theMicroprocessor SDK example targets. The example targets have the following naming convention:Hardware target, OS Hardware VariantFor example, PHYTEC L9C229x, eCos. Do not use undersco...

  • Page 9

    Axiom CMD565, VxWorks Module Example TargetThis example target configuration expects the VxWorks ROM resident image with a WDB serialconnection in the external flash array. You download the object module you build into the external RAMof the board using the WTX protocol. The VxWorks ROM resident ...

  • Page 10

    4.Power on the Axiom board. The Axiom Monitor appears.5.Press the <3> key to download to the external flash memory.6.Press the <2> key to select external flash on CS2.7.Press the <5> key to erase the external flash array.8.Press the <6> key to program the external flash ar...

  • Page 11

    12. Run an example application to verify the setup.Refer to 13,the 13,Running 13,a 13,VxWorks 13,Example 13,Application 13,section for more information about how to runan example application.Axiom CMD565, VxWorks ROM Example TargetThis target configuration allows you to download an applica...

  • Page 12

    2.Connect COM 1 to the available COM port on the host machine using a straight cable. A NULLmodem cable does not work.3.Launch AxIDE or another communication program, Tera Term for example, and open a connectionto the serial port. The communication settings are 9600, 8, N, 1, N.4.Power on the Axi...

  • Page 13

    Running a VxWorks Example ApplicationYou must have two serial ports to run the example application. COM 1 displays diagnostic information.COM 2 uses the target server to download an application you build. Verify you receive the VxWorkslogo on one serial port. Verify you receive WDB READY on the o...

  • Page 14

    10. Click the Program button.11. Unzip m5329evb.zip, located in the labview\Targets\NI\Embedded\unix\m5329evb\bin\directory, to a temporary location.12. Navigate to and select m5329evb.bin.13. When you are prompted for the start address, enter 0and click the OK button.14. Click the Program button...

  • Page 15

    •GPIO (General Purpose Input/Output) Expansion Board (Part Number PCM-989)Refer to the PHYTEC Web site at actionURI(http://www.phytec.com):www.phytec.comfor more information about PHYTEC hardware.PHYTEC ConnectionsYou must establish the following connections on the expansion board between the I...

  • Page 16

    Installing the RedBoot BootloaderYou must install the RedBoot bootloader on the phyCORE-ARM7/LPC229x processor before you canuse it. Complete the following steps to install the RedBoot bootloader.1.Install and start the LPC2000 Flash Utility, which is located on the PHYTEC CD.2.Connect the board ...

  • Page 17

    Unix Console and Unix UI Example TargetsYou must install Cygwin 1.5.23-2 or later to use the Unix Console or Unix UI example target. Installthe following Cygwin GNU tools:•binutils 20060817-1 or later•gcc-g++ 3.4.4 or later•gdb 20060706-2 or later•make 3.81 or laterTo use the Unix UI exam...

  • Page 18

    13. Type lvprep.shand press the <Enter> key. lvprep.shunpacks lvprep.tgzand makes thenecessary symbolic links and file changes.14. Type rebootand press the <Enter> key to reboot the board. The ucn-2410 login:promptappears when the board completes rebooting.15. Unplug and replug the US...

  • Page 19

    •Calls LEP_x_ScriptLinker.vito link the project libraries and the object files into an embeddedapplication.LEP_x_Run.viis the main plug-in VI that implements the run user action. It runs the application onthe target.LEP_x_Download.viis the main plug-in VI that implements the download user actio...

  • Page 20

    The VxWorks and eCos example targets do not have pre-compiled run-time libraries, so you mustcompile the run-time source files along with the generated and external C files.LEP_x_ScriptLinker.viLEP_x_ScriptLinker.vi, where xis a subtarget and/or an OS, links all intermediate object files,external...

  • Page 21

    lvEmbeddedMain.clvEmbeddedMain.ccontains the main entry point for all applications the LabVIEW C Code Generatorgenerates. This file contains functions that perform set up and tear down of common pieces, such asoccurrences and FIFOs. lvEmbeddedMain.cuses #ifdefsrather than separate files for each ...

  • Page 22

    Your target directory must include the LabVIEW C Code Run-Time and Analysis Libraries. Most ofthe example targets use a makefile to build the libraries. The Windows Console example target uses aVisual Studio project. Some example targets have pre-built libraries while some targets build the libra...

  • Page 23

    The C++ code in the LabVIEW Analysis Library does not use constructors and destructors. Ignore thepeak detector and pulse duration functions because these functions assume LabVIEW internals that onlyapply to LabVIEW on Windows. The peak detector and pulse duration functions will crash and do notw...

  • Page 24

    This VI Server call also generates the following header files when a user builds an embedded VI intoan embedded application.•LVForms.hcontains declarations for the entry point functions for each VI.•LVGlobs.hcontains declarations for global initialization functions and data type information u...

  • Page 25

    Refer to the Expression Folding Patterns book on the Contents tab in the LabVIEW Help for a list ofthe patterns the LabVIEW C Code Generator recognizes.GenerateCFunctionCallsType: BooleanDefault: FALSEDetermines the calling interface to subVIs if you set GenerateSerialOnlyto TRUE. The LabVIEWC Co...

  • Page 26

    Code Run-Time Library to support LabVIEW data types. However, if you use only integer, floating-point,or Boolean data, you can use the C library function printfinstead. Set this attribute to TRUE to useprintfwhen possible. The LabVIEW C Code Generator uses the LabVIEW C Code Run-Time libraryimple...

  • Page 27

    executing only after the other While Loop completely finishes. This execution behavior most closelyresembles subroutine priority VIs in LabVIEW Windows VIs. If you set the priority of an individual VIto subroutine on the Execution page on the VI Properties dialog box, the LabVIEW C Code Generator...

  • Page 28

    •Static—No memory allocation occurs while the application is running. All variables are declaredas static in the generated C code and allocated prior to the main entry point. Static memory canprovide good performance and low jitter, but static memory models might require more memorythan other...

  • Page 29

    Generating the Fastest CodeCode generation options define how the LabVIEW C Code Generator generates C code. Many attributesdetermine how LabVIEW generates the C code. Most of the attributes are optimizations that make thegenerated C code smaller and run faster. Use the following code generation ...

  • Page 30

    Generated C CommentGenerated C VariableNameBlock Diagram ExampleAttribute UsedLabVIEW Signal Source/* Init: SR */, /* Init: SR 1*/Init_SR, Init_SR_1Source name, “SR”Shift register (initialized)/* Foo Loop: SR */, /* FooLoop: SR 1 */, /* FooLoop: SR 2 */Foo_Loop_SR,Foo_Loop_SR_1,Foo_Loop_SR_2S...

  • Page 31

    Chapter 6 Defining Compiler DirectivesMacros in LVDefs_plat.hdefine how to compile generated and external C code.LEP_x_ScriptCompiler.viscripts the compiler and passes the directives to the compiler from thecommand line.This section lists some of the more common macros. Refer to the comments in L...

  • Page 32

    •TCPUDPSupport—Set to 1to enable TCP/UDP support.Memory Mapping MacrosThe following list describes the memory mapping macros.•_DATA_SECTION—Defines the input memory section for array structures.•_TEXT_SECTION—Defines the input memory section for generated code.General MacrosThe follow...

  • Page 33

    4.Launch LabVIEW.5.Select Tools»Microprocessor SDK»Target Editor from the Getting Started window, the ProjectExplorer window, or a blank VI to open the Target Editor.6.Select File»Open in the Target Editor and select the TgtSupp.xmlfile for the example target youare copying. TgtSupp.xmlfiles a...

  • Page 34

    15. Select File»Save As in the Target Editor and select your target folder to open the Save Target Asdialog box.16. (Optional) LabVIEW prepends prefixes to the plug-in directory and VIs. Edit the prefix for yourtarget in the Replace with text boxes.17. Click the OK button. LabVIEW creates your T...

  • Page 35

    Icons must be in .pngformat. Icons are located in thelabview\resource\Framework\Providers\Iconsdirectory.6.Navigate to and select or enter the relative path to the directory that contains the TargetInfo.inifile, which is the file that defines the target-specific palette and controls, in the Path ...

  • Page 36

    2.Enter the name of the category in the Item Name text box. The category name appears in theCategory list in the Target Properties dialog box for your target.3.Navigate to and select or enter the path to the subpanel VI in the Path to Subpanel VI text box. Ifyou do not have an existing subpanel V...

  • Page 37

    To remove a file from the list, select the file and click the red x button,shown at left, to remove theselected file from the list. The Target Editor calculates signatures for all files you list and stores thesignatures in TgtSupp.xml.Configuring Target LicensingComplete the following steps to us...

  • Page 38

    Defining Build Specification Shortcut Menu ItemsComplete the following steps to use the Shortcut Menu Items tab in the Build Specification TypeProperties dialog box to define the target-specific shortcut menu items for the build specification type.Users see the shortcut menu items when they right...

  • Page 39

    Users see the pages you add in the Category list when they right-click a build specification under yourtarget in the Project Explorer window and select Properties from the shortcut menu.1.Click the blue plus button,shown at left, to enable the Page Properties section. ??? appearsin the Category l...

  • Page 40

    2.Select which type of plug-in VI you want to create.a.Select VI with test dialog to create a new plug-in VI that includes the One Button Dialogfunction for testing purposes.b.Select Blank VI to create a new, blank plug-in VI.3.Navigate to or enter the relative path to the plug-in VI you are crea...

  • Page 41

    d.LVEUnsupportedTypes.videtermines which data types the target does not support.e.LVEUnsupportedVIs.videtermines which subVIs the target does not support.2.Edit the VIs described in step 1 by placing unsupported features on the block diagram of theappropriate VI. Save the VI.NoteFor targets with ...

  • Page 42

    Set the Max Type Depth to prevent nested types from being recursive, which is not permittedby MISRA (The Motor Industry Software Reliability Association) automotive coding standards.b.Enter the maximum number of dimensions for arrays in the Max Array Dimensions box. Avalue of -1ignores the maximu...

  • Page 43

    Refer to 81,Chapter 81,18 81,Implementing 81,Instrumented 81,Debugging 81,for 81,a 81,Custom 81,Communication 81,Layer formore information about implementing instrumented debugging for a custom communication layer.Serial CommunicationIf you are using serial communication, your LEP_x_Con...

  • Page 44

    The tests are located in the labview\autotest\tests\Large semi-auto testsdirectory.The LabVIEW C Generator Test Framework executes all the tests in a folder you specify in theLEP_AutoTest.inifile, which is located in the labview\autotestdirectory. When you run thetests, LabVIEW creates a folder w...

  • Page 45

    Porting PrerequisiteDescriptionDirectory—Synchronization VIs and functionsQueues&Notifiers—String data type and functionsstring*Scheduler supportTimed Loop structure and utility functionstimedLoop—Unary functionsunary—Variant data type and functionsvariant—Waveform data type and fun...

  • Page 46

    DescriptionTokenSpecifies the path to the test results for your target. You can userelative paths, which are relative to the labview\autotestdirectory. National Instruments recommends placing your tests in theautotestdirectory, if possible. The LabVIEW C Generator TestFramework creates a subfolde...

  • Page 47

    National Instruments recommends that you organize your tests in subfolders based on the functionalityof the tests. For example, consider putting all tests for strings in the same subfolder. UseLEP_AutoTest_GetNameIniFile.vi, located in the labview\autotestdirectory, to generate thename of your ta...

  • Page 48

    DescriptionTokenThe name of the top-level embedded VI to build into an embeddedapplication._Test_TopLevelVI_The name of the test sequence VI. The default value isLEP_AutoTest_TestSequence_1.vi._Test_SequenceVI_The baud rate of the capturing serial port. Only test sequences thatcapture output on t...

  • Page 49

    You might have to develop a screen driver to work with your target. Also, Nano-X assumesyou have a mouse, so if your target uses a touchscreen for input, you also have to develop atouchscreen driver that looks like a mouse to Nano-X. Refer to the Nano-X Web site atactionURI(http://www.microwindow...

  • Page 50

    running Windows. The Microprocessor SDK supports the following front panel controls and indicatorsdifferently than VIs that run on Windows:•Array controls and indicators•Boolean controls•Charts•Cluster controls and indicators•Combo boxes•Decorations•Enumerated type controls•Graphs...

  • Page 51

    •Boolean text•Six types of mechanical action for Boolean controls, including Switch when pressed, Switch whenreleased, Switch until released, Latch when pressed, Latch when released, and Latch untilreleased.ColorEmbedded VIs support color in the following Boolean controls support color differ...

  • Page 52

    Cluster Controls and IndicatorsIf a control overlaps the cluster shell in a VI you run on Windows, the part of the control outside of thecluster shell is clipped.If a control overlaps the cluster shell in a Microprocessor SDK VI, the entire control is still completelyvisible when you build the VI...

  • Page 53

    Selecting items in enumerated type controls is different in Microprocessor SDK applications:•Click the control to display the shortcut menu so all options are visible.•Tap the increment and decrement buttons to cycle through the options.FontsWhen you build a VI into an application, LabVIEW sc...

  • Page 54

    Autoscaling the Y-axis for multi-plot XY graphs is not supported. Only one plot shows at a time if youenable autoscaling. You must disable autoscaling if you want multiple plots on an XY graph.LabelsWord wrapping in free labels is unsupported. You must create new lines for text that spans multipl...

  • Page 55

    •Horizontal scroll barMenusEmpty menus do not generate events.Customizing shortcut menus for front panel controls is unsupported.Numeric Controls and IndicatorsNumeric controls and indicators support the following:•Captions and labels.•Floating-point, scientific, and engineering notations....

  • Page 56

    You must include two & symbols in a string to display a single & in a picture control if you are usingthe Draw Text at Point or Draw Text in Rect VI.RefnumsYou can add refnums to the front panel window, but refnums are not visible when you run the applicationon the target.Microprocessor S...

  • Page 57

    •Using a Property Node with the Limit to Single Line? property to change the multiline optionNoteThe Limit To Single Line? property removes the scroll bars but does not limit the textto a single line when you use this property.Tab ControlsTab controls support the following:•Decorations•Free...

  • Page 58

    Tree controls do not support the following:•Column headers•Row headers•Drag and dropVariant ControlsVariant controls are supported but are not visible in the application running on the target.Variant data does not conform to a specific data type and can contain attributes. LabVIEW represent...

  • Page 59

    •Color (radio buttons control only)•Colors [4]•Strings [4]•Text Colors:BG Color•Text Colors:Text ColorCluster ControlsYou can use the following properties with cluster controls:•Cluster Size•Cluster Size:Height•Cluster Size:Width•Controls[]Enumerated Type ControlsYou can use the...

  • Page 60

    You can use the following properties with numeric controls and indicators:•Housing Colors:BG Color (dials, meters, gauges, and slide controls only)•Housing Colors:FG Color (dials, meters, gauges, and slide controls only)•Data Entry Limits:Increment•Data Entry Limits:Minimum•Data Entry L...

  • Page 61

    •Format String•Response to Value Outside Limits:Increment•Response to Value Outside Limits:Maximum•Response to Value Outside Limits:MinimumTree ControlsYou can use the following properties with tree controls.•Active Item:Child-Only?•Active Item:Disabled?•Active Item:Indent Level•A...

  • Page 62

    You can use the following methods with graphs and charts:•Map Coordinates To XY•Map XY To CoordinatesString Controls and IndicatorsYou can use the following methods with string controls and indicators•Get Nth Line•Size to TextTree ControlsYou can use the following methods with tree contro...

  • Page 63

    •Digital waveform graphs•I/O controls•Intensity graphs and charts•Minmax plots•Mixed checkbox controls•Picture ring controls•Polar plots•Radar plots•Smith plots•Text and picture ring controls•Transparent controls•VISA resource name controls•XControlsChapter 12 Elemental ...

  • Page 64

    •Digital Bank In•Digital Bank Out•Pulse Width Modulation OutYou can implement some or all of the supported I/O classes for an I/O device.I/O PinsA Elemental I/O pin is the software equivalent of a physical pin that connects an I/O device to the outsideworld. Resources can share pins because...

  • Page 65

    Refer to the block diagram comments in the template VIs for more information about the Elemental I/Oplug-in VIs, such as required and optional parameters.The Project Attributes cluster control is what appears on the I/O Node Project Panel page of theElemental I/O Properties dialog box when a user...

  • Page 66

    I/O Project and Node Attribute Validation Plug-In VIUse an I/O Project and Node Attribute Validation plug-in VI to validate the attributes of the I/O item inthe Project Explorer window and the Elemental I/O Nodes on the block diagram. The I/O Project andNode Attribute Validation plug-in VI runs a...

  • Page 67

    16. Click the Generate button. The wizard creates a directory in the location you specify in the OutputDirectory and adds several VIs the Elemental I/O framework needs and an eio.xmlfile in thenew directory. The eio.xmlfile contains the info from the Elemental I/O Wizard. The eio.xmlfile must be ...

  • Page 68

    Examples of some of the #definesin LVDefs_plat.hinclude the following:•#define BigEndian—Defines the data storage format as big endian or little endian. Define as0 for little endian and 1 for big endian.•#define ALIGNMENT—Defines the alignment of data.•typedef signed char int8;—In the...

  • Page 69

    LVCriticalSectionDelete(LVCriticalSection critsect)Purpose: Frees a critical section record.LVCriticalSectionEnter(LVCriticalSection critsect)Purpose: Called to indicate when a section of code is entered that must not be interrupted.LVCriticalSectionLeave(LVCriticalSection critsect)Purpose: Calle...

  • Page 70

    Purpose: Sets the thread priority.LVThreadSetCurrentPriority(LVTHREAD_PRIORITY p)Purpose: Sets the priority of the thread from which this function is called.LVThreadGetPriority(LVTHREAD_HANDLE h)Purpose: Returns the priority of the thread referred to by the handle passed in.LVTHREAD_PRIORITY LVTh...

  • Page 71

    OEMISRUnregisterHandler(uInt32 isr_vector, uInt32 isr_param, ISRFuncisr_runFunc, uInt32 *register_param)Purpose: Removes the ISR VI from the lookup table.Printf: PDAStrSupport_os.cThis OS-specific C file implements printf, which uses the One Button Dialog function for non-UItargets. If you implem...

  • Page 72

    SerialBreak(SerialDevice ser)Purpose: Sends a break on a serial line.CAN: PlatformCAN_os.cUse this C file, which contains the following functions, for the Embedded CAN VIs and for debuggingover a controller area network (CAN) connection.MgErr LvCanOpen(uInt32 boardIdx, uInt32 controllerIdx, uInt3...

  • Page 73

    MgErr LvCanMessageAvail(uInt32 reference, uInt8 channel, uInt8 *bAvail);Purpose: Polls channels for new CAN messages to read.TCP/UDP: CCGNetConnSupport.cTCP communication is implemented on top of Berkeley sockets on all platforms and is used by TCPfunctions, UDP functions, remote Call By Referenc...

  • Page 74

    the state of build, download, or run processes, to send debug messages from your target, or to run acustom VI.NoteThe Windows Console and PHYTEC example targets implement the ApplicationStatus window. Use these targets as a starting point when you implement the ApplicationStatus window. Refer to ...

  • Page 75

    to your parallel VI to avoid linking problems if a user renames your target. The following figure illustrateshow to create the output cluster with all information needed by the parallel VI.The following figure shows how to launch a VI in parallel with the correct parameters.Use the Application St...

  • Page 76

    Synchronizing OperationsIn most target architectures, the build, download, run, and debug operation are built in a hierarchy. Forexample, the OnRun plug-in VI detects if the application must be rebuilt and calls build. The OnDebugplug-in VI can potentially call build and then run. The Windows Con...

  • Page 77

    InitOEMISRsBoolean InitOEMISRs();Purpose: This function is called only by InitISRs. InitOEMISRsmust do any required ISR subsysteminitialization.Returns TRUE on success. Returns FALSE on failure.UninitOEMISRsBoolean UninitOEMISRs();Purpose: This function is called only by UninitISRs. UninitOEMISRs...

  • Page 78

    The ISR VI parameters are meant to be general enough to handle most hardware and OS requirements.Depending on the platform, you might not need these parameters. If you do not need these parameters,you can optimize the ISR by passing zeros for the required parameters and have the ISR VI ignore the...

  • Page 79

    Purpose: Generates the internal timing source that iIntTSource specifies.iCount is the number of iterations.iIntTSource is a zero-based index parameter from <0, INT_TSOURCE_SIZE -1>. INT_TSOURCE_SIZEis a macro in LVDefs_plat.hthat defines the total number of internal timing sources.DeleteIn...

  • Page 80

    Memory Mapping Plug-In VIsTo implement memory mapping, you must implement the Memory Mapping plug-in VIs.Refer to the Axiom CMD565, VxWorks example target for an example implementation.LEP_x_SectionNames.viDefines the name of all memory sections users can map, such as RAM, ROM, and flash memory. ...

  • Page 81

    How Users Use Memory MappingUsers can change the implicit mapping, if necessary, by right-clicking the build specification in theProject Explorer window and selecting Map Memory from the shortcut menu to open the Map Memorydialog box. For example, if the user's application uses a large, read-only...

  • Page 82

    •error out—An error cluster indicator.Close VICloses the connection with the embedded target.Your Close VI must have the following parameters on the connector pane:•connection data—A variant control. You can modify this variant so you can communicate betweendebugging plug-in VIs you call ...

  • Page 83

    •ReleaseConnectionAlso, you must assign global function pointers to the functions you create so that the LabVIEW C CodeRun-Time Library can use the functions for debugging connections.TipUse new, unique names for your functions to avoid linker errors.The Microprocessor SDK provides examples of ...

  • Page 84

    Releases the resources the PrepareConnectionfunction allocates. If you are using TCP/IP, thisfunction also closes the listening port. Return eFailif there is an error. Otherwise, return eFinished.DebugWriteeRunStatus DebugWrite(const char* pData, uInt32 size)Writes the data to which pDatapoints. ...

  • Page 85

    The core of the OCDI debugging framework is the debug database. The debug database contains a mapof all possible signals, breakpoint, controls, and indicators in the physical memory of the embeddedtarget. The debug database also contains line numbers and information for each node on the blockdiag...

  • Page 86

    You can use a JTAG, BDM, or NEXUS connection to perform on chip debugging of an embeddedapplication.Debug DatabaseThe debug database is a collection of records for all controls, signals, and breakpoints in the embeddedapplication VI hierarchy. The debug database also contains C line number inform...

  • Page 87

    OCDI_BEGIN_NODE(profileInfo_simple_math, 1, 3) /* OCDI::Begin::Node(2, 3, 3)*//**//* Divide *//**/OCDI_CHECK_POINT(simple_math_OCDIFlag[0] & 0x2, &simple_math_OCDIFlag, 1)/*OCDI::BreakPoint::Node(2, 3, 3) */ hA8EA7A0->sA08/* n: Divide: x/y */ =(float64)hA8EA7A0->sB58/* n: Multiply: ...

  • Page 88

    Location.Node(1,2,3)@[123 ... 456 ]Location.SNode(1,2,3)@[123 ... 456 ]Location.SRN(1,2,3)@[123 ... 456 ]where Location.Noderepresents nodes, Location.SNoderepresents structures, and Location.SRNrepresents self-referencing nodes. [123...456] represents the line numbers in the generated C file.For...

  • Page 89

    are still only known relative to yet unresolved symbols. Absolute memory address information is notavailable at this phase.[simple_math.vi]Node(1, 2, 3)@64=simple_math_Run+0x58Node(2, 3, 3)@68=simple_math_Run+0x6CSID_2360=simple_math_heap+0x0SID_2212=simple_math_heap+0x8SID_3104=simple_math_heap+...

  • Page 90

    whereLrepresents the length of the entire data type in bytesjrepresents the offset from the beginning of the data structure in bitskrepresents the length of the data member in bitsRefer 109,to 109,Chapter 109,20 109,Understanding 109,the 109,LabVIEW 109,Embedded 109,LVM 109,File 109,for...

  • Page 91

    IDs into absolute addresses and absolute addresses of pending breakpoints back to LabVIEW IDs soLabVIEW can highlight the corresponding nodes. The debug daemon uses the OCDI debugging plug-inVIs, which are emulator-specific VIs that instrument actual emulator hardware. All OCDI debuggingplug-in V...

  • Page 92

    labview\Targets\NI\Embedded\vxworks\cmd565\utils\compiled.batexample batchfile, which executes a GCC compiler to compile the C file and generates the list file in stabs format.3.Call EMB_Debug_Map_Gcc_ResolveSymbols.viandEMB_Debug_Map_Gcc_ResolveExtraSymbols.viafter the build script executes to p...

  • Page 93

    value for non-cluster data types or is in the form of ( type_code1, type_code2, and so on), wheretype_code1, type_code2are numeric values for cluster data types as shown in the following codesample:struct _ocdi1_heap {cl_00000 c_error_in__no_error_; /* c: error in (no error) */int32 l_Constant; /...

  • Page 94

    4.Edit EMB_Debug_OCDI.iniso all tokens point to the VIs you renamed in step 3.5.Change the implementation of all VIs in the root directory. Implementation of some methods isoptional.OCDI Debugging ExampleThe following example targets support OCDI debugging:•Axiom CMD565, VxWorks RAM Image•Axi...

  • Page 95

    initial offset is the ending offset of the previous member of the structure. initial offset is 0 for the first member in thestructure.symbol is the symbol name in the form of variable.member (type_code).offset is the offset of the member in the structure.offset+length is the ending offset of the ...

  • Page 96

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 97

    status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning orthat no error occurred before this VI or function ran. The default is FALSE.The code input identifies the error or warning. The pop-up option Explain Error (or Explain Warning) give...

  • Page 98

    error out contains error information. If error in indicates that an error occurred before this VI ran, error out containsthe same error information. Otherwise, it describes the error status that this VI produces. Right-click the error outindicator and select Explain Error from the shortcut menu f...

  • Page 99

    source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.IDownload.viDownloads the embedded application to target memory. This plug-in VI is called when a user selectsDownload from the build spe...

  • Page 100

    IExit.viCloses all connections and releases all resources associated with a specific target. The IRelease plug-inVI calls this plug-in VI when a user removes a target from a project or the project is closed.target ID is the ID of the target project item from which this VI is called. Use target ID...

  • Page 101

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 102

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 103

    status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning orthat no error occurred before this VI or function ran. The default is FALSE.The code input identifies the error or warning. The pop-up option Explain Error (or Explain Warning) give...

  • Page 104

    The code input identifies the error or warning. The pop-up option Explain Error (or Explain Warning) gives moreinformation about the error displayed.source specifies the origin of the error or warning, and is, in most cases, the name of the VI that produced the error orwarning. The default is an ...

  • Page 105

    code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or awarning code.source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.IRelea...

  • Page 106

    status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or awarning code.source describes the origin of the error or warning and i...

  • Page 107

    source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.IResolveSymbols.viResolves relative breakpoint, signal, and control addresses on targets that use loaders or have operatingsystems that s...

  • Page 108

    ISetBreakpoints.viSets one or more hardware or software breakpoints on specified absolute addresses.target ID is the ID of the target project item from which this VI is called. Use target ID to distinguish betweenconcurrent debug connections to different targets over the same plug-in interface.ad...

  • Page 109

    target ID is the ID of the target project item from which this VI is called. Use target ID to distinguish betweenconcurrent debug connections to different targets over the same plug-in interface.error in (no error) describes error conditions that occur before this VI runs. The default is no error...

  • Page 110

    Node entries for vi name nSignal entries for vi name nControl entries for vi name nLocation entries for vi name n[offset_table]Type and size of internal data structuresExample LVM File[foo.vi]SNode(10,11,11)@527=0x16340Node(13,14,17)@563=0x16580Node(14,15,17)@570=0x165BCSRN(17,13)@627=0x168A4Loca...

  • Page 111

    ArrayControlData.elt_datatype=128,32ArrayControlData.hDefaultValue=32,32ArrayControlData.hValue=0,32ArrayControlData.nDims=96,32BigEndian=1BooleanData=4BooleanData.bDefaultVal=16,8BooleanData.bInput=24,8BooleanData.bStatic=0,8BooleanData.bVal=8,8ClusterControlData=152ClusterControlData.bInput=119...

  • Page 112

    PictInfo.bHidden=384,8PictInfo.bounds=128,64PictInfo.color=352,32PictInfo.currentBackColor=224,32PictInfo.currentForeColor=192,32PictInfo.currentTextColor=256,32PictInfo.currentX=64,32PictInfo.currentY=96,32PictInfo.dc=32,32PictInfo.dirty=16,16PictInfo.hDefaultValue=320,32PictInfo.hPictCode=288,3...

  • Page 113

    _PDAArr=12_PDAArr.arr=64,32_PDAArr.datatype=0,32_PDAArr.fill=56,8_PDAArr.refcnt=32,16_PDAArr.staticArray=48,8_PDAStr=12_PDAStr.len=32,32_PDAStr.refcnt=0,16_PDAStr.staticStr=16,16_PDAStr.str=64,16VI SectionEach source VI is a separate section in the VI section part of the LVM file. The following t...

  • Page 114

    Maps the LabVIEW VI node to the line number in the C file and the absolute address. This entrydetermines the emulator breakpoint address when a user sets a breakpoint on the block diagram. Thisentry also locates and highlights the block diagram node when the executable hits the breakpoint.Paramet...

  • Page 115

    Location.SNode(10,11,11)@[523..540]Location.Node EntriesLocation.Node( id1,id2,id3 )@[ startLine..endLine ]Description:Maps the LabVIEW node to the first and last line in the generated C code that implements the node.This entry locates the LabVIEW node when a user sets a breakpoint or single-step...

  • Page 116

    SID_13908=0xB4520CID EntriesCID_controlId=absoluteAddressDescription:Maps the front panel control ID to the absolute target memory address. This entry determines the absolutetarget address of the control variable when a user opens a front panel window.Parameters:controlIDis the internal LabVIEW c...

  • Page 117

    ArrayControlData.dataType=160,32ArrayControlData.elt_datatype=128,32ArrayControlData.hDefaultValue=32,32ArrayControlData.hValue=0,32ArrayControlData.nDims=96,32Endianness EntryBigEndian= bigEndianDescription:Indicates the endianness of the target.Parameters:bigEndiandetermines the endianness of t...

  • Page 118

    BooleanData.bStatic=0,8BooleanData.bVal=8,8ClusterControlData EntriesClusterControlData=structureSizeClusterControlData.bInput=memberOffset,memberSizeClusterControlData.bStatic=memberOffset,memberSizeClusterControlData.datatype=memberOffset,memberSizeClusterControlData.pBigCls=memberOffset,member...

  • Page 119

    EnumCtlData.bStatic=memberOffset,memberSizeEnumCtlData.datatype=memberOffset,memberSizeEnumCtlData.defaultVal=memberOffset,memberSizeEnumCtlData.nValue=memberOffset,memberSizeEnumCtlData.numItems=memberOffset,memberSizeDescription:Describes the layout of the EnumCtlData structure in the target me...

  • Page 120

    structureSizeis the size of the NumericData structure in bytes.memberOffsetis the offset of the structure member variable in bits.memberSizeis the size of the structure member variable in bits.Location:LVNumeric.hExample:NumericData=24NumericData.bInput=48,8NumericData.bStatic=40,8NumericData.dat...

  • Page 121

    memberSizeis the size of the structure member variable in bits.Location:PictInfo.hExample:PictInfo=52PictInfo.bHidden=384,8PictInfo.bounds=128,64PictInfo.color=352,32PictInfo.currentBackColor=224,32PictInfo.currentForeColor=192,32PictInfo.currentTextColor=256,32PictInfo.currentX=64,32PictInfo.cur...

  • Page 122

    StringData.len=memberOffset,memberSizeStringData.pValue=memberOffset,memberSizeStringData.padding=memberOffset,memberSizeDescription:Describes the layout of the StringData structure in the target memory. The LabVIEW debugger uses theStringData structure information to access the front panel strin...

  • Page 123

    LVCCG.hExample:_ControlData=20_ControlData.controlIdx=0,32_ControlData.dataType=96,32_ControlData.fieldType=128,32_ControlData.hValue=64,32_ControlData.parentIdx=32,32_LVGraphData Entries_LVGraphData=structureSize_LVGraphData.bStatic=memberOffset,memberSize_LVGraphData.datatype=memberOffset,membe...

  • Page 124

    Describes the layout of the _OCDI_Alignment structure in the target memory. The LabVIEW debuggeruses the _OCDI_Alignment structure information to access the cluster signal and control cluster memberdata structures.Parameters:structureSizeis the size of the _OCDI_Alignment structure in bytes.membe...

  • Page 125

    _PDAArr.staticArray=48,8_PDAStr Entries_PDAStr=structureSize_PDAStr.len=memberOffset,memberSize_PDAStr.refcnt=memberOffset,memberSize_PDAStr.staticStr=memberOffset,memberSize_PDAStr.str=memberOffset,memberSizeDescription:Describes the layout of the _PDAStr structure in the target memory. The LabV...

  • Page 126

    EMB_Debug_DD_SetAbsoluteMemAddress.vito update the absolute address of each memoryrecord.Note You must resolve all breakpoints, symbols, and memory records when an embeddedVI is built into an embedded application. Resolving is the most complicated part ofgenerating the LVM file because it involve...

  • Page 127

    •Breakpoint AddressBreakpoint ID is the incrementing zero-based breakpoint record.target ID is the ID of the target used to support concurrent debugging sessions. Wire 0 to this input when you call thisVI from a build plug-in VI.error in (no error) describes error conditions that occur before t...

  • Page 128

    status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or awarning code.source describes the origin of the error or warning and i...

  • Page 129

    source specifies the origin of the error or warning, and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.VI Name is the name of the VI for which this breakpoint belongs.Signal/Control ID is an internal LabVIEW signal ID or control ID.Memory ...

  • Page 130

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 131

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 132

    error in (no error) describes error conditions that occur before this VI runs. The default is no error. If an erroroccurred before this VI runs, the VI passes the error in value to error out. This VI runs normally only if no erroroccurred before this VI runs. If an error occurs while this VI runs...

  • Page 133

    The code input identifies the error or warning. The pop-up option Explain Error (or Explain Warning) gives moreinformation about the error displayed.source specifies the origin of the error or warning, and is, in most cases, the name of the VI that produced the error orwarning. The default is an ...

  • Page 134

    error out contains error information. If error in indicates that an error occurred before this VI ran, error out containsthe same error information. Otherwise, it describes the error status that this VI produces. Right-click the error outindicator and select Explain Error from the shortcut menu f...

  • Page 135

    source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.EMB_Debug_DD_SetAbsoluteBPAddress.viSets the absolute address of a given breakpoint record.target ID is the ID of the target used to supp...

  • Page 136

    target ID is the ID of the target used to support concurrent debugging sessions. Wire 0 to this input when you call thisVI from a build plug-in VI.Memory ID is the zero-based memory record ID.Address is the absolute address for the memory record.error in (no error) describes error conditions that...

  • Page 137

    Additional Debugging Features with IDE IntegrationIDE integration provides the following debugging features:•Synchronized stepping—Stepping through the generated C code in an IDE updates the node inLabVIEW.•Synchronized breakpoints—Setting and clearing breakpoints in an IDE updates the co...

  • Page 138

    }return eFinished;Example IDE Integration ImplementationThe Unix Console example target implements IDE integration with the open source Eclipse framework.Refer to the labview\vi.lib\LabVIEW Targets\Embedded\Debug\OCDI\Eclipsedirectory forthe Unix Console and Eclipse example implementation.Install...

  • Page 139

    9.Click the Finish button.10. Click the Install All button.11. Click the Yes button to restart the workbench.Cygwin 1.5.23-2 or laterYou must download and install Cygwin to use the IDE integration example implementation, whichintegrates Eclipse and LabVIEW for the PHYTEC example target. Refer to ...

  • Page 140

    IDE Integration Plug-In VIsTo implement IDE integration with LabVIEW, you must modify and implement the following OCDIdebugging plug-in VIs:•IInitIndication•IGetIndication•IShowCrash•IShowSource•(Optional) IResolveAddressIInitIndication.viInitializes the IDE indication occurrence. You c...

  • Page 141

    source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.IGetIndication.viRetrieves the last event from the IDE.target ID is the ID of the target project item from which this VI is called. Use t...

  • Page 142

    status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or awarning code.source describes the origin of the error or warning and i...

  • Page 143

    code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or awarning code.source describes the origin of the error or warning and is, in most cases, the name of the VI that produced the error orwarning. The default is an empty string.IShowS...

  • Page 144

    IResolveAddress.viConverts an address to a C filename/line number pair for dual debugging with another IDE. Implementingthis VI is optional.target ID is the ID of the target project item from which this VI is called. Use target ID to distinguish betweenconcurrent debug connections to different ta...

  • Page 145

    entries is how you provide an alternative implementation. Using Funclist removes the overhead of subVIcalls and can produce substantial performance improvements in LabVIEW embedded applications.SubVI calls have overhead to support multithreading, reentrancy, front panel controls and indicators,an...

  • Page 146

    Passing Parameters DirectlyPassing parameters for C function calls, which is the second line in Funclist entries, have the followingrequirements:•Place an @character at the beginning of the line of C code.•Use a format code in the form @ xnto access the subVI inputs and outputs. xrepresents a...

  • Page 147

    target directory. When LabVIEW launches, LabVIEW loads the common Funclist files in alphabeticalorder. When you create an application instance for your target, LabVIEW loads any target-specificFunclist files in alphabetical order. To override an entry in the common Funclist files, use the same na...

  • Page 148

    Supporting a Static Memory ModelTo support a static memory model, you must compile all of the C files with the CStaticcompilerdirective. You must set the memory model parameter in the LabVIEW C Code Generator to 1.You must define the CStaticcompiler directive for all LabVIEW C Code Run-Time Libra...

  • Page 149

    •You can index tunnels in a For Loop, but you must define the number of iterations. Target syntaxchecking does not support constant folding, so you must wire a constant to the count (N) terminalof the For Loop.•You cannot wire the name of the Timed Loop external source to the Source input bec...

  • Page 150