DSPRelated.com
Forums

Problem calling C function from assembly pgm in 21369 EZ-kit lite

Started by Unknown April 21, 2007
I have a 21369-based ez-kit lite with a nice audio i/o daughtercard.

I'm using the vendor's assembly program (a basic talk-through routine)
and trying to call a C routine between reading the ADC sample and
writing that sample to the DAC.

The call to the C routine causes the talk-through to not generate any
output. If I comment-out the C routine call the talk-through program
works fine. Visual-DSP reports that the target is running in both
cases.

The vendor claims their assembly program honors reserved registers,
etc.

Any ideas?

TIA,

John

John wrote:
> I have a 21369-based ez-kit lite with a nice audio i/o daughtercard.
Congrats!
> > I'm using the vendor's assembly program (a basic talk-through routine) > and trying to call a C routine between reading the ADC sample and > writing that sample to the DAC. > > The call to the C routine causes the talk-through to not generate any > output. If I comment-out the C routine call the talk-through program > works fine. Visual-DSP reports that the target is running in both > cases. > > The vendor claims their assembly program honors reserved registers, > etc.
Honouring reserved registers is for the opposite, ie. calling an assembly program from a C-project. Doing what you want to do is non- trivial because you have to generate a C-run time environment in assembler (stack, heap, etc). Why not stick to assembler? Many of the 21369 capabilities are lost if you program in C, and the assembler is quite simple to learn. Else, find a C talk through program. Regards, Andor
On Apr 22, 3:17 pm, Andor <andor.bari...@gmail.com> wrote:
> John wrote: > > I have a 21369-based ez-kit lite with a nice audio i/o daughtercard. > > Congrats! > > > > > I'm using the vendor's assembly program (a basic talk-through routine) > > and trying to call a C routine between reading the ADC sample and > > writing that sample to the DAC. > > > The call to the C routine causes the talk-through to not generate any > > output. If I comment-out the C routine call the talk-through program > > works fine. Visual-DSP reports that the target is running in both > > cases. > > > The vendor claims their assembly program honors reserved registers, > > etc. > > Honouring reserved registers is for the opposite, ie. calling an > assembly program from a C-project. Doing what you want to do is non- > trivial because you have to generate a C-run time environment in > assembler (stack, heap, etc). > > Why not stick to assembler? Many of the 21369 capabilities are lost if > you program in C, and the assembler is quite simple to learn. Else, > find a C talk through program. > > Regards, > Andor
Thank you for your reply, Andor. I agree that honoring reserved registers is something usually done for calling assembly routines from a C environment. However, given the difficulty I was experiencing, I was suspecting that the implicit creation of a C environment, required to support the Call, might have actually overwrote registers used by the overall assembly program. Because my signal processing routine is already written in C, I will not try to re-write it in assembler. Instead, I will try to create an encapsulating C program for *all* the code used in the application. Hopefully this will create the necessary environment to support the C- call from the assembly program. Cheers, John
On 23 Apr., 14:03, chili_di...@yahoo.com wrote:
> On Apr 22, 3:17 pm, Andor <andor.bari...@gmail.com> wrote: > > > > > > > John wrote: > > > I have a 21369-based ez-kit lite with a nice audio i/o daughtercard. > > > Congrats! > > > > I'm using the vendor's assembly program (a basic talk-through routine) > > > and trying to call a C routine between reading the ADC sample and > > > writing that sample to the DAC. > > > > The call to the C routine causes the talk-through to not generate any > > > output. If I comment-out the C routine call the talk-through program > > > works fine. Visual-DSP reports that the target is running in both > > > cases. > > > > The vendor claims their assembly program honors reserved registers, > > > etc. > > > Honouring reserved registers is for the opposite, ie. calling an > > assembly program from a C-project. Doing what you want to do is non- > > trivial because you have to generate a C-run time environment in > > assembler (stack, heap, etc). > > > Why not stick to assembler? Many of the 21369 capabilities are lost if > > you program in C, and the assembler is quite simple to learn. Else, > > find a C talk through program. > > > Regards, > > Andor > > Thank you for your reply, Andor. > > I agree that honoring reserved registers is something usually done for > calling assembly routines from a C environment. However, given the > difficulty I was experiencing, I was suspecting that the implicit > creation of a C environment, required to support the Call, might have > actually overwrote registers used by the overall assembly program. > > Because my signal processing routine is already written in C, I will > not try to re-write it in assembler. Instead, I will try to create an > encapsulating C program for *all* the code used in the application.
That certainly is the simplest solution. You can look at the code found in the ...\ADSP-21369 EZ-KIT Lite\Block Based TalkThru (C) directory to get you started. Regards, Andor