µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: svl on July 01, 2011, 01:43:38 PM
-
Hi.
I am in progress of making a function that read out the information mention here:http://www.utasker.com/forum/index.php?topic=123.msg468#msg468
The idere are that in case of a "unexpected error" I have the best possible information when trying to locate the error.
My problem is that I have been trying to get the value fron the A7 but with no luck.
unsigned long tmp = *((uint32*)0x08F) //Get the value from the A7 register.
tmp = *(uint32*)(*(uint32*)A7); //Get the first byte mention in the above link. This is the data that A7 is pointion to.
tmp = *(uint32*)((*(uint32*)A7)+1);
tmp = *(uint32*)((*(uint32*)A7)+2);
tmp = *(uint32*)((*(uint32*)A7)+3);
Hope you can help me?
Best regards
Steen Larsen
-
Hi Steen
When such an exception occurs the routine called with the be corresponding exception handler.
To locate the value in A7 (without using assembler code) you could try the following:
interupt_routine() // routine with the necessary interrupt attributes definition
{
unsigned long ulStack; // put a variable on the stack which will also be used to hold values for later use
unsigned long *ptrStack = &ulStack; // thsi now points to the location of ulStack, which will be one long word lower on the stack than the A7 when the interruopt entered
ptrStack++; // now the value of this pointer is ther same as the original SP (A7) value.
ulStack = *ptrStack++; // this is now the value that is stored at the bottom of the exception stack
ulStack = *ptrStack; // and the value at the second location
}
I didn't actually test this but I would give it a try as a starting point. I am not sure about the line tmp = *((uint32*)0x08F) - I would expect this to read the value stored at address 0x8f in Flash.
Regards
Mark
-
Hi mark
Thnaks for your reply.
Your idere are great, but there must be something wrong. ;-)
I can see that the address in the A7 are changing as I step over the creation of the variabels. And the result in the ulStack
are not the same as when i enter the interupt function.
I will try a play araound with it after the sommer, to see if I can find the problem.
Regards Steen