Hi, We are trying to call a 'C' function from assembly code and are not terribly successful (i.e won't assemble). Does anyone know how this is done or know of any links to example(s) of how this is done? We are using Keil RealView compiler as well as the ARMASM assembler.
Thanks in advance, Glenn
The methods to do this are pretty much the same for all C compilers in the worlds:
1) You got documentation. Use it!
2) If that fails: "Use the source, Luke". The C compiler obviously knows how to call C functions. So an assembler listing (or disassembly) of compiled code will show you how it's done.
Thanks for the response. More specifically, how can an assembly language program gain access to a C functions address? Have tried the EXPORT directive (but compiler complains), tried the "--asm" compiler switch but again the compiler complains, used the underscore naming convention, but the assembler complains. As far as parameter passing and such yes, creating a small 'C' program that calls this function and looking at the disassembly is the way to go. Maybe I could save the disassembly somehow (can't find a PRAGMA statement to do this). It seems as though it should be in the docs, I just haven't seen it.
You select Generate C Compiler listing from the Flash / Configure Flash Tools / listing page of uv3 screen. (It is probably already selected) then look at the .txt file generated.
You need to use IMPORT in your assembly program, not EXPORT from C.
It is in the Docs.
Yes - functions are automatically "Public" in 'C' - so there is no way (and no need of a way) to "export" them.
The only thing you can do it to make them "Private" if you don't want them to be "Public"...
Thanks everyone.