|
|
View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Thu Jun 09, 2016 12:39 am |
|
|
'RESTART_TRAP_CONFLICT', is what you get, if you don't have a handler for the error. When this happens, the stack/trapaddr is lost.
You need to have the handler:
Code: |
unsigned long trapaddr;
#INT_ADDRERR
void ADDRERR_isr(void)
{
#asm
mov w15, w0
sub #38, w0
mov [w0++], w1
mov w1, trapaddr
mov [w0], w1
and #0x7f, w1
mov w1, trapaddr+2
#endasm
clear_interrupt(INT_ADDRERR);
restart_cpu(); //This causes a _software reset_.
}
|
This then means you then soft reboot, with the value stored in 'trapaddr'.
Then check for 'RESTART_SOFTWARE', and see what is in trapaddr. |
|
|
younder
Joined: 24 Jan 2013 Posts: 53 Location: Brazil
|
|
Posted: Fri Jun 10, 2016 11:15 am |
|
|
Hi Ttelmah,
I have the trap routine handler already in my code (Same as yours posted on this tread Fri Jul 24, 2015 1:58 am), except for the two new lines below:
Code: |
clear_interrupt(INT_ADDRERR);
restart_cpu(); //This causes a _software reset_.
|
Without these two lines, the MCU is restarting and calling 'RESTART_TRAP_CONFLICT'.
I'll test it again to see if it will works now.
Thanks buddy
Hugo _________________ Hugo Silva |
|
|
younder
Joined: 24 Jan 2013 Posts: 53 Location: Brazil
|
|
Posted: Fri Jun 10, 2016 3:31 pm |
|
|
Now I have changed my ISR trap handler to:
Code: |
unsigned long trapaddr;
#INT_ADDRERR
void ADDRERR_isr(void)
{
#asm
mov w15, w0
sub #38, w0
mov [w0++], w1
mov w1, trapaddr
mov [w0], w1
and #0x7f, w1
mov w1, trapaddr+2
#endasm
clear_interrupt(INT_ADDRERR);
reset_cpu(); //This causes a _software reset_.
}
|
And I still get 'RESTART_TRAP_CONFLICT', but this time with trapaddr=8C06188D (coud not find this address in the .LST!)
The Point is that if I compile my code with CCS V5.051 there is no trap conflict! .... would that be a compiler (5.059) bug? _________________ Hugo Silva |
|
|
younder
Joined: 24 Jan 2013 Posts: 53 Location: Brazil
|
|
Posted: Tue Jun 21, 2016 5:29 pm |
|
|
Finnaly I've found that the trap conflict was due to a compiler (v5.059) bug when copying an array element from one array to another
when the source is a structure declared as 'const'....
http://www.ccsinfo.com/forum/viewtopic.php?t=55193
This is why I was not able to see the err_addr after mcu is reset.
Hugo _________________ Hugo Silva |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|