This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

xdc.loadPackage() Usage and Settings Options

Other Parts Discussed in Thread: AM3358

Hello!

I just found myself writing this code in my .CFG file:

var SPIPkg   = xdc.loadPackage('ti.drv.spi');

in order to link with the Processor SDK for TI-RTOS's (v3.0) SPI library.  However, I see that some packages require modifying a field in the package Settings object like this:

CslPkg.Settings.deviceType = socType;

or

I2CPkg.Settings.socType  = socType;

Note that the field names on the Settings object are different in the above 2 cases.

How can I know:

A.  when I need to modify such a field, and

B.  what its field name is going to be?

Furthermore:

C.  Where is this language documented, and

D.  where are these related objects documented?

Try as I may, I have not been able to find any documentation whatsoever on these things -- only examples in other .CFG files, and this is not enough to give me certainty that I'm doing the right thing, nor give me an understanding of what options I have and how I might use them to the advantage of the firmware I develop.

=-=-=-=

What I'm working with:  Win7-64-bit,

Dev Env:  CCS 6.1.2

Platform:  Custom board with MYIR brand MCC-AM335X-Y board with AM3358, 250MB RAM and other electronics that seem to be working perfectly.

Packages:  SYS/BIOS 6.45.1.29, UIA 2.0.5.50, AM335x PDK 1.0.3


Kind regards,
Vic

  • Hi Vic,

    Yes, that *.cfg code can be a bit confusing to new eyes.  Have you tried opening the *.cfg file using XGCONF?  This is a GUI that allows you to configure such settings.  You can open XGCONF by right clicking on the .cfg file in CCS, select "open with" then selecting XGCONF.

    Victor Wheeler61 said:

    I just found myself writing this code in my .CFG file:

    var SPIPkg   = xdc.loadPackage('ti.drv.spi');

    in order to link with the Processor SDK for TI-RTOS's (v3.0) SPI library. 

    Yes, as you've discovered, loading a package will result in that package's libraries being automatically linked into your application.

    Victor Wheeler61 said:

    However, I see that some packages require modifying a field in the package Settings object like this:

    CslPkg.Settings.deviceType = socType;

    or

    I2CPkg.Settings.socType  = socType;

    Note that the field names on the Settings object are different in the above 2 cases.

    The above objects correspond to a module, which defines an object that contains properties.  Modules are defined in a *.xdc file (e.g. Settings.xdc).  For example, the above two lines are both editing/configuring a module called Settings, however my guess is that they are located in different packages.  I.e. there is a Settings.xdc file in the I2C package, and also a Settings.xdc module in the CSL package.

    Modules are imported into your configuration/application via a line of code that calls "xdc.useModule('<I2C package>.Settings');.  If you look in your *.cfg file you should see something like that.

    Victor Wheeler61 said:

    How can I know:

    A.  when I need to modify such a field, and

    B.  what its field name is going to be?

    Victor Wheeler61 said:
    D.  where are these related objects documented?

    For SYS/BIOS modules, you can find these documented in your installation.  For example, I see it under:

        bios_6_45_02_31\docs\Bios_APIs.html

    For modules defined by/for the AM335x SDK drivers, I'd recommend that you start by looking at the *.xdc files for a particular package, maybe I2C.

    There you should find settings that can be configured statically for I2C.  The .xdc file will have a list of all of the properties for that module, and should have documentation for it/them, as well.

    Modules will typically set default values for the configuration parameters that they define, so if you're not happy with a particular default then you can change it via your .cfg file:

    var someModule = xdc.useModule('ti.xyz.someModule');

    someModule.configParam = <some new value>;

    Victor Wheeler61 said:
    C.  Where is this language documented, and

    You can find out more information on the XDCScript language at the main RTSC page.

    There you will also find a "primer" that provides a walk through of how the config file can be used in relation to your C sources.  Lesson 2 has an example of the *.cfg file, modules and settings.  (You might want to start at Lesson 1, though)

    Steve

  • Hi, Steven!

    Re XGCONF, yes, I use it regularly. I can't use it for linking with libraries (yet, at least that have discovered thus far), however, thus the hand-editing and need for knowledge.

    Your explanation is excellent, and I did indeed find these field names. Furthermore, these fields are MOSTLY documented in the comments in the .XDC file itself. And this takes care of MOST of my question. However, there is a gap still unanswered: I am often stumped (and this is no exception) by comments like this -- this is a copy/paste from the

    <am335x_pdk>/packages/ti/csl/Settings.xdc

    file regarding the 'deviceType' property:

    * To use CSL for the selected device, add the following lines to config
    * file and set the deviceType correctly:
    *
    * var cslSettings = xdc.useModule ('ti.csl.Settings');
    * cslSettings.deviceType = "k2k";

    Now, I can fill in the gaps and notice that the example here (and in other .XDC files) use all lower-case for these device names, and appear that due to the similarity of the IP for the AM335x family, that individual devices in this family are never named, such as in my .CFG file I would not do this:

    CslPkg.Settings.deviceType = "am3358";

    This leads to my next question: the author who wrote "set the deviceType correctly" seems to be writing to an audience that knows what "correctly" means. But I don't. If I say "am335x" -- I am still only guessing (I did see this in another .CFG file in an example for the CSL library).

    How do I find out what "correctly" means? (Note: this is a hypothetical case, but my mission here is to arm myself with knowledge of information sources so if I'm stuck at 2am on a Saturday morning [i.e. longer turn-around time on the E2E website], where I can look to get information -- which I would do first anyway if I knew where to look.)

    Kind regards,
    Vic
  • At this point it's beyond me, we'll have to get the PDK team to help out here.

    I'll see about getting their attention on this thread.

    Steve
  • I've moved your thread to the device forum.

    Todd