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.

Tconf searching in project directory for TCI file does not work

Other Parts Discussed in Thread: TMS320C6416

BIOS Version: 5.42.1.09
Processor: TMS320C6416
Code Composer: 5.4.0.00091

I have a problem where a call to utils.loadPlatform("platformName"); in my TCF file, the Tconf script utils.tci does not look in the project directory for the platform folder. Instead the utils.tci script looks in the directory project/Debug when it is searching the current directory.

An additional possible problem is this:
If I change to utils.loadPlatform("./platformName"); I would think the following code in utils.findFile would be called:
    /* if file name starts with "./", use utils.cwd */
    if (fileName[0] == '.'
            && (fileName[1] == '/' || fileName[1] == '\\')) {
        file = new java.io.File(utils.cwd, fileName);
        return (file.exists() ? (file.getPath() + "") : null);
    }

But earlier in utils.tci ./ is changed to // in the platform name, causing this if statement to evaluate to false. Then //platformName/Platform.tci evaluates to being an absolute path instead, so the file is never found to exist.

It appears in Properties -> Build -> Environment (tab) PWD and CWD can be changed. Changing this might be a workaround for the problem.

  • Paul,
    the current directory when running Tconf is project/Debug. I don't think you can change that. Have you tried
    utils.loadPlatform("../platformName");

    or you can't use that for some reason?

  • I tried ../platformName  and the utils.tci script sanitizes that turning it into    ti/platforms////platformName    which seems strange.

    The reason I think it should use project instead of project/Debug as the working directory for Tconf is because that is how it worked in Code Composer 3 and according to SPRU007i Tconf User Guide section 4.1.1 Referencing a Platform File with utils.loadPlatform(), that is the expected behavior.

    It also looks like a logical bug in the utils.tci file since some of the code in there could never execute as I mentioned in my problem description comment.

    Thanks,

    Paul

  • Paul,
    I checked the code and the docs, and for your particular use case only the name Platform.tci will work. So, the first thing you need to do is to rename your file to Platform.tci. Then, when you are invoking utils.loadPlatform(), you need to pass the name of the of the directory that contains that file (actually, the name is treated as a name of a RTSC package but we can ignore that for now). The directory that you passed to utils.loadPlatform() is added in sequence to the four paths defined in the User Guide section 4.1.1 until the file is found. Your project directory is not searched by default, so you have to make one more change. Right-click on your project, select Properties->CCS Build->Tconf->General Options, and add ${workspace_loc} to the Configuration import path. Finally, invoke
    utils.loadPlatform("projectName");
    Your workspace is now added to the search path, and the search path is searched for "projectName/Platform.tci". 

    The explanation for turning "platformName" into "ti/platforms/platformName" is that some very old TI platform files weren't following the convention that the platform files must be named Platform.tci. So we added some code to support these, but they are all located in the directory 'ti/platforms'. That's why 'ti/platforms' is always prepended to any such non-conforming name.

    If you want to change the working directory, you would have to go to Project Properties->CCS Build->Build and disable automatic makefile generation to be able to change Build directory. But, then you would have to write makefiles on your own, which is a lot of work for a small benefit.

  • I actually was using the name Platform.tci , I guess my explanation was not clear.

    What I have is this:

    ProjectDirectory\platformName\Platform.tci

    When I step through utils.tci with the Javascript debugger, I see it search in "."  for the folder platformName, which it expands to be C:\ProjectDirectory\Debug  instead of C:\ProjectDirectory

    Based on previous behavior and the Tconf User Guide, I would suggest that "." should be expanded to C:\ProjectDirectory and expanding to the Debug folder is a bug.


    Right-click on your project, select Properties->CCS Build->Tconf->General Options, and add ${workspace_loc} to the Configuration import path. Finally, invoke
    utils.loadPlatform("projectName");
    Your workspace is now added to the search path, and the search path is searched for "projectName/Platform.tci". 

    This would be a suitable fix for the issue, I did not make my workspace location the same as my project location so I used ${PROJECT_ROOT} instead which caused it to find the Platform.tci file.

    That's why 'ti/platforms' is always prepended to any such non-conforming name.

    Actually the part I thought was strange was that it inserted four slashes, that wasn't a typo: ti/platforms////platformName

    I consider the issue solved with the workaround you mentioned above, but would suggest filing a bug report for the change in behavior in utils.tci where it searches the Debug directory instead of the project directory for the platform folder.

    Thank you.

  • Paul,
    utils.tci does not define the current directory, it just uses Java API to find what the actual working directory is. CCS sets the working directory, and then runs gmake in it. So, the command line that runs tconf is being run in the Debug directory.
    All CCS-generated make files are created with the assumption that the working directory is the build configuration directory ('Debug' or 'Release'). To change that behaviour would require significant changes in CCS, and I don't see any good reason for that.

    Can you tell me what part of Tconf User Guide you are referring to? We may need to fix that content.
    Thanks,
    Sasha

  • I was referring to item 2 of this list, on page 4-3 of SPRU007i:

    The search sequence use by utils.loadPlatform() to locate platform files
    is as follows:
    1) User-specified locations, if any, in config.importPath.
    2) Default locations in config.importPath, including the current folder.
    3) XDC_INSTALL_DIR\include
    4) XDC_INSTALL_DIR\packages

    Could utils.tci be changed to search ../ instead of ./  ,ie the parent folder of the Debug or Release folder? I certainly didn't mean to imply I thought you should go changing all that other functionality. It doesn't seem useful to have the script search the current folder with that being the Debug or Release folder. Since those folders are deleted by the clean command I doubt anyone would ever want to store their platform configuration in there. It also seems non-obvious what TConf would consider to be the "current folder", I had assumed that would be the Project folder as it was in CCS3.

    Page 2-6 in the document it also says this about config.ImportPath:

    The -Dconfig.importPath option can also be specified in Code
    Composer Studio on the DspBiosBuilder tab of the Build Options
    dialog.

    As an alternative solution, I think this description is not accurate for CCS5. Perhaps updating this description and getting me to read more carefully would have led me to discover the solution you proposed of adding the project directory to the TConf import list.

  • Paul,
    utils.tci is used in many different environments other than CCS, and the search functions in utils.tci are used to find all kinds of files. It's a low-level utility that simply searches the current working directory, among other places given in that list. CCS is just one of the users of utils.tci, and it's the CCS workflow that runs gmake and then Tconf in the Debug directory. That's why I said that CCS determines what the current directory is, not Tconf or utils.tci.

    Also, the project top directory is not the place where users commonly create platform files. The common scenario is to keep platforms in a directory outside of your workspace and then use config.importPath to find these platforms.

    The part of the User Guide that refers DspBiosBuilder tab is valid only for CCS3, so we'll have to fix that. Thanks for letting us know.