interrupts not working after call to c++ function

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys, I have a problem! Lets define it!

After making a call to certain c++ functions that say use an exception then the next interrupt that occurs cause the system to fail.

 

I would love suggestions to test.

 

The test routine is as follows:

	start_timer();
	for(int i = 0; i < 20; i++){
		msleep(1000); led_toggle(0);
	}

	// works if I stop the timer before calling the c++ routines
	stop_timer();


	templates();		// cause a failure with interrupts
	classes();
	virtual_func();
	name_space_test();
	lists(); 		// cause a failure with interrupts
	exceptions(); 		// cause a failure with interrupts

	for(int i = 0; i < 20; i++){
		msleep(1000); led_toggle(0);
	}
	while(1);

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stack overflow ? Linker file correct ? Proper exception support or better compile using -fno-exceptions (for GCC) and ensure no exceptions are thrown i.e. no bad_alloc might occur ?

So many questions and so little information, what ‚fail‘ means in your case ;)

It‘s usually not a big deal using C++. Most issues are the same for C and C++ applications.

And while we are at it, any chance using a debugger stepping thru the (assembly) code to get an idea what‘s going wrong ? 

Last Edited: Fri. Feb 21, 2020 - 10:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hs2 wrote:

Stack overflow ? Linker file correct ? Proper exception support or better compile using -fno-exceptions (for GCC) and ensure no exceptions are thrown i.e. no bad_alloc might occur ?

So many questions and so little information, what ‚fail‘ means in your case ;)

It‘s usually not a big deal using C++. Most issues are the same for C and C++ applications.

And while we are at it, any chance using a debugger stepping thru the (assembly) code to get an idea what‘s going wrong ? 

 

I would guess its the linker file, but I've tried just about every flag and the problem remains.

As I said, without linking the libc.a library it function correctly but things like prtinf don't. 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyone even give me suggestions to try and find the error?

I'm going to crack out the debugger tomorrow.