We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Good day,
I would like to use an existing function with assembly code in a C program.
Unfortunately I don't know the exact syntax for this.
Of course, I also searched for it on the Internet (I probably didn't use the right search terms):
I found: “You have to read the documentation”.
I did that too and found:
1. at: https://developer.arm.com/documentation/101655/0961/Cx51-User-s-Guide/Compiling-Programs/Directives/Reference/ENDASM-Compiler-Directive?lang=en
The example:
extern void test(); void main (void) { test(); #pragma asm JMP$; endless loop #pragma endasm }
but it's not understandable to me.
If I in my C program
#pragma asm JMP$; endless loop #pragma endasm
insert,
I get the following error message:
lcd_at89C51_2.c(113): error C272: 'asm/endasm' requires src-control to be active
lcd_at89C51_2.c(115): error C272: 'asm/endasm' requires src-control to be active
Of course I have completed this point (it is the default)
None. µVision 1. Right click on the file in the Project Window — Files tab 2. Choose Options for... to open Options — Properties page 3. Enable Generate Assembler SRC file 4. Enable Assemble SRC file.
I understand the example shown to be the assembler code of an external file (extern void test ();) ?
If so, what should this file look like and with what ending (file.?)
2. at: https://developer.arm.com/documentation/dui0375/g/Compiler-specific-Features/--asm
This post doesn't help me either.
It seems to be possible that you can insert assembly code into a C program and compile it, but it would be nice for me if I could do this in a working example.
Kind Regards
Juergen B.