C中调用汇编,要把汇编定义为全局的,加.global
C内嵌汇编
__asm__(
:汇编语句部分
:输出部分
:输入部分
:破坏描述部分
);
用C内嵌汇编的方式:实现LED的点亮
//#define GPBCON (volatile unsigned long*)0x56000010//#define GPBDAT (volatile unsigned long*)0x56000014#define GPBCON 0x56000010#define GPBDAT 0x56000014int gboot_main(){ //*(GPBCON) = 0x400 //*(GPBDAT) = 0x0; __asm__( "ldr r1, =0x15400\n" "str r1,[%0]\n" "ldr r1, =0x6bf\n" "str r1, [%1]\n" : :"r"(GPBCON),"r"(GPBDAT) :"r1" );