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.

Eclipse variable ${resource_name} supported?



Is the eclipse variable ${resource_name} supported by CCS5.1?
Under CCS Build -> Build Variable I can't find it and I don't know how to define it.

  • Daniel,

    If you check the "show system variables" box down at the bottom of the variables dialog it will display the eclipse variables.  There is a selected_resource_name that may be the one you are looking for.  Where do you want to use the variable?  

    John

  • Jon,

    For assert() I’m using __FILE__ at the moment. __FILE__ expands to the full file name (with path), which “costs” plenty of code flash and make the binary dependent
    from the path where the project is!
     If the eclipse variable resource_name would be supported, then I could define a predefined symbol:
      FILENAME="\"${resource_name}"\"
    which should contain the file name without path.

    Daniel
  • Daniel,

    Yes you can do this. You have to set it at the file level.  If I set it at the project level it gets the project name.  Unfortunately inserting pictures seems to be busted for me so I can't upload the screen captures I did but this is the variable I set on my hello.c file.  FILENAME="\"${selected_resource_name}\""

    Note that the variable is selected_resource_name and NOT resource_name

    Regards,

    John

  • John,

     I have several files in the project. If I select one file, for ex. main.c, then all files will have the filename of the selected file (main.c for the ex.) if I define FILENAME="\"${selected_resource_name}\"".

     Daniel

  • Daniel,

    In trying this out with multiple files I am getting inconsistent results.  Sometimes I get one filename for all files, sometimes it is the project name for one and file name for another.  It does seem to be dependent on what is selected either in the project view.  Unfortunately that means that this variable isn't going to work for us here.  Looking through the list of variables I don't see any others that will work.  I will ask around but the only item I see that has the info is _FILE_.

    John

  • Daniel,

    You can use ${InputFileName} or ${InputFileBaseName}.  These will resolve to the actual file being built.

    - Baltasar

  • Baltasar,

    When I use ${InputFileName} or ${InputFileBaseName}, I get the build warning that the build variable can't be resolved.
    Do you have CCS5.1 installed and use its eclipse plugin? Which additional software have you installed?

    Daniel

  • That was a known bug - it has already been fixed in CCSv5.1.1 (SDSCM00042006).  Try installing 5.1.1 - it is already available from the download page.

    - Baltasar

  • With CCS 5.1.1 it works! Where are the variables ${InputFileName} and ${InputFileBaseName} defined?

    Do I have similar variables in CCS 3.3?

    Thanks, Daniel

  • Daniel,

    These are built-in file-scope variables.  These don't show up in the UI currently.

    Here is the list of all the file-scope built-in variables:

    1. InputFileName
    2. InputFileExt
    3. InputFileBaseName
    4. InputFileRelPath
    5. InputDirRelPath
    6. OutputFileName
    7. OutputFileExt
    8. OutputFileBaseName
    9. OutputFileRelPath
    10. OutputDirRelPath

    CCS 3.3 supported the following file-scope macros:

    1. File_path
    2. File_dir
    3. File_name
    4. File_basename
    5. Input_path
    6. Input_dir

    - Baltasar