Page 1 of 1

Need Help: C++ with string class crashes

Posted: Tue Nov 24, 2015 7:01 pm
by YogiBear
I am new to Atmel Studio. I am writing a program in C++ that works with ASF. After viewing this forum I have a solution that seems to work. However, as soon as I tried using the string class in my C++ code, I get an interrupt that sends me to the Dummy_Handler.

I am using the following linker option:
Under Addtional Specs: Select use syscall stubs

to get rid of the undefined syscall functions.

I am guessing that this does not provide the low level functions to allocate memory that string uses.

Here is a simple bit of test code that does very little but shows the problem:
It jumps to Dummy_Handler right after the string sTemp = “Hello” line.

What do I need to do to make this work?



#include "sam.h"
#include <string>

using namespace std;

/**
* \brief Application entry point.
*
* \return Unused (ANSI-C compatibility).
*/
int main(void)
{
/* Initialize the SAM system */
SystemInit();


string sTemp = "Hello";
sTemp += "There";

while (1)
{
if (sTemp == "end")
return(0);
//TODO:: Please write your application code
}
}