Hello,
I'm working on a K60 with MQX 4.2 and compile under KDS 3.0.0
I'm using _int_install_kernel_isr to have a direct interrupt and bypass MQX.
In reference manual, it is indicated we must save/restore register..
Is my interrupt function must be declared in "interrupt"?
By which way?
I tested _Interrupt void MyIt(void)
interrupt void MyIt
...
But nothing work.
Have you an idea of prefix to declare my Interrupt function? (By this way I hop the compiler will save register context and return with "rti" instead of "rts" instruction...
:smileyhappy:
Hi Arnaud,
before switching to an ISR routine handler which is bypasses MQX the MQX kernel will save some registers but not all. So if you perform some mathematical operations it is possible that registers do not have the same content at the end of the ISR. You must backup General Purpose registers when the ISR starts and restore them at the end when no more operations are being executed.
I wrote a very simple example using both, int_install() and int_kernel_install(). This project was made using MQX4.1 but it will help for sure. Please see the attachment in next post.
How to invoke interrupt in GPIO demo project of mqx for more then one time?
You can also find an example in MQX installation path: C:\Freescale\Freescale_MQX_4_2\mqx\examples\isr
To backup registers the following document may be useful.
Extended Inline Assembly with Kinetis Design Studio
I hope this information is useful.
Best regards,
Carlos
Hi Arnaud Girard:
"_int_install_kernel_isr" will install the desire ISR directory to the vector table. Please use __ram_vector_table__ = 1, this is use to tell MQX that the vectors will be on RAM, making possible to change the Kernel ISR.
Regarding the register saving, the compiler will do this for you, you need to tell it that the function you are writing is an ISR with the __declspec(interrupt:0), for instance:
__declpsec(interrupt:0) void myISR(void)
{
/*code*/
}
Have a great day,
Daniel
Hello,
I'm Using MQX under KDS,
So I declared MQX_ROM_VECTORS 0
I test following the __declpsec or __declspec (I think)
But I have following error:
..\..\Sources\AP_Ana\AP_Ana.c:122:21: error: expected ')' before ':' token
__declpsec(interrupt:0) void AP_Ana_Init(void)
..\..\Sources\AP_Ana\AP_Ana.c:122:21: error: expected ')' before ':' token
__declspec(interrupt:0) void AP_Ana_Init(void)
No other idea to save/restore context of MPU?
If you are using traditional MQX , please use #define MQX_ROM_VECTORS 0
If you are using MQX for KSDK, please use __ram_vector_table__ = 1
Additional question:
Is the FPU register are saved? (Can I do float calcul in Interrupt context without need to do other save register action?)