Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540


Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C54x | How to call c function

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

How to call c function - Atanu Guchhait - Jan 3 12:57:00 2001

Hi,
i have a problem in calling 54x DSPLIB functions from assembly
functions. I want to know that how to call C functions from Assembly
module without main() in the C function.
regards
atanu

----------------------------------------------------------------------------
ATANU GUCHHAIT _/_/_/_/ _/_/_/_/_/ _/_/_/_/
_/ _/ _/ _/
Tel: +91-80-2282715 _/ _/ _/ _/_/_/_/ _/
+91-80-2263399 Ext. 245 _/ _/ _/ _/ _/ _/
235 _/_/_/_/ _/_/_/_/_/ _/_/_/_/ _/
312
Email:
Centre for Development of Telematics
71/1, Sneha Complex,
Miller Road, Bangalore - 560052, INDIA.
----------------------------------------------------------------------------



______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: How to call c function - Herry Sitepu - Jan 6 2:03:00 2001

hi there...
i think the main problem when interfacing c and assembly is the
environment...when we make a program with c and link them all with rts.lib
then boot.obj (which is in the rts.lib) will create the c environment. So
,one of the environment is the CPL bit from ST1 . You can read the full
explanation in CPU and Peripherals Vol 1. Before you can jump from asm
environment to c environment you must set CPL bit and you must reset back
the CPL bit when you want go back to asm environment. One must be
consider, that you must follow the C calling convention (read Optimizing C
Compiler book) and put the first argument in ACC and
put the remain in the stack in the reverse order...
i hope this will help you... On Wed, 3 Jan 2001, Atanu Guchhait wrote:

> Hi,
> i have a problem in calling 54x DSPLIB functions from assembly
> functions. I want to know that how to call C functions from Assembly
> module without main() in the C function.
> regards
> atanu
>
> ----------------------------------------------------------------------------
> ATANU GUCHHAIT _/_/_/_/ _/_/_/_/_/ _/_/_/_/
> _/ _/ _/ _/
> Tel: +91-80-2282715 _/ _/ _/ _/_/_/_/ _/
> +91-80-2263399 Ext. 245 _/ _/ _/ _/ _/ _/
> 235 _/_/_/_/ _/_/_/_/_/ _/_/_/_/ _/
> 312
> Email:
> Centre for Development of Telematics
> 71/1, Sneha Complex,
> Miller Road, Bangalore - 560052, INDIA.
> ---------------------------------------------------------------------------- > To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c54x
>
> Other Groups: http://www.dsprelated.com


______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: How to call c function - Brian C. Lane - Jan 8 17:10:00 2001

On Wed, 3 Jan 2001 17:57:21 +0500 (GMT+0500), you wrote:

>Hi,
>i have a problem in calling 54x DSPLIB functions from assembly
>functions. I want to know that how to call C functions from Assembly
>module without main() in the C function.
>regards
>atanu The details on interfacing 'C' and ASM can be found in the TI
reference docs, but here are a couple of things to remember. Set the
CPL flag to 1 before calling the 'C' routine, and back to 0 when you
return (unless you want it left set to 1).

'C' function names all start with an _ as I am sure you are aware.

If you are doing far calls you need to take this into account, it
changes the position of the variables on the stack by 1 because it
also stores the XPC value for the return.

Even with the docs, I always seem to end up figuring out the stack
by trial and error using the debugger :(

Brian

-----------------------------------------------------
Brian C. Lane Programmer
www.shinemicro.com RF & Microcontroller Design


______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: How to call c function - Brian C. Lane - Jan 9 17:28:00 2001

On Tue, 9 Jan 2001 09:24:13 +0500 (GMT+0500), you wrote:

>Thanks Brian for ur reply. But thing is that if u compile a c-function
>with out main in ccs and then try to link with assembly language with a
>proper .cmd file, it gives the warning that c_int00 is not
>initialized. Morover the mapped file does not contain proper

Ah, I see. You want 'c' code without main. Well, that's possible but
not advised. The 'c' code expects memory to be setup for it by the
c_int00 routine (which is found in the rts.lib library).

I'd just put in a main() function, it will save you alot of trouble
in the long run. But if you really want to avoid this, you can tell
the 'c' compiler to generate and assembly listing from your 'c' code
and then insert it into your project instead.

Also, looking at the source of the rts.lib can be useful. I've
actually modified mine somewhat to work better with expanded memory
addresses.

Brian

-----------------------------------------------------
Brian C. Lane Programmer
www.shinemicro.com RF & Microcontroller Design


______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )