Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).
|
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 |
|
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 |
|
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 |
|
> -----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 |