ROV Module Writers Guide/Getting Started

From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  offline version generated on 17-Jul-2018 11:07 UTC  

ROV Module Writers Guide/Getting Started

Steps for writing your first ROV view

Where to begin

Start with your module's specification, Mod.xdc.

Begin by defining your view structures, which dictate what will be displayed. A good tactic here is to simply copy your actual state structures, then go through the fields and decide which you want to display. It's a good idea to begin with simple fields to convince yourself that your view is basically working.

Step 1.  Define your first view structure

metaonly struct BasicView {
    String  label;
    Int     priority;
    SizeT   stackSize;
metaonly struct Instance_State {
    Int     priority;
    SizeT   stackSize;

Once you have your view structure defined, define your module Facet configuration parameter which just specifies what views you will display and what function and structure they will reference.

Step 2.  Define your ROV facet

import xdc.rov.ViewInfo
metaonly config ViewInfo.Instance rovViewInfo = 
        viewMap: [
            ['Basic', {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitBasic', structName: 'BasicView'}],

Next move to your module's XS file, Mod.xs. Again, it's good to start with just the basic fields. Write your view function to simply copy values from your target state structure into your view structure. Don't bother with the more complicated fields yet that involve retrieving extra data from the target.

Step 3.  Write a basic view function

 * ======== viewInitBasic ========
 * Initialize the 'Basic' instance view.
function viewInitBasic(view, obj)
    view.priority = obj.priority; 
    view.stackSize = obj.stackSize;

Once that's done, launch CCS and ROV and verify that you're seeing your view.

This should give you the confidence to move on and make more complex improvements to the view.

Debugging your code

As you move on to more complex ROV operations, you'll want a way to debug problems in your ROV code.

The main tool for debugging XS code is just print statements.

In CCS, these print statements will go to a special console which you must enable when you launch CCS. To do this CCS needs to be launched with the -console flag. You can do this by opening a command prompt and navigating to the 'eclipse' directory of your CCS installation, and launching CCS with "eclipse.exe -console". Or, you can simply edit your CCS shortcut and in the 'Target' field add -console to the end.


When you launch CCS, you should see a separate command prompt window open behind it. This is the console, and any print statements from your ROV code should appear here.

See also

xdc.rov.ViewInfo Client documentation for xdc.rov.ViewInfo

Personal tools
package reference