Need Help: C++ with string class crashes

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

Posts: 5
Joined: Tue Nov 24, 2015 4:55 pm

Need Help: C++ with string class crashes

Tue Nov 24, 2015 7:01 pm

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 */

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

while (1)
if (sTemp == "end")
//TODO:: Please write your application code

Return to “Development Tools”

Who is online

Users browsing this forum: Google [Bot] and 1 guest