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.

MSP430, not running to main()

Other Parts Discussed in Thread: MSP430F2618

Hello,

I've started moving my code over to CCS after developing in IAR for awhile. Currently, I'm trying to do simple unit tests on some of my functions, but when I have all of my code implemented, the program will not run to the begging of main by default. The debugger claims the program is running, but I get no output and I can't what the MCU is running. 

I've attached a version of the code I'm running now. Note that this a stripped down version of the full code. Comply the threshold unit test defined in unitTests.h, and the computeThreshold() function defined in insideSystem.c are used in this example. 

If I comment out the line:

result = runUnitTests(1);

It will run the code and simply print out the printf() statement below it. If I leave this line in, the code "runs" but it does not pause at main, and none of the print statements I expect to see appear. 

  • And finally inside_globals.h

    inside_globals.h
  • Hi Rob,

    what target are you using?  What migration steps have you been taking?  I see your example builds without error for some targets but throws a "code too large" error for others.  So one thing to just verify is the code size is not causing any running off into the weeds so to speak.  I know IAR typically produces lower codes sizes than CCS.  Are you using optimization at all?  Another thing to check would be the level of printf support you have enabled.  (project->properties->build->msp430 compiler->advanced options->library function assumptions

    Any further details would be great.

    Best Regards,
    Lisa

  • Hi Lisa,

    Thanks for the prompt response.

    I tried a couple of migration options. First I tried importing the files as they were into a new project. That didn't work well.  Most recently, I started with the "Hello World" example project, and I've just been copy-pasting my code into it, segments at a time. 

    My target is set as MSP430F2618. I'm setting this in the Project->Properties->General menu. Is that the right place?

    I've also increased my stack and heap sizes significantly in the hopes of remedying this problem. 

    I set my printf() level to full, but I have none of the other option boxes checked. 

  • Hi Rob,

    ok, thanks for that.  I think the next step is possibly to look at the interrupts and how they have been being translated.  Are you using ISRs and how did you implement these in CCS?  I ask because even if I build without error, almost every warning generated is regarding interrupts.  I would also double check the value of result.

    In the mean time (and it may have to be tomorrow) I am going to check if I have a F2618 to run the code you sent on.

    Best Regards,
    Lisa

  • Hi Lisa,

    I also noticed the interrupt warning but ignored them. In my current implementation interrupts should not be needed, or enabled. I'm simply calling functions. This is really just a a basic C file with some functions that could be run independent of the MCU if I wanted to do it that way. When I'm actually running my system I'll want to have ISRs, but right now I just want to test the functions independently. Interrupts shouldn't be an issue here. 

    -Rob

  • As an update, I wanted to verify the above statement: 

    Rob Chase said:

    This is really just a a basic C file with some functions that could be run independent of the MCU if I wanted to do it that way. 

    I ran this exact code in eclipse with CDT today, compiled with gcc and debuged with gdb and the worked fine. It's just not running to the beginning of main() when I put this on the MCU with CCS. 

  • The program has a .bss segment size of 3950 bytes. When the (default) eabi (ELF) output format is used in CCS, the problem could be that the WDT fires during C startup code.

    To prevent the Watchdog from firing during the C startup you can add the following to a C source file:

    int _system_pre_init(void)
    {
         WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
         return 1;
    }

  • Thank you Chester! I will try this tomorrow when I am back with my system.