C 汇编混合编程

As is Known to us,the function Main is the entry point of all programs.Therefore, we are usually neglecting all that we don't do,which makes us not understanding it more clearly.Now there is a sample arm program which will provide something that opration system usually do.

asm:

    IMPORT main
    area test,CODE,READONLY
    ENTRY
    bl start
start
    bl main
C:

#define rGPBCON    (*(volatile unsigned *)0x56000010) //Port B control
#define rGPBDAT    (*(volatile unsigned *)0x56000014) //Port B data
#define rGPBUP     (*(volatile unsigned *)0x56000018) //Pull-up control B
int main(int argc, char *argv[])
{
 unsigned int temp = 0x0e;
 rGPBCON = 0x00555555;
 rGPBUP = 0xffff;
 rGPBDAT = 0XE1F; 
 return 0;
}

The code very sample,but it is very useful.

你可能感兴趣的:(C 汇编混合编程)