Michael Walker

Confusion on priority levels with exception handlers

Discussion created by Michael Walker on Mar 27, 2012
Latest reply on Apr 4, 2012 by TomE

I'm porting firmware written for 68040 using another vendor's toolset into a Coldfire application for V2 (MCF52100) using CodeWarrior 10.1.  The board is our custom design with the Coldfire replacing the 68040.  All peripherals are on the board rather than using the internal peripherals, i.e. using the Coldfire as a processor only interfacing with memory mapped devices.  This allows the board to be a "drop-in" replacement for our previous design.  That's the theory, anyway.  The code is in C with some inline assembly as needed.

 

I am relatively new to both Coldfire and CodeWarrior but have extensive uP and uC experience with some experience with 68K processors.

 

My problem is that I'm getting a perpetual interrupt when setting the IPL to 0 in the SR.  At initialization, the IPL is loaded with 7 and all of the unused exceptions are initialized to a routine "uninit" to perform as a default handler for each vector in the table (original program worked this way).  A specific interrupt routine is then added in the user vector area to service our on-board UART.  This is the only interrupt we really need.  At the start of the main loop the IPL is then changed to 0 and one of the default handlers appears to be fired in an infinite loop.  I haven't determined which vector caused it.  I don't see where any "interrupt clearing" is done so I wonder if that is missing in the original code and/or is done differently for Coldfire.  Also, the listing file from CodeWarrior shows that the "uninit" routine does execute "strldsr $2700" which should mask the interrupt from reoccurring yet it appears that it still fires. 

 

 I tried to change the priority level of the routine by modifying the declaration of the function to "_declspec (interrupt:1) void uninit()" and then set the IPL to 3 instead of 0 hoping that this interrupt would not be executed but it still does.  Comparing the S19 files for this build to the previous build shows the exact same file so is this not the way to set the interrupt priority level?  It is the only method that I have found documented anywhere.  Is setting the priority level the right way to ignore the exceptions I don't want?

 

Obviously I'm really confused and could use some help.

Outcomes