[<<][staapl][>>][..]
Sat Feb 7 13:05:06 EST 2015

PIC vs ARM

Diving into Cortex M3 assembly and finding out that a lot of
instruction cycles are needed to just set a bit in a device register.
Here, clearing the timer interrupt bit (TIM2.SR.UIF bit on STM32F103).
Comment is cycle count.

        .thumb
        .syntax unified
tim2_isr:       
        ldr	r3, tim2_sr     @; 2
	ldr	r2, [r3, #0]    @; 2
        bic	r2, r2, #1      @; 1
        str	r2, [r3, #0]    @; 2
        bx	lr
.align       
tim2_sr:
        .word 0x40000010

Re-appreciating PIC18's single cycle bit set/clear instructions.

EDIT: Maybe this can be fixed with bit banding?




[Reply][About]
[<<][staapl][>>][..]