Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317117 - xdc.bld.BuildEnvironment.usePlatform() should not be nodoc'd
Summary: xdc.bld.BuildEnvironment.usePlatform() should not be nodoc'd
Status: ASSIGNED
Alias: None
Product: RTSC
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Sasha Slijepcevic CLA
QA Contact:
URL:
Whiteboard: target:3.40
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-16 17:16 EDT by Chris Ring CLA
Modified: 2014-03-11 15:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Ring CLA 2010-06-16 17:16:04 EDT
xdc.bld.BuildEnvironment.usePlatform() should be a supported API and have the @_nodoc attribute removed.
Comment 1 Chris Ring CLA 2012-06-04 12:38:24 EDT
Here's the use case...

In some Codec Engine package.bld scripts, for _some_ platforms, we can build an application configured with remote codecs.  So, conditionally, we'd like to Pkg.addExectuable() based on the platform properties.

The build scripts currently do something like this:

for (all targets) {
    for (all platforms in each target's .platforms[] array) {

        /* always build a 'local' app */
        Pkg.addExecutable();

        /* conditionally build a 'remote' app, if I recognize the platform */
        if (platform name matches "something I know to have a slave") {
            Pkg.addExecutable();
        }
    }
}

Today, we're matching on a platform string name, but that has problems (since a customer could create their own 'mycompany.myplatform' platforms we won't know about).

Using Build.usePlatform(), we can instead walk through a platform's properties, in the build model, to make this decision more reliably.
Comment 2 Sasha Slijepcevic CLA 2013-01-31 14:32:53 EST
I removed nodoc tag in xdc-z36. However, I also noticed that some platforms don't behave well when loaded in an object model other than 'cfg'. For example, tms320x28 platform references Boot.configurePll, where Boot is ti.catalog.c2800.init.Boot, and all config parameters exists only in config world for non-metaonly modules. Therefore, calling usePlatform on tms320x28 in the build model causes a fatal error. It's a bu in the platform, but I am sure there are many such issues in various platforms.

Also, usePlatform doesn't really fit the purpose of the function. Maybe we can change it to loadPlatform or something similar?
Comment 3 Sasha Slijepcevic CLA 2013-01-31 16:51:05 EST
If we add a config parameter 'target' to IPlatform, we would be able to correctly instantiate a platform in both 'bld' and 'cfg' object model. In 'bld' model, the flow would be:
Build.usePlatform(name, target)->Platform.create(name, {target: target}).

In 'cfg' model, we add 'target' to 'params' in the generated cfg shell script before calling Platform.create().

An additional benefit would be to remove prog.build.target references in instance$meta$init functions, and replace them with 'target', and that would work same in both models.
Comment 4 Sasha Slijepcevic CLA 2013-02-06 19:18:56 EST
Chris's use case doesn't really require use of usePlatform(). He would benefit more if we added a string 'deviceName' to IPlatform that he can use to identify what's the device on the platform. Right now, he has to use const structures DSP, GPP, GEM, etc. that are usually found in IPlatform modules but are not defined by the interface.

I'll add back the @nodoc tag, and postpone the bug to 3.30. The only current user of usePlatform is ProductView view, so we will take that usage into account when defining any changes in Build.usePlatform.
Comment 5 Dave Russo CLA 2013-02-06 22:14:58 EST
Build.usePlatform is used in xdc.tools.xgconf.productview.Main to build an xdc.cfg.Program object as context for the IProductView modules.