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.

CCS: OMAPL138



Tool/software: Code Composer Studio

#include "L138_LCDK_aic3106_init.h"
#include "math.h"
#define SAMPLING_FREQ 8000
#define PI 3.14159265358979
#define LOOPLENGTH 64

void sine_wave(void)
{
float frequency = 1000.0;
float amplitude = 20000.0;
float theta_increment;
float theta = 0.0;

interrupt void interrupt4(void);
{
theta_increment = 2*PI*frequency/SAMPLING_FREQ;
theta += theta_increment;
if (theta > 2*PI)
theta -= 2*PI;
output_left_sample((int16_t)(amplitude*sin(theta)));
return;
}
}


void Square_wave(void)
{
int16_t square_table[LOOPLENGTH] = {
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000
};

int16_t loopindex = 0;

interrupt void interrupt4(void); // interrupt service routine
{
output_left_sample(square_table[loopindex++]);
if (loopindex >= LOOPLENGTH)
{
loopindex = 0;
return;
}
}
}

void Ramp_wave(void)
{
int16_t output = 0;

interrupt void interrupt4(void); // interrupt service routine
{
output_left_sample(output); // output to L DAC
output += 2000; // increment output value
if (output >= 30000) // if peak is reached
output = -30000; // reinitialize
return;
}
}
int main()
{
int ch;
printf("\n Wave Menu");
printf("\n Enter Your Wave Form");
printf("\n 1. Sine Wave");
printf("\n 2. Square Wave");
printf("\n 3. Ramp Wave");
printf("\n\n Enter Your Choice ::");
scanf("%d",&ch);

switch(ch)
{
case 1:
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
break;
case 2:
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
break;
case 3:
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
break;
}
}

IT HAS THE FOLLOWING ERRORS

Description Resource Path Location Type
unresolved symbol _interrupt4, first referenced in ./vectors_intr.obj sinenn C/C++ Problem

Description Resource Path Location Type
<a href="file:/C:/ti/ccsv5/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain sinenn C/C++ Problem

Description Resource Path Location Type
#10010 errors encountered during linking; "sinenn.out" not built sinenn C/C++ Problem

Please do help to sort these errors

Console window:

**** Build of configuration Debug for project sinenn ****

"C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
'Building file: ../main.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/bin/cl6x" -mv6740 --abi=coffabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.4/include" --include_path="C:/Users/mahe/Desktop/Supporting files/bsl/inc" --define=c6748 --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
"../main.c", line 81: warning #112-D: statement is unreachable
"../main.c", line 85: warning #112-D: statement is unreachable
"../main.c", line 89: warning #112-D: statement is unreachable
'Finished building: ../main.c'
' '
'Building target: sinenn.out'
'Invoking: C6000 Linker'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/bin/cl6x" -mv6740 --abi=coffabi -g --define=c6748 --display_error_number --diag_warning=225 --diag_wrap=off -z --stack_size=0x800 -m"sinenn.map" --heap_size=0x800 -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/lib" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="sinenn_linkInfo.xml" --rom_model -o "sinenn.out" "./vectors_intr.obj" "./main.obj" "./L138_LCDK_aic3106_init.obj" "../evmomapl138_bsl.lib" "../linker_dsp.cmd" -l"libc.a"
<Linking>

undefined first referenced
symbol in file
--------- ----------------
_interrupt4 ./vectors_intr.obj

error #10234-D: unresolved symbols remain

error #10010: errors encountered during linking; "sinenn.out" not built
>> Compilation failure
gmake: *** [sinenn.out] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

Thank you

  • Why does you program have three interrupts with the same function name, i.e. interrupt4?

    place a function prototype at the top of vectors_intr.c,i.e. interrupt void interrupt4(void);

    Stephen
  • Every one of those declarations of interrupt4 is inside another function. It's quite confusing; at first glance it appears to be that you are trying to declare interrupt4 as a function inside another function, which is not legal C code. However, upon taking another look, what you've really got is just a bunch of unnecessary blocks that make it look that way. Consider:

    void sine_wave(void)
    {
        float frequency = 1000.0;
        float amplitude = 20000.0;
        float theta_increment;
        float theta = 0.0;
    
        interrupt void interrupt4(void);
        {
            theta_increment = 2*PI*frequency/SAMPLING_FREQ;
            theta += theta_increment;
            if (theta > 2*PI)
                theta -= 2*PI;
            output_left_sample((int16_t)(amplitude*sin(theta)));
            return;
        }
    }

    This should be:

    void sine_wave(void)
    {
        float frequency = 1000.0;
        float amplitude = 20000.0;
        float theta_increment;
        float theta = 0.0;
    
        theta_increment = 2*PI*frequency/SAMPLING_FREQ;
        theta += theta_increment;
        if (theta > 2*PI)
            theta -= 2*PI;
        output_left_sample((int16_t)(amplitude*sin(theta)));
        return;
    }

    I think you will find the problem to be much clearer if you make this adjustment.