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.

Compiler: There is a ready-made C ++ code (Code Composer Studio). Copy matrix. How to fix errors

Tool/software: TI C/C++ Compiler

I make a copy of the site https://mirpokera.com.ua/ua/. Part of the site is in C, but the .out executable file is not created due to errors in B code; it never worked, only in Pascal, but it turned out to be a problem to find a working, ready-made code for copying the matrix on the network. It seems to be not difficult, for those who are dealing with C. Can you help me fix errors in the code?

  • Is it the case that all of the source code in the system is C or C++?  Those are the only programming languages supported by TI compilers.

    Thanks and regards,

    -George

  • Sorry, forgot to attach the code.

    #include <std.h>
     
    #include <log.h>
     
    #include "loadcfg.h"
     
    #include <math.h>  
    #include <csl.h>
    #include <csl_timer.h>
     
    /* Autocorrelation DSPLIB function */
    #include "DSP_autocor.h"
     
    /* RFT implementation */
    #define N 10
    #define a_file 256
     
    extern far TIMER_Config timerCfg1;
    extern far TIMER_Handle hTimer1;
     
     
    /*  Config Structures */
    TIMER_Config timerCfg1 = 
    { 0x00000000,        /*  Control Register (CTL)   */    
      0x0000FFFF,        /*  Period Register (PRD)   */    
      0x00000000         /*  Counter Register (CNT)   */
    };
     
    /*  Handles  */
    TIMER_Handle hTimer1;
     
    // FIR filter coefficients
    short coefficients[N+1] = { 0x6DF, 0x0, 0xF447, 0xFFFD, 0x2813, 0x3FFC,
    0x2813, 0xFFFD, 0xF447, 0x0, 0x6DF};
     
    float daten[256], 
       koef[4][3],
       a[4][3], b[4][3],
       spei_x[4][3], spei_y[4][3],
       x[256], y[256], xtime[256],
       m5c[11];
       
    int npoints,
       index, j,
       k1, k2, xr, tr,
       n, n_index, n_dat,
       n_teil, n_fil, data, srednee, i,
       m5[11]={5,6,7,8,9,10,11,12,13,14,15};
      
     
    /*
     *  ======== Real Forward RFT ========
     */ 
    void func(void)
    {
    int a[3][2]={
    {1,2}, {3,4}, {5,6}
    };
    int b[3] [2];
    int i,j,l;
    for (i=0; i<=2; i++)
    {
    for(j=0;j<=l;j++)
    {
     LOG_printf(&trace, "a = '%d' ",(Arg)a[i]|j]);
    } 
    }
    memcpy(b, a, sizeof(b));
    { 
    for (i=0; i<=2; i++)
    for(j=0;j<=l;j++)
    {
                     LOG_printf(&trace, "b = '%d' ",(Arg)b[i]|j]);
    } 
    return 0;           
    }
     
     
    /*
     *  ======== main ========
     */
     
    void main()
    {
        /* Run matrix */    
        func();
       
        /* Run Timer */ 
        hTimer1 = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);       
        TIMER_config(hTimer1, &timerCfg1);    
        
        LOG_printf(&trace, "the timer is run ..!");
        
        /* fall into DSP/BIOS idle loop */
        return;
    }


    Debug --> Build:

    ------------------------------ rft.pjt - Debug ------------------------------
    "c:\ti\plugins\bios\gconfgen" rft.cdb

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rft.c"
    "rft.c", line 81: error: expected a ")"
    "rft.c", line 89: error: expected a ")"
    "rft.c", line 91: error: a void function may not return a value
    "rft.c", line 99: error: declaration may not appear after executable statement in block
    "rft.c", line 99: error: expected a "}"
    5 errors detected in the compilation of "rft.c".

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rftcfg.s62"

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rftcfg_c.c"

    Build Complete,
    5 Errors, 0 Warnings, 0 Remarks.

    #include <std.h>
     
    #include <log.h>
     
    #include "loadcfg.h"
     
    #include <math.h>  
    #include <csl.h>
    #include <csl_timer.h>
     
    /* Autocorrelation DSPLIB function */
    #include "DSP_autocor.h"
     
    /* RFT implementation */
    #define N 10
    #define a_file 256
     
    extern far TIMER_Config timerCfg1;
    extern far TIMER_Handle hTimer1;
     
     
    /*  Config Structures */
    TIMER_Config timerCfg1 = 
    { 0x00000000,        /*  Control Register (CTL)   */    
      0x0000FFFF,        /*  Period Register (PRD)   */    
      0x00000000         /*  Counter Register (CNT)   */
    };
     
    /*  Handles  */
    TIMER_Handle hTimer1;
     
    // FIR filter coefficients
    short coefficients[N+1] = { 0x6DF, 0x0, 0xF447, 0xFFFD, 0x2813, 0x3FFC,
    0x2813, 0xFFFD, 0xF447, 0x0, 0x6DF};
     
    float daten[256], 
       koef[4][3],
       a[4][3], b[4][3],
       spei_x[4][3], spei_y[4][3],
       x[256], y[256], xtime[256],
       m5c[11];
       
    int npoints,
       index, j,
       k1, k2, xr, tr,
       n, n_index, n_dat,
       n_teil, n_fil, data, srednee, i,
       m5[11]={5,6,7,8,9,10,11,12,13,14,15};
      
     
    /*
     *  ======== Real Forward RFT ========
     */ 
    void func(void)
    {
    int a[3][2]={
    {1,2}, {3,4}, {5,6}
    };
    int b[3] [2];
    int i,j,l;
    for (i=0; i<=2; i++)
    {
    for(j=0;j<=l;j++)
    {
     LOG_printf(&trace, "a = '%d' ",(Arg)a[i]|j]);
    } 
    }
    memcpy(b, a, sizeof(b));
    { 
    for (i=0; i<=2; i++)
    for(j=0;j<=l;j++)
    {
                     LOG_printf(&trace, "b = '%d' ",(Arg)b[i]|j]);
    } 
    return 0;           
    }
     
     
    /*
     *  ======== main ========
     */
     
    void main()
    {
        /* Run matrix */    
        func();
       
        /* Run Timer */ 
        hTimer1 = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);       
        TIMER_config(hTimer1, &timerCfg1);    
        
        LOG_printf(&trace, "the timer is run ..!");
        
        /* fall into DSP/BIOS idle loop */
        return;
    }


    Debug --> Build:

    ------------------------------ rft.pjt - Debug ------------------------------
    "c:\ti\plugins\bios\gconfgen" rft.cdb

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rft.c"
    "rft.c", line 81: error: expected a ")"
    "rft.c", line 89: error: expected a ")"
    "rft.c", line 91: error: a void function may not return a value
    "rft.c", line 99: error: declaration may not appear after executable statement in block
    "rft.c", line 99: error: expected a "}"
    5 errors detected in the compilation of "rft.c".

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rftcfg.s62"

    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"G:/NY/CCS/Lab_Matrix_4/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "rftcfg_c.c"

    Build Complete,
    5 Errors, 0 Warnings, 0 Remarks.
  • I cannot build this code, so I cannot reproduce those diagnostics.  But I did notice one error.  There is no closing brace } for the function named func.  Please let me know if this resolves the problem.

    Thanks and regards,

    -George

  • Thanks, your comment helped. But there was one more mistake that I made while constructing logic. If someone has a similar error, write to me, I will try to explain. It will take a long time to write here.

  • I have a similar task. Can you help? I don't want to start right away wrong.