标签:
c调用汇编 //main.c #include <stdio.h> extern int myadd(int a, int b); int main(void) { int a = 3; int b = 5; int c; c = myadd(a, b); printf("%d\n", c); return 0; } //myadd.s AREA MYADD, CODE, READONLY ;ENTRY EXPORT myadd myadd ADD R2, R0, R1 MOV R0, R2 MOV R15, R14;MOV PC, LR END -------------------------- 汇编调用c //main.c #include <stdio.h> extern int fun(int a, int b); int add(int a, int b) { return a+b; } int main(void) { int res; int a = 3, b = 5; res = fun(a, b); printf("%d\n", res); return 0; } //fun.s AREA FUN ,CODE, READONLY IMPORT add EXPORT fun fun add r0, r0, #1 add r1, r1, #1 mov r8, r14 bl add mov r5, r0 mov r14, r8 mov pc, r14 end ---------------------------------- 内嵌汇编 //main.c #include <stdio.h> int main(void) { __asm { mrs r5, CPSR bic r5, r5, #0xf orr r5, r5, #0x2 msr CPSR_cxsf, r5 } printf("hello\n"); return 0; }
kermit配置/反汇编/c和汇编混合编程/计算机存储介质/GPIO编程
标签:
原文地址:http://blog.csdn.net/waldmer/article/details/44942285