/******************************************************************************************************************
参考:
说明:这个是存到一个变量中,以后再补充一个返回值保存到指针中的。
******************************************************************************************************************/
- //startup.s
- AREA asmfile, CODE, READONLY
- EXPORT asmSum1
- IMPORT Main
- ENTRY
- START
- b Main
- asmSum1
- add r0, r0, r1
- over
- mov pc, lr
- END
- //main.c
- #include <stdio.h>
- extern int asmSum1(int src, int dest);
- int Main()
- {
- int s = 2;
- int d = 3;
- int c = asmSum1(s, d);
- //see c
- return 0;
- }
- //main.c
- #include <stdio.h>
- extern int asmSum1(int src, int dest,int* san);
- int Main()
- {
- int s = 2;
- int d = 3;
- int psum[1];
- int c = (int)psum;
- asmSum1(s, d, psum);
- //see c
- return 0;
- }
- @@startup.s
- AREA asmfile, CODE, READONLY
- EXPORT asmSum1
- IMPORT Main
- ENTRY
- START
- b Main
- asmSum1
- add r0, r0, r1
- str r0, [r2]
- over
- mov pc, lr
- END