Ruth Hendrix

Another 'Cannot get Halt to work' post

Discussion created by Ruth Hendrix Employee on Jan 24, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Wed Nov 09, 2005 2:08 pm    
Halt on metrowerks debugger does not work for me. I have read all the posts I can find on this same problem and none solved my issue.

I have tried this with several different boards (JK4, QY4, and QB8) and all have the same problem.

in my main file i have
void irq_isr (void)
asm {
bil wait_irq // Waits for the IRQ signal to go high
swi // Jumps to monitor code

In the prm I have
VECTOR 2 irq_isr

In the CONFIG2 register I have IRQEN=1, IRQPUD=0
In the CONFIG1 register I have COPD=1
Interrupts are enabled.

I have checked that the code loaded into the board has the correct vectors for the RESET (@0xFFFE) and IRQ(@0xFFFA)

There is nothing loaded for the SWI vector (@0xFFFC)

Is this a problem?
What should be oaded for this vector?
I would assume that the SWI vector should point into the monitor/debugger. Is this a bad assumption?

What am I missing?

Could someone tell me exactly what actions are needed to get a basic Metrowerks project to work with the halt function.

Posted: Wed Nov 09, 2005 3:45 pm    

As a general minimum requirement, I believe all vectors should at least point to a RTI instruction. whether the interrupt for the vector is enabled or disabled. This will protect against spurious interrupts. This would also apply to the SWI vector, and possibly the IRQ vector, provided there are no other tasks to occur within the ISR.

Check that the IRQ is set for edge-sensitive only - the BIL instruction should then be unnecessary. Also the SWI instruction would seem redundant - best left well alone. So that leaves just the RTI instruction within the ISR.

Set a breakpoint from within the debugger if you need to halt the program flow at a specific point. I presume this applies to the CW debugger - I normally program and debug in ASM using the P&E software.

I have previously used a TIM interrupt to periodically wake up from halt mode, but IRQ should also work.

Posted: Wed Nov 09, 2005 4:23 pm    
When I wrote 'Halt' I meant halt in the metrowerks debugger not a processor halt.

Basically I can single step the debugger but if the code is running and I press the halt button I get a message saying that halt only works if it the IRQ is handled correctly.
Posted: Thu Nov 10, 2005 12:40 pm    

If you are in MON08=Monitor mode, the vectors you mentioned are not were you said. There is a special vector page in MON08 to help debug:
Modes --- ResetHigh - ResetLow - BreakHigh - BreakLow - SWIHigh - SWILow
User ---- $FFFE ------- $FFFF ---- $FFFC --- $FFFD ---- $FFFC --- $FFFD
Monitor - $FEFE ------- $FEFF ---- $FEFC --- $FEFD ----- $FEFC --- $FEFD

What do you use for debug interface ?

Posted: Thu Nov 10, 2005 2:42 pm  
I am using the True-Time simulator & Real Time Debugger that comes with the Metrowerks IDE. I used the memory windor to view the interrupt vectors located high in memory.

It shows that the vectors for RESET and IRQ vectors are set correctly. There is nothing specified for the SWI vector.

These lines in the prm file sets up the vectors
VECTOR 0 _Startup /* sets up location 0xFFFe, 0xFFFf RESET*/
VECTOR 2 irq_isr /* sets up location 0xFFFA, 0xFFFb IRQ */

There is nothing specified for VECTOR 1 (which would be the SWI interrutp @0xFFFc, 0xFFFd) These locations are have a value of 0xFF.

The demo project for softec mon-08 debugger had the Vector 2 pointing to the irq_isr function. I found nothing in the project that hooks the SWI vector.

I would think that there should be something in the SWI vector to cause the processor to jump into the monitor program.

What am I missing?
Posted: Thu Nov 10, 2005 2:55 pm    
Apparently the Hi-Wave debugger uses the IRQ line to stop the chips, but unfortunately, when communicating by using the on chip monitor (Mon-0Cool the IRQ line is required for the communication, so the chip can not be stopped, it is a restriction when debugging using the on-chip monitor... I don't think that there is another work around than just setting a breakpoint Sad

Posted: Thu Nov 10, 2005 8:50 pm    
Could you point me to a document about MON-08. I will need the most basic info.

Posted: Fri Nov 11, 2005 1:08 pm    
The most basic info on MON08 are located in the chapter Developpment Support of every datasheet.