Tool/software: Code Composer Studio
In my application I have the main.c file, and the I have a file, Codes.c.
Codes.c contains a lot of bit patterns and then:
static volatile char tempcode [16384]; static volatile int CodeLength; static volatile int CodeIdx; void BuildCode(int CL) { int i; CodeLength=CL; tempcode[..]= bla.bla; .. .. }
In main.c I have the following:
//Links to Codes.c extern void BuildCode(int CL); extern char tempcode [16384]; extern int CodeLength, CodeIdx; .. .. void CGsetupISR(void) { unsigned short NextData; //Clr interrupt GPIOIntClear(GPIO_PORTQ_BASE, GPIO_PIN_2); //Clr DC GPIOPinWrite(GPIO_PORTQ_BASE,GPIO_PIN_0, 0); if (CodeLoad==1) { CodeIdx++; if (CodeIdx>CodeLength) { CodeLoad=2; return; } } else { .. .. }
if (CodeLoad=1) NextData=tempcode[CodeIdx]; else ..
}
void UploadCode(int len) { BuildCode(len); //Load code into buffer and copy 7 times CodeLoad=1; CodeIdx=0; SendFirstCGData(); }
This all compiles fine, but entering the link phase, I get:
undefined first referenced symbol in file --------- ---------------- CodeIdx ./main.obj CodeLength ./main.obj tempcode ./main.obj
I have tried:
#include "Codes.c"
.. but then I get:
error #10056: symbol "BuildCode" redefined: first defined in "./Codes.obj"; redefined in "./main.obj"
This comes with or without commenting out the external ref. to that function.
How do I solve this?
PS. I have tried to edit typos, obvious wrong format in the code parts etc, but this editor really do not want you to edit anything?