MATLAB Examples

TI_HERCULES_RM48_check_setup() Checks configured TI_HERCULES_RM48 preferences

This function performs simple checks on the preferences configured by the function TI_HERCULES_RM48_setup(). These checks are limited to confirmation that paths and certain executables are valid. Note: if you are viewing the abbreviated form of this help through the command line 'help' or 'doc' functions, please view the full instructions in HTML format instead. matlab:doc -classic

Contents

License

Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
  Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
  Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the
  distribution.
  Neither the name of Texas Instruments Incorporated nor the names of
  its contributors may be used to endorse or promote products derived
  from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function TI_HERCULES_RM48_check_setup()

Run Now: TI_HERCULES_RM48_check_setup

function TI_HERCULES_RM48_check_setup()

Check that CCSVER and CCSPATH are valid

Checks the following:

  • The 'CCSVER' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'CCSPATH' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'CCSPATH' folder must exist on the host filesystem.
  • Executable 'ccstudio.exe' must exist in the 'eclipse' subdir of 'CCSPATH'
    fprintf('\n------ Check Code Composer Studio ------\n');
    CCS_FAIL = 0;
    try
        CCSVER = getpref('TI_HERCULES_RM48','CCSVER');
        fprintf('CCSVER = %s\n',CCSVER);
    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','CCSVER');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        CCS_FAIL = 1;
    end

    try
        CCSPATH = getpref('TI_HERCULES_RM48','CCSPATH');
        fprintf('CCSPATH = %s\n',CCSPATH);
        if (exist(CCSPATH,'file'))
            fprintf(' + CHECK OK: %s exists\n',CCSPATH);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',CCSPATH);
            CCS_FAIL = 1;
        end

        CCSEXE = fullfile(CCSPATH, 'eclipse', 'ccstudio.exe');
        if (exist(CCSEXE,'file'))
            fprintf(' + CHECK OK: %s exists\n',CCSEXE);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',CCSEXE);
            CCS_FAIL = 1;
        end

    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','CCSPATH');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        CCS_FAIL = 1;
    end

Check that CGTVER and CGTPATH are valid

Checks the following:

  • The 'CGTVER' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'CGTPATH' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'CGTPATH' folder must exist on the host filesystem.
  • Executable 'armcl.exe' must exist in the 'bin' subdir of 'CGTPATH'
    fprintf('\n------ Check Code Generation Tools ------\n');
    CGT_FAIL = 0;
    try
        CGTVER = getpref('TI_HERCULES_RM48','CGTVER');
        fprintf('CGTVER = %s\n',CGTVER);
    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','CGTVER');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        CGT_FAIL = 1;
    end

    try
        CGTPATH = getpref('TI_HERCULES_RM48','CGTPATH');
        fprintf('CGTPATH = %s\n',CGTPATH);

        if (exist(CGTPATH,'file'))
            fprintf(' + CHECK OK: %s exists\n',CGTPATH);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',CGTPATH);
            CGT_FAIL = 1;
        end

        CGTEXE = fullfile(CGTPATH, 'bin', 'armcl.exe');
        if (exist(CGTEXE,'file'))
            fprintf(' + CHECK OK: %s exists\n',CGTEXE);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',CGTEXE);
            CGT_FAIL = 1;
        end

    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','CGTPATH');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        CGT_FAIL = 1;
    end

Check that HCGVER and HCGPATH are valid

Checks the following:

  • The 'HCGVER' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'HCGPATH' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'HCGPATH' folder must exist on the host filesystem.
  • Executable 'halcogen.exe' must exist in the directory 'HCGPATH'
    fprintf('\n------ Check HalCoGen ------\n');
    HCG_FAIL = 0;
    try
        HCGVER = getpref('TI_HERCULES_RM48','HCGVER');
        fprintf('HCGVER = %s\n',HCGVER);
    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','HCGVER');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        HCG_FAIL = 1;
    end

    try
        HCGPATH = getpref('TI_HERCULES_RM48','HCGPATH');
        fprintf('HCGPATH = %s\n',HCGPATH);

        if (exist(HCGPATH,'file'))
            fprintf(' + CHECK OK: %s exists\n',HCGPATH);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',HCGPATH);
            HCG_FAIL = 1;
        end

        HCGEXE = fullfile(HCGPATH, 'halcogen.exe');
        if (exist(HCGEXE,'file'))
            fprintf(' + CHECK OK: %s exists\n',HCGEXE);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',HCGEXE);
            HCG_FAIL = 1;
        end
    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','HCGPATH');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        HCG_FAIL = 1;
    end

Check TCONF

Checks the following:

  • The 'TCONF' preference in the 'TI_HERCULES_RM48' group must be set.
  • The 'TCONF' file must exist on the host filesystem.
    fprintf('\n------ Check Target Config File ------\n');
    TCONF_FAIL = 0;
    try
        TCONF = getpref('TI_HERCULES_RM48','TCONF');
        fprintf('TCONF = %s\n',TCONF);

        if (exist(TCONF,'file'))
            fprintf(' + CHECK OK: %s exists\n',TCONF);
        else
            fprintf(' - CHECK FAILED: %s does not exist\n',TCONF);
            TCONF_FAIL = 1;
        end
    catch ME
        fprintf('getpref(''TI_HERCULES_RM48'',''%s'') failed. -- ','TCONF');
        fprintf('Run TI_HERCULES_RM48_setup() and try again\n');
        TCONF_FAIL = 1;
    end

Report Pass/Fail and which checks if any fail.

Note: Halcogen is currently optional, so if the Halcogen checks fail this is reported as a warning, not an error

    FAIL_REQ = CCS_FAIL + CGT_FAIL + TCONF_FAIL;
    FAIL_OPT = HCG_FAIL;
    FAIL = FAIL_REQ + FAIL_OPT;

    if (FAIL == 0)
        fprintf('\n------ SUMMARY ------\n');
        fprintf('PASS: All Checks Passed\n');
    elseif (FAIL_REQ ~= 0);
        fprintf('\n------ SUMMARY ------\n');
        fprintf('FAIL: One or more problems with required paths\n');
        if (CCS_FAIL ~= 0)
            fprintf(' - Problems with Code Composer Studio Path (required)\n');
        end
        if (CGT_FAIL ~= 0)
            fprintf(' - Problems with Code Generation Tools Path (required)\n');
        end
        if (HCG_FAIL ~= 0)
            fprintf(' - Problems with HalCoGen Path (optional)\n');
        end
        if (TCONF_FAIL ~= 0)
            fprintf(' - Problems with Target Config File Path (required)\n');
        end
    else
        fprintf(['\n------ SUMMARY ------\n' ...
                 'WARNING: All REQUIRED paths are OK\n'...
                 '  Problems with HalCoGen Path (optional)\n'...
                 '  You may need to install HalCoGen if you intend\n' ...
                 '  to make customizations to this package\n ']);
    end
end