EmbeddedRelated.com
Forums

keil compiler

Started by ishita May 31, 2006
Hi everybody!
How to implement assembly instructions using Keil compiler?
Best regards,
Ishita

ishita wrote:
> Hi everybody! > How to implement assembly instructions using Keil compiler? > Best regards, > Ishita
Read your Keil documentation or ask Keil, they are very helpfull.
ishita wrote:
> Hi everybody! > How to implement assembly instructions using Keil compiler? > Best regards, > Ishita
Read your Keil documentation or ask Keil, they are very helpfull.
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.



typhon62 wrote:
> ishita wrote: > > Hi everybody! > > How to implement assembly instructions using Keil compiler? > > Best regards, > > Ishita > > Read your Keil documentation or ask Keil, they are very helpfull.
"ishita" <aparna247@gmail.com> wrote in message
news:1149085381.017972.107220@i40g2000cwc.googlegroups.com...
> > 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. > >
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
"Dejan" <dejan@removethis.dilogic.hr> wrote in message 
news:e5kd84$fvn$1@ss408.t-com.hr...
> "ishita" <aparna247@gmail.com> wrote in message > news:1149085381.017972.107220@i40g2000cwc.googlegroups.com... >> >> 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. >> >> > > 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
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. http://www.FreeRTOS.org *Now for ARM CORTEX M3!*
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:
> "Dejan" <dejan@removethis.dilogic.hr> wrote in message > news:e5kd84$fvn$1@ss408.t-com.hr... > > "ishita" <aparna247@gmail.com> wrote in message > > news:1149085381.017972.107220@i40g2000cwc.googlegroups.com... > >> > >> 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. > >> > >> > > > > 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 > > 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. > > http://www.FreeRTOS.org > *Now for ARM CORTEX M3!*
"Richard" <nospam@thanks.com> wrote in message
news:0Tifg.78821$wl.34308@text.news.blueyonder.co.uk...
> 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. > > http://www.FreeRTOS.org > *Now for ARM CORTEX M3!* > >
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
On 31 May 2006 04:50:13 -0700, "ishita" <aparna247@gmail.com> wrote:

>How to implement assembly instructions using Keil compiler?
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
In article <e5olhs$rfh$1@ss408.t-com.hr>, Dejan
<dejan@removethis.dilogic.hr> writes
>Oops - I assumed OP is talking about Keil C51 compiler - that one has no >in-line asm capabilities.
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).