2010년 9월 20일 월요일

template of assembly function for cortex M3 (thumb2)

/*;*******************************************************************************
;* Function Name : void c_func(void *out, void *in, uint16_t n)
;* Description : linkable function with C language
;* Input : - R0 = out:
;* - R1 = in:
;* - R2 = n:
;* Output : None
;* Return : None
;********************************************************************************/

.cpu cortex-m3
.fpu softvfp
.syntax unified
.thumb
.text

.global c_func

;* #define N 64

.equ N, 64

.thumb_func
c_func:

STMFD SP!, {R4-R11, LR}
;* operation
LDRSR rx, [ry, #+0]
SUBS rx, ry, #+1 /* decrement */
MUL rz, rx, ry
MLA r4, r5, r4, r6
;* end of operation
LDMFD SP!, {R4-R11, PC}
BX LR /* return */
.end

댓글 없음:

댓글 쓰기