keil compiler

Hi everybody! How to implement assembly instructions using Keil compiler? Best regards, Ishita

Reply to
ishita
Loading thread data ...

Read your Keil documentation or ask Keil, they are very helpfull.

Reply to
typhon62

Read your Keil documentation or ask Keil, they are very helpfull.

Reply to
typhon62

I read all available documents. I used #pragma asm & endasm derectives. Also enabled SCR control ooption. But still getting error while compilation. I want to complete the project as early as possible. So if anybody knows please tell me. Best regards.

typh> > Hi everybody!

Reply to
ishita

There's no "#pragma asm" directive in Keil compiler. Also, there's no SCR control option. There's SRC one, though. That one generates source code from you C-code which you can run through ASM. Otherwise, you cannot interleave asm instructions with the C-source.

- Dejan

Reply to
Dejan

My Keil project contains the following line (amongst others) within a C function...

__asm{ ADD LR, LR, #4 };

...but I am using ARM compiler. Don't know what SRC is so suspect your target is different.

Strangely I learned how to do this by reading the manual.

Regards, Richard.

formatting link

*Now for ARM CORTEX M3!*
Reply to
Richard

There are 'asm' and 'endasm' derectives in keil compiler. but for using asm statements that is not sufficient. One option needs to be enabled, which I couldn't find. Best regards.

Richard wrote:

Reply to
ishita

Oops - I assumed OP is talking about Keil C51 compiler - that one has no in-line asm capabilities. Obviously, ARM (and maybe some other) version has...

- Dejan

Reply to
Dejan

Assuming the develoment system includes a separate assembler and a linker, create a separate assembler source file, write your assembler function into it using the C-compiler calling convention.

Run the assembly source file through the asembler.

In the C-file call your function as any other C-function, compile C-program and link with object code generated by assembler.

Paul

Reply to
Paul Keinanen

In article , Dejan writes

You must have a very old version of C51. Every version I've used going back at least 10 years has had #pragma asm and #pragma endasm, albeit the slightly clunky implementation means you need to add an extra build step or simply tick an extra box in the uVision IDE to assemble the output of the compiler - but you can do inline assembler (although I prefer to just put the assembler it its own module).

Reply to
Bob

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.