Interrupts and Thumb vs ARM code

Questions about the BASICtools and MakeItC
Post Reply
Posts: 1029
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA

Interrupts and Thumb vs ARM code

Post by basicchip »

>from the help line
Looking at Interrupt Sub example in ARMBASIC.pdf as well as example code GPIO_INT.bas; everything mostly makes sense EXCEPT for where the address of the ISR is loaded: why do you need to OR it with a 1 ??

GPIO_INT.bas: EINT3_ISR = dothis or 1 'Set the ISR, EINT3 channel is shared with GPIO interrupts
INT SUB example: EINT0_ISR = dothis or 1 ' set function of VIC

I'm happy to do it the same way in my code, just wanted to understand whats going on here...


The Cortex M parts only run Thumb code. ARM7 and Cortex A parts can run either Thumb or ARM code. To distinguish which it should be the LSB of the PC is used to indicate a branch to Thumb code. Interrupts are handled now by the NVIC in the Cortex parts. It forces the value in the vector into the PC, and while the M-Cortex parts only run Thumb code, you still need to set that LSB, otherwise the CPU goes off into the weeds.

The earlier ARM CPUs could only execute interrupts in ARM code.

This is described somewhere in the ARM documentation and it is not covered in many of the early ARM manuals that people have in book form.

Post Reply