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: Compiler doesn't work on one of my boards

Other Parts Discussed in Thread: LM3S6965

Tool/software: TI C/C++ Compiler

Hello,

I'm using a LM3S6965 evaluation kit (with ethernet and oled display). I imported a project from stellarisware and compiled it, but when I try to debug it it doesn't do what it should.

At first I thought it was a screen bug, because the green line, that indicates which line is going to be executed next, kept on jumping back and forward and sometimes completely skipping lines. Bu then I noticed that the examples don't work. After trying to setup eclipse to work with this board, I decided to go through the generated assembly and noticed that the bug coes from the compiler and not code composer. In the generated assembly I can clearly tell that lines are being ignored, reordered and sometimes executed twice. For Example:

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
    SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);

First reset is executed, then enable and then reset again.

The above line simees that it shouldn't be a problem for the program, and it isn't. The problem is in functions like netif_add (I'm trying to compile enet_io example). In it there is a function called init(). And init is a function that returns a value, but the thing about this function, is that the way it was made it always returns ERR_OK so ... this line

  if (init(netif) != ERR_OK) {
    return NULL;
  }

should never happen, but it still does. When I saw the generated assembly I noticed that it simply didn't compile the return ERR_OK.

Not only this happens, many more bizarre errors occur and I don't know how to fix it. I'm using CCS6.1 (I tried installing CCS7 but it failed installing most drivers). At the momento I'm download CCS 5.1 which was release before the final version of the last stellarisware, so it should work.

I noticed that the original program was made using TI compiler 4.9, but I had to change it to the latest compiler or else it would give me an error code and didn't compile.

What could be the problem? Is this a known bug? Is there a problem with my installation? I'll post my findings with CCS5.1, but it seems that this should never happen

  • Pablo Cottens said:
    In the generated assembly I can clearly tell that lines are being ignored, reordered and sometimes executed twice.

    Exactly what are you doing and seeing that leads you to this conclusion?  Does the generated assembly appear to be incorrect?  Or, you see this unexpected behavior while single stepping in CCS? Or what?

    Thanks and regards,

    -George

  • I can literally see in the generated assembly that instructions are being repeated. Imagine the following example:

    int main() 
    {
        int counter = 0;
        int retval = 0;
        int i;
    
    
        for (i; i < 5; i++) {
            printf("Say something");
            counter++;
        }
    
        return retval;
    }
    

    In the generated assembly I would see somehting like:

    counter = 0;

    retval = 0;

    counter = 0;

    ...

    printf("Say something") // 5 times

    // and here I don't see the increment of the  counter variable

    and it doesn't generate code for the return retval;

    I'm saying that I saw this behaviour in the debugger, which led me to inspect the generated assembly and I can clearly see that it does the exact same behaviour that I explained above (skipping lines of code, repeating them, etc, some internal fucntions that write to the registers wouldn't even be executed, more precisely, the function was never called, for example the initialization of the ethernet port).

    Actually I found a solution for this, I reverted to CCS 5.2. And I have a theory, This may have happened due to a botched installation because of my antivirus (the installation was signaled as failed or anything). Or maybe the newer compilers don't interact well with the stellaris board, but my money is on the antivirus

  • What is the opt level? Could be some loop unrolling going on.
  • Due to ...

    Pablo Cottens said:
    This may have happened due to a botched installation because of my antivirus

    ... you may not be able to reproduce this problem behavior ...

    Pablo Cottens said:
    I can literally see in the generated assembly that instructions are being repeated.

    But, if you can, I'd appreciate if you would submit a test case which allows me to see that too.  Please follow these steps.

    1. Preprocess one source file that shows this problem
    2. Attach that to your next post
    3. Show all the build options exactly as the compiler see them
    4. Indicate the version of the compiler (not CCS) used

    Thanks and regards,

    -George

  • Ok ... sorry it took me such a long time to answer. I was not using optimization. During this time I formatted my PC reinstalled everything and it just started working ... it was probably something wrong with the configuration on my PC
  • Sorry it took me such a long time to answer. As stated in one of my previous comments it was probably due to a problem in my PC ... not even the installation apparently. I simply formatted my PC reinstalled CCS with the same version and it started working.