EmbeddedRelated.com
Forums

crossworks assembler + c

Started by Paul Curtis December 13, 2005
> ti has a nice FIR filter function (slaa228)in assembler which I would
> like call from C. I use crossworks. How can I include the assembler
> routine and call it from C?

Hi,

Use the CrossWorks documentation. Perhaps a lost art, but there you go.
The TI stuff is intended for assembly code use only, it isn't C
callable. Therefore you will require the application of organic matter
to make it work for you.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

Beginning Microcontrollers with the MSP430

Hi Paul,

in the documentation is only descriped how a function call uses the
register and how you can access c variables from assembler (_var), but
I dont know how to include the assembler code into the application and
how it is located. I know that I have to adjust the ti application,
but first I have to know how I can combine C with assembler. I you
have a sample project which shows how to do it, I would rly apprecite
that.

I would like have something like, if this makes sense:

assembler code
_c_array_parameter[]
####
####
_c_arrey_result[] <- results
ret

c-code
void fir-function(c_array_parameter)
{
call assembler-fir();
return _c_array_results;
}
Hi,

You include assembly language code in the application, add the .asm file
in the project. There is extensive documentation on the assembler in
CrossWorks and extensive information on the calling and naming
conventions that CrossWorks uses in the documentation. In short, you
should start reading the documentation.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors
I did read the documentation. there is a section named "assembly
language interface". there is described how variables a stored in
registers, the given examples only show some distribution over the
register.

I could include the asm file and it was compiled. but how can I
actually call a ass. function from C? Do I have just call a ass. label
within C as function? Could not find this in the docs.

hope i didn't bother you to much.
C file:

void P(void);

void main(void)
{
P();
}

Assembly file:

_P::
ret

From this you should be able to work out the rest.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors
thx for the fast replay, this was what I was missing, I try it out.
Geez, all you top posting guys... Anyway. It is also useful to look at
the example .asm code included with CrossWorks. Especially the startup
code, they have a number of features that you would normally implement
yourself already included and waiting for the proper defines.

In assembly if you put a _ before the function name that allows 'C' to
call it. And if you want to call a 'C' function from assembly you
address it with a '_' before it.

The CrossWorks documentation is extensive, but there may not be a gook
'skeleton' .asm example in there. Look at the example code included for
that.

Brian