Here below I illustrated the issue I encounter with my code.
I declare a global variable(buffer[][]), then I use it as an argument in the Read() function, this function is being called by another function : Tot()
When the global variable is being passed as an argument something is going wrong and the global variable seem to not exist in the local context of a function called in another functon when not passed as an argument.
To summarize there is a bug in the handling of global variables they are not usable as such in some context ...
I am using CCStudio Version: 5.3.0.00090 and the compiler TI v4.1.4 and debugging on EXP430FR5739
EXAMPLE to illustrate the issue encountered.
#include <msp430.h>
/*
* main.c
*/
void Read(char* );
void Tot();
static char buffer[5][10];
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
unsigned i,j;
for(i=0;i<5;i++)
for(j=0;j<10;j++)
buffer[i][j]=j+i*5;
Tot();
return 0;
}
void Read(char* Sentence) //In this function the argument Sentence is being messed up and though there is no compilation error it is not working
{
int Total;
unsigned i;
for(i=0;i<10;i++)
Total+=Sentence[i];
}
void Tot()
{
Read((char *)&(buffer[0][0]));
}