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.

Incrementing std::list<int>::iterator causes program to hang in FaultISR

Other Parts Discussed in Thread: LM3S3748

Hello

I'm trying to run a very basic STL program to verify the compiler's support for the STL.
I'm using Code Generation tools version 4.6.6. and my target is the LM2S3748 development board.

My program creates a list and and attempts to iterate through it. I use the debugger to examine "Val". The code is below.
The problem is after the iterator is incremented once (itr++), the next time it is accessed I wind up if the FaultISR.
I have to problem with the code using g++ on Linux or Windows.

Here is the code sample: 

volatile int Val=0;
 std::list<int> MyList;

MyList.push_back(0);
MyList.push_back(1);
MyList.push_back(2);

std::list<int>::iterator itr = MyList.begin();

while( itr!=MyList.end())
{
   Val = *itr;
    itr++;
}

  • Robert Ernst said:
    my target is the LM2S3748 development board.

    I presume you mean the LM3S3748.

    My guess is you are running out of either stack or heap, possibly both.  These are controlled with the linker options --stack_size and --heap_size.  Be sure to give both as much memory as you can.

    Thanks and regards,

    -George

  • Thanks George, you were correct. The default project builder sets the --heap_size=0. Removing it fixed the problem. I'll determine a more accurate value later.

    Thanks Again

    Robert Ernst