Installing interrupt handlers on ARM7TDMI

Jay Monkman jtm at smoothsmoothie.com
Tue Jul 16 21:43:52 UTC 2002


On Tue, Jul 16, 2002 at 04:11:35PM -0500, Charles Steaderman wrote:
> 
> 
> I traced the implementation of _CPU_ISR_install_vector and it places 
> _ISR_Handler in memory at an offset of ARM_EXCEPTION_IRQ (0x18) + number 
> of interrupt sources (correctly 8 in this case) * 4 (0x20). This places 
> _ISR_Handler at 0x38 NOT 0x18. In addition, it places the address of 
> _ISR_Handler at 0x38, NOT a brach to _ISR_Handler instruction. I still 

It shouldn't put _ISR_Handler at 0x38, just the address of
_ISR_Handler.

The instructions  at 0x00 - 0x1c are 'ldr pc, [pc, #0x18]'. They get
setup in <bsp>/start/start.S.  That instruction means 'replace the PC
with the word at PC + 0x18'. So you don't need a branch - you just
need to store the address of _ISR_Handler at 0x38. 

It adds 0x18 to the PC instead of 0x20 because on the ARM the PC is 8
bytes past the current instruction.


> **something** working. I will look into a better way to dynamically get 
> a vector table into remapped ram at address 0x0 later (unless someone 
> else knows a neat way to do it :-)).

I think the vectoring need work.

> bsp, although it looks as though it is using an external PIC. In 
> addition, it performs a number of switches from INT mode to SVC mode and 
> back again which didn't seem to be very robust in my test case. I took 

I have a version that stays in INT mode the entire time (except when a
task switch is required). I'm sending the patch right after this.

> out the mode switches and things seemed to run better, but still no time 
> based task switches. Knowing now that the interrupt handling doesn't 
> properly save all states, perhaps that is more of the problem. It the 
> mode switching **really** necessary? Is it primarily for stack management?

I'm not sure why it was done that way. There's lots of way to do it,
and that probably seemed right at the time. As I understand it, most
(all) of the ARM stuff in the tree now is from a project that was
canceled, and it had to be put in the tree or thrown away. 

-- 
Jay Monkman	    The truth knocks on the door and you say "Go away, I'm 
                    looking for the truth," and so it goes away. Puzzling.
		     - from _Zen_and_the_Art_of_Motorcycle_Maintenance_



More information about the users mailing list