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.
When I debug this, the members of CharQue will not change while stepping through main(). Why is it?
#include <msp430.h>
struct CharQue{
int start;
int end;
char buffer[10];
};
struct CharQue bff = {4,9};
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
bff.start=8;
bff.end=5;
bff.start=0;
bff.end=1;
for(;;){
bff.buffer[bff.end] = 'A'+bff.end;
bff.end++;
bff.start++;
}
return 0;
}
My target is MSP430FR5739 using CCS5.3
Are you saying that none of the fields of the variable "bff" change at any time during the function "main"?
Yes, when I run debug it is the case. Actually, the last time I ran, the value in bff.end and start was the same, which was 12975 and I can step through for loop many times, it does not change. Can someone see if you can reproduce the problem?
You realize that bff.buffer is only 10 bytes long, so any value greater than 9 for start/end means that you're writing all over RAM, and probably causing all kinds of problems...
Yes, I am just stepping through this not running it and watching the values in bff, this is not a program, it is some code to understand the behavior of global struct. Why are they not changing? This is so frustrating, do I need to explicitly define the global variables?
Anything is possible, but it is very unlikely the problem here has anything to do with the compiler. This code is just too simple. It is far more likely that some hardware issue is the cause. That being the case, we who watch this forum are unable to help out on this one.
The folks at the MSP430 device forum are more likely to be helpful. Let me know if you want me to move this thread to that forum.
Thanks and regards,
-George
But the code runs fine with IAR and the same chip. Any recommendation to check any setting is the CCS?
Please add --src_interlist to the build options, build the project, then attach the .asm function that contains the main function to your next post.
Thanks and regards,
-George
George, thank you for looking into this, the following is the Compiler build command from console:
"C:/ti/ccsv5/tools/compiler/msp430_4.1.3/bin/cl430" -vmspx --abi=eabi -g --include_path="C:/ti/ccsv5/ccs_base/msp430/include" --include_path="C:/ti/ccsv5/tools/compiler/msp430_4.1.3/include" --advice:power=all --define=__MSP430FR5739__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --printf_support=minimal --src_interlist --preproc_with_compile --preproc_dependency="hello.pp" "../hello.c"
Thank you. As I suspected, the compiler generated assembly looks fine. Here is the assembly which increments the fields in the structure ...
;** 25 ----------------------- ++bff.end;
.dwpsn file "../hello.c",line 25,column 3,is_stmt,isa 0
ADD.W #1,&bff+2 ; [] |25|
;** 26 ----------------------- ++bff.start;
.dwpsn file "../hello.c",line 26,column 3,is_stmt,isa 0
ADD.W #1,&bff+0 ; [] |26|
Try assembly stepping through those statements. If you don't see those memory locations increment, then you have to question whether the system configuration has a problem. Are these memory locations writable?
Thanks and regards,
-George
How can I check if the memory is writable? I am using MSP-FET430UIF with MSP-TS430RHA40A. I just know that it works OK with trial version of IAR.
Uninstalled every TI piece of software from my PC, reinstalled CCS5.3 it, and now I am using compiler version 4.1.2 and it seems to work. Thank you all for helping me to soft this out.