inline Assembly - How To ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

inline Assembly - How To ?

1,136 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by behzat_c on Tue May 24 04:29:45 MST 2011
Hey Everyone!

Is there any tutorial or example cod snippet where i can look up for how to embed assembly code in to C program.

I know that there is an asm(" ... ") function to that but i mean how can i access a variable or array element defined in C within that assembly program?

Also,

is there any special instruction set for NXP series or just the classic Cortex M3 instruction set apply here?
0 Kudos
6 Replies

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue May 24 10:27:48 MST 2011
I realize that the post I referred you to does not actually answer your question.  But it does show how to use a separate assembly file that is callable from C.

Now you need to work on the accessing a variable or array element part.

Sorry I can't be of more help with that.

Larry
0 Kudos

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue May 24 09:50:27 MST 2011

Quote: behzat_c


I also waiting for someone to tell how can i access the variables declared in C from assembly.


This is a good place to start:

http://www.ethernut.de/en/documents/arm-inline-asm.html
0 Kudos

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Tue May 24 09:49:43 MST 2011

Quote: behzat_c

Is there any tutorial or example cod snippet where i can look up for how to embed assembly code in to C program.



There are quite a few previous posts about using assembly within LPCXpresso. As a starting point try....

http://lmgtfy.com/?q=assembly+site%3Aknowledgebase.nxp.com

HTH!
0 Kudos

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue May 24 09:45:54 MST 2011
behzat_c,

I'm curious to know why you need inline assembler?

Also this post has an example for the LPC1343 that you can get ideas from:

http://knowledgebase.nxp.com/showpost.php?p=369&postcount=11

Larry
0 Kudos

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by behzat_c on Tue May 24 09:40:17 MST 2011

Quote: larryvc
To my knowledge there are no special instructions.  I'm assuming you are still talking about an LPC1769, the Cortex M3 instruction set does apply.



Yes, I'm still talking about LPC1769. Thanks for the info.

I also waiting for someone to tell how can i access the variables declared in C from assembly.
0 Kudos

969 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue May 24 09:30:47 MST 2011

Quote: behzat_c

is there any special instruction set for NXP series or just the classic Cortex M3 instruction set apply here?



To my knowledge there are no special instructions.  I'm assuming you are still talking about an LPC1769, the Cortex M3 instruction set does apply.
0 Kudos