Invalid function pointer exception

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

Invalid function pointer exception

Jump to solution
724 Views
sudeepchandrase
Contributor II

I am trying to write a exception handler to catch invalid function pointer calls for Uc MK20DX256(cortex M4). I was assuming a hard fault exception would be raised for such calls unfortunately that doesn't seem to be the case. I had enabled the hard fault in the PE cpu components. PE created a hard fault exception catch routine. Tried catching this exception by enabling a breakpoint in the exception catch routine but this break point was never hit. It would be great if anyone could give clarity on the following:

1. Does Hard fault exception get raised during invalid function pointer calls ?

2. If Yes, whats it that I am doing wrong ?

3. If no, whats a good way to catch invalid function pointer calls ?@

Labels (1)
1 Solution
608 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sudeep,

   Thank you for your interest in NXP kinetis product, I would like to provide service for you.

    Next time, please let us know the kinetis chip part number, as you know, K20 have a lot of series, 50Mhz, 72Mhz, 100Mhz etc.

   In your PE configuration, don't just enable the hardfault, you can enable all the fault interrupt:

pastedImage_1.png

  I think you especially need to enable the usage fault.

  From the ARM cortex-M4 device generic user guide, we can know these exception types:

pastedImage_2.png

pastedImage_3.png

So, enable all the fault interrupt, then try it again.

If you still have problems, you can send me your test project, I will help you to check it.

You also can stop the running during debugging after you run the exceptions, just to check where the code is stopping.

Any updated information, just let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

3 Replies
609 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sudeep,

   Thank you for your interest in NXP kinetis product, I would like to provide service for you.

    Next time, please let us know the kinetis chip part number, as you know, K20 have a lot of series, 50Mhz, 72Mhz, 100Mhz etc.

   In your PE configuration, don't just enable the hardfault, you can enable all the fault interrupt:

pastedImage_1.png

  I think you especially need to enable the usage fault.

  From the ARM cortex-M4 device generic user guide, we can know these exception types:

pastedImage_2.png

pastedImage_3.png

So, enable all the fault interrupt, then try it again.

If you still have problems, you can send me your test project, I will help you to check it.

You also can stop the running during debugging after you run the exceptions, just to check where the code is stopping.

Any updated information, just let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

608 Views
sudeepchandrase
Contributor II

Hi Kerry,

Thanks for your response. RESOLVED.

0 Kudos
608 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sudeep Chandrasekaran,

You are welcome!

 If your problem is solved, could you help to mark the correct answer? Just to close the case, thank you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos