We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am working with a LPC1768. I don't have a lot of experience with it yet, so I am stuck doing something that seems very simple - but I cannot find the reason in the manual. I am calling a function via a function pointer. Why is it then that the very first instruction of the target function
0x00000250 B510 PUSH {r4,lr}506] ; @0x1FFF0098
causes a hard fault? I am using the MSP stack, nothing fancy.
Thanks
OK, I see that xPSR contains a clear 0 bit for the T field, will is guaranteed to cause an exception. Any ideas how that happened?
Maybe I should further clarify: when I call a function via a function pointer or branching to its address, the thumb bit in xPSR is cleared, which is illegal. How can be avoid that? Function calls that the compiler generates use BL.W, but I don't think it is related.
How do you call these functions? Do you load the address explicitly, or do you allow the linker to sort things out? If explicitly, make sure the destination address is odd.
-- Marcus http://www.doulos.com/arm/
Marcus,
Thanks. I FORGOT that CM3 will only operate at Thumb-2, so I used an even address...! In the mean time I prepared an assembly work-around - no longer required. Thanks again.