Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Discussion Groups

Discussion Groups | Analog Devices DSPs | 'C' Routine from 'ISR' in assembly

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

'C' Routine from 'ISR' in assembly - lsborba - Mar 16 15:20:00 2005





Hello,

At first i wish to thank all people who help on my first problem.
I´m writing this mail because i finally compile my program, but it
i found another problem.
I´m working with an assembly program and calling a subroutine
in 'C'. When i call the 'C' routine it works fine, but when i return
to the assembly program, something strange happens.
As i use a "isr", after the first execution of my "isr" the
interruption does not work right. I looked at the disassembly window
and i note that the code of INT1_ADDR was changed!! It used to jump
to "PWMSync_ISR" (address 0x0000A1), but after the first execution
the line was changed for "simidle" (address 0x0000A1). Some one know
what is it?
Evereything says the 'C' routine is modifying the stack somewhere.
But, how could i prevent that? There is a way to save that stack
before and restore it after de 'C' routine?
I´m using a ADSP 21992. I foud some olds messages saying that´s
not recommendable work with 'C' from a isr in assembly, but i really
need to do this.

Thanks,
Leandro Borba




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

Re: 'C' Routine from 'ISR' in assembly - Steve Holle - Mar 17 10:54:00 2005

Are you sure you are pushing and popping any registers that are not marked
as "scratch" in the "C++ Compiler and Library Manual?"

At 12:20 PM 3/16/2005, lsborba wrote:
>Hello,
>
> At first i wish to thank all people who help on my first problem.
> I´m writing this mail because i finally compile my program, but it
>i found another problem.
> I´m working with an assembly program and calling a subroutine
>in 'C'. When i call the 'C' routine it works fine, but when i return
>to the assembly program, something strange happens.
> As i use a "isr", after the first execution of my "isr" the
>interruption does not work right. I looked at the disassembly window
>and i note that the code of INT1_ADDR was changed!! It used to jump
>to "PWMSync_ISR" (address 0x0000A1), but after the first execution
>the line was changed for "simidle" (address 0x0000A1). Some one know
>what is it?
> Evereything says the 'C' routine is modifying the stack somewhere.
>But, how could i prevent that? There is a way to save that stack
>before and restore it after de 'C' routine?
> I´m using a ADSP 21992. I foud some olds messages saying that´s
>not recommendable work with 'C' from a isr in assembly, but i really
>need to do this.
>
>Thanks,
>Leandro Borba
Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101




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

Re: 'C' Routine from 'ISR' in assembly - Jaime Andres Aranguren Cardona - Mar 17 13:59:00 2005

Hi,

As you really need to do it this way, my only advice
is that you read very thoroughly the C/C++ Compiler
and Library Manual, and get a relly good understanding
of the C runtime environment, to fin out what does the
C compiler do to things (stack for example).

Regards,

JaaC --- lsborba <> wrote: >
> Hello,
>
> At first i wish to thank all people who help on my
> first problem.
> I´m writing this mail because i finally compile my
> program, but it
> i found another problem.
> I´m working with an assembly program and calling a
> subroutine
> in 'C'. When i call the 'C' routine it works fine,
> but when i return
> to the assembly program, something strange happens.
> As i use a "isr", after the first execution of my
> "isr" the
> interruption does not work right. I looked at the
> disassembly window
> and i note that the code of INT1_ADDR was changed!!
> It used to jump
> to "PWMSync_ISR" (address 0x0000A1), but after the
> first execution
> the line was changed for "simidle" (address
> 0x0000A1). Some one know
> what is it?
> Evereything says the 'C' routine is modifying the
> stack somewhere.
> But, how could i prevent that? There is a way to
> save that stack
> before and restore it after de 'C' routine?
> I´m using a ADSP 21992. I foud some olds messages
> saying that´s
> not recommendable work with 'C' from a isr in
> assembly, but i really
> need to do this.
>
> Thanks,
> Leandro Borba Jaime Andrés Aranguren Cardona

__________________________________________________
">http://mail.yahoo.com





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

RE: 'C' Routine from 'ISR' in assembly - Brett George - Mar 18 11:34:00 2005


> -----Original Message-----
> From: lsborba [mailto:]
>
> Hello,
>
> At first i wish to thank all people who help on my first problem.
> I´m writing this mail because i finally compile my program, but it
> i found another problem.
> I´m working with an assembly program and calling a subroutine
> in 'C'. When i call the 'C' routine it works fine, but when i return
> to the assembly program, something strange happens.
> As i use a "isr", after the first execution of my "isr" the
> interruption does not work right. I looked at the disassembly window
> and i note that the code of INT1_ADDR was changed!! It used to jump
> to "PWMSync_ISR" (address 0x0000A1), but after the first execution
> the line was changed for "simidle" (address 0x0000A1). Some one know
> what is it?
> Evereything says the 'C' routine is modifying the stack somewhere.
> But, how could i prevent that? There is a way to save that stack
> before and restore it after de 'C' routine?
> I´m using a ADSP 21992. I foud some olds messages saying that´s
> not recommendable work with 'C' from a isr in assembly, but i really
> need to do this.
>
> Thanks,
> Leandro Borba

Calling C functions from asm ISRs is not difficult. Just make sure that you
preserve the scratch registers across the c-call. The compiler will handle
all the other registers.

Brett.

============
Brett George -
Software Engineering Manager
DEQX Pty/Ltd - www.deqx.com




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