CPP project with RTC ISR functions - Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CPP project with RTC ISR functions - Issue

1,193 Views
anand-k
Contributor III

We are using FRDM-KL25 board for our prototype developement. I created a C proejct in CW IDE 10.3 for RTC. I created the entire project in C first. RTC interrupts were handled by ISR routines in IVT. This was successful with all functionalities working. But now am trying to migrate this C code to CPP code. I created a class RTC and moved all my functions into it.

I didnt move the ISR function void __attribute__ ((interrupt)) RTC_Interrupt(void) into the class. When I moved it into the class, it is showing  error "RTC_Interrupt was not declared in this scope". Please find my snapshots.

Could anyone suggest me on how to move RTC ISR functions within the Class.? or how make reference of the ISR function in the class in the Interrupt Vector Table?

pic1.png

pic2.png

Labels (1)
0 Kudos
Reply
3 Replies

788 Views
kai_liu
Senior Contributor I

Hi, Anand,

Any update? I want a working CPP demo on FRDM-KL25Z. But I want to use ARM GCC Embedded to build it. I have posted my thread on Re: Any G++ CPP demo project running on KL?

Allan K Liu

0 Kudos
Reply

788 Views
Monica
Senior Contributor III

Anand, how is the project going?

Keep us posted, we'd like to know :smileywink:

Best regards.

0 Kudos
Reply

788 Views
JimDon
Senior Contributor III

The function must be static, put perhaps that is what RTC_ISR macro does.

Because it is static, it can only reference static members of the class OR you need have a global singleton object that the ISR references.

It may just be easier to make the actual ISR function not a member of the class, and just have it call in to a member function from the global singleton you will probably need anyway.

Also, if you are leaving it in the class you would have to say:

MyClass::RTC_Interrupt

but then the file using it would have to cpp as well for that to work.

You may have to fiddle a bit to get this right.

I have to ask if the benefits of c++ are really going to out weight the price in size/speed and the issue of dynamic memory allocation, which is so important to effectively leveraging the advantages of c++.

You should also know that c++ is as not much used and therefore not as well tested as c.