Reply by Jan Humpl November 3, 20052005-11-03
I had been used CodeWarrior Development Studio R7.0 (I'm sorry for
mistake, 5.6.1.1658 is version of IDE only) so I update to R7.2 and
nothing has changed.

JkH. John Breitenbach napsal(a):

> You should upgrade your version of CodeWarrior to one of the newer
> versions. There were many problems with the interrupt #pragma's in
> earlier versions.
>
> - John Breitenbach
> - Atlantex Corp.
> - (201) 664-3445
> - john@john...
>
> "Quote me as saying I was misquoted" - Groucho Marx > Jan Humpl wrote:
>
>> But I don't want "save all", i need just save registers, which are used
>> in isr. CW help says about "#pragma interrupt" (without parameters): "In
>> this mode, the routine preserves register values by saving and restoring
>> the registers that are used by the routine." But it doesn't.
>>
>> Thanks
>>
>> JkH
>>
>>
>> sankar murmu napsal(a):
>> > Please modify your function as below. This will help you for details
>> > about #pragma please gothrough the help available in Codewarrior.
>> >
>> >
>> > spi_receive_test()
>> > {
>> > #pragma interrupt save all
>> >
>> > /************* interrupt handling - begin *************/
>> > asm{lea (SP)+} /* stack pointer incremented */
>> > asm{move X:<$fffb, X0} /* move IPR reg. (Interrupt Priority
>> > Register) to X0 */
>> > asm{move X0, X:(SP)} /* save IPR reg. to stack
>> >
>> >
>> >
>> > Regards,
>> > Sankar
>> > On Thu, 27 Oct 2005 Jan Humpl wrote :
>> > >Hi! I've urgent problem with "#pragma interrupt" directive
>> compilation.
>> > >Although compiled function uses Y0 register compiler don't save
>> it. Can
>> > >anyone explain this? And can you suggest how to solve / bypass this
>> > >problem? I wouldn't like to disassemble every isr and check if all
>> > >registers are saved everytime i change isr code. And also i wouldn't
>> > >like use "saveall" parameter. Thanks.
>> > >
>> > >Source code of isr and dissasemling are attached.
>> > >
>> > >I use CW IDE 5.6.1.1658 and 56F801 cpu.
>> > >
>> > >Thanks.
>> > >
>> > >JkH.
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >Address ObjectCode Label Opcode
>> Operands > Comment
>> > >
>> > >0x00000000 Fspi_receive_test:
>> > >0x00000000 0xDE0B lea (SP)+
>> > >0x00000001 0xD00B move X0,X:(SP)+
>> > >0x00000002 0xD80B move R0,X:(SP)+
>> > >0x00000003 0xD48B move M01,X:(SP)+
>> > >0x00000004 0xD89F move OMR,X:(SP)
>> > >0x00000005 0x87CCFFFF movei #-1,M01
>> > >0x00000007 0x81D80020 bfclr #0x20,OMR
>> > >0x00000009 0x83D80100 bfset #0x100,OMR
>> > >0x0000000B 0x81D80010 bfclr #0x10,OMR
>> > >0x0000000D 0xDE0B lea (SP)+
>> > >0x0000000E 0xB07B movep X:0xfffb,X0
>> > >0x0000000F 0xD01F move X0,X:(SP)
>> > >0x00000010 0xA1FBFC00 bfclr #0xfc00,X:0xfffb
>> > >0x00000012 0x83DD0100 bfset #0x100,SR
>> > >0x00000014 0x81DD0200 bfclr #0x200,SR
>> > >0x00000016 0xF0540F22 move X:0x0f22,X0
>> > >0x00000018 0xF8540000 move X:0x0000,R0
>> > >0x0000001A 0xE040 nop
>> > >0x0000001B 0xD0400000 move X0,X:(R0+0x0000)
>> > >0x0000001D 0x88F400000020 bftstl #0x20,X:0x0000
>> > >0x00000020 0xA108 bcs *+9 ;
>> 0x000029
>> > >0x00000021 0xF8540000 move X:0x0000,R0
>> > >0x00000023 0xE040 nop
>> > >0x00000024 0xF0400000 move X:(R0+0x0000),X0
>> > >0x00000026 0xD0540F23 move X0,X:0x0f23
>> > >0x00000028 0xA903 bra *+4 ;
>> 0x00002c
>> > >0x00000029 0x86F40F230080 movei #128,X:0x0f23
>> > >0x0000002C 0xFE540000 tstw X:0x0000
>> > >0x0000002E 0xA203 bne *+4 ;
>> 0x000032
>> > >0x0000002F 0x86F400000000 movei #0,X:0x0000
>> > >0x00000032 0x86F400000000 movei #0,X:0x0000
>> > >0x00000035 0x4EB40000 incw X:0x0000
>> > >0x00000037 0xF1540000 move X:0x0000,Y0
>> > >0x00000039 0x7E37 lsr Y0
>> > >0x0000003A 0xF0540000 move X:0x0000,X0
>> > >0x0000003C 0x7C51 cmp Y0,X0
>> > >0x0000003D 0xAD07 bls *+8 ;
>> 0x000045
>> > >0x0000003E 0xF1540000 move X:0x0000,Y0
>> > >0x00000040 0x7E37 lsr Y0
>> > >0x00000041 0xF0540000 move X:0x0000,X0
>> > >0x00000043 0x7C51 cmp Y0,X0
>> > >0x00000044 0xA005 bcc FSpiPosition+69348762 ;
>> > 0x00004a
>> > >0x00000045 0x87C00068 movei #104,X0
>> > >0x00000047 0x5E740000 cmp X:0x0000,X0
>> > >0x00000049 0xAC09 bhi *+10 ;
>> > 0x000053
>> > >0x0000004A 0x80F40F200002 bfclr #0x2,X:0x0f20
>> > >0x0000004D 0x82F400000080 bfset #0x80,X:0x0000
>> > >0x00000050 0x86F40D5DFFFF movei #-1,X:0x0d5d
>> > >0x00000053 0xF01B move X:(SP)-,X0
>> > >0x00000054 0x907B movep X0,X:0xfffb
>> > >0x00000055 0xE040 nop
>> > >0x00000056 0xF89B move X:(SP)-,OMR
>> > >0x00000057 0xF49B move X:(SP)-,M01
>> > >0x00000058 0xF81B move X:(SP)-,R0
>> > >0x00000059 0xF01B move X:(SP)-,X0
>> > >0x0000005A 0xEDD9 rti
>> > >...
>> > >
>> > >UWord16 SPDRR:0x0F22;
>> > >UWord16 SPDTR:0x0F23;
>> > >
>> > >...
>> > >
>> > >#pragma interrupt
>> > >spi_receive_test()
>> > >{
>> > >/************* interrupt handling - begin *************/
>> > > asm{lea (SP)+} /* stack pointer incremented */
>> > > asm{move X:<$fffb, X0} /* move IPR reg. (Interrupt Priority
>> > Register) to X0 */
>> > > asm{move X0, X:(SP)} /* save IPR reg. to stack */
>> > >
>> > > /* disable channels 0-5 in IPR reg.*/
>> > > asm{andc #$03FF,X:$FFFB};
>> > >
>> > > /* enable interrupts in SR register */
>> > > archEnableInt();
>> > >/************* interrupt handling - end *************/
>> > >
>> > > SpiRxBuffer[SpiPosition] = SPDRR;
>> > >
>> > > if (SpiReg & SPISNDRDY) {
>> > > SPDTR = SpiTxBuffer[SpiPosition];
>> > > }
>> > > else {
>> > > SPDTR = COM_ERR_NDA;
>> > > }
>> > >
>> > > if (SpiPosition == 0) {
>> > > SpiTimer = 0;
>> > > }
>> > > SpiTimer2 = 0;
>> > >
>> > > SpiPosition++;
>> > >
>> > > if (((SpiPosition > (SpiTxLength >> 1)) && (SpiPosition >=
>> > (SpiRxLength >> 1))) || (SpiPosition >= C_SPI_BUFFER_LENGTH)) {
>> > > asm{andc #$FFFD,X:$0F20}; // spi disable
>> > > SpiReg |= SPIHWSTOP;
>> > > asm{movec #$FFFF,X:$0D5D}; // force timerC3 interrupt :)
>> > > }
>> > >
>> > >/************* interrupt handling - begin *************/
>> > > /* restore IPR reg. and stack pointer */
>> > > asm{move X:(SP)-, X0} /* moves saved IPR from stack to X0 and
>> > decrements SP */
>> > > asm{move X0, X:<$fffb} /* IPR restoring */
>> > >/************* interrupt handling - end *************/
>> > >}
>> > >
>> > >...
>> >
>> >



Reply by Jan Humpl October 31, 20052005-10-31
But I don't want "save all", i need just save registers, which are used
in isr. CW help says about "#pragma interrupt" (without parameters): "In
this mode, the routine preserves register values by saving and restoring
the registers that are used by the routine." But it doesn't.

Thanks

JkH sankar murmu napsal(a):
> Please modify your function as below. This will help you for details
> about #pragma please gothrough the help available in Codewarrior. > spi_receive_test()
> {
> #pragma interrupt save all
>
> /************* interrupt handling - begin *************/
> asm{lea (SP)+} /* stack pointer incremented */
> asm{move X:<$fffb, X0} /* move IPR reg. (Interrupt Priority
> Register) to X0 */
> asm{move X0, X:(SP)} /* save IPR reg. to stack >
> Regards,
> Sankar
> On Thu, 27 Oct 2005 Jan Humpl wrote :
> >Hi! I've urgent problem with "#pragma interrupt" directive compilation.
> >Although compiled function uses Y0 register compiler don't save it. Can
> >anyone explain this? And can you suggest how to solve / bypass this
> >problem? I wouldn't like to disassemble every isr and check if all
> >registers are saved everytime i change isr code. And also i wouldn't
> >like use "saveall" parameter. Thanks.
> >
> >Source code of isr and dissasemling are attached.
> >
> >I use CW IDE 5.6.1.1658 and 56F801 cpu.
> >
> >Thanks.
> >
> >JkH.
> >
> >
> >
> >
> >
> >
> >
> >
> >Address ObjectCode Label Opcode Operands
> Comment
> >
> >0x00000000 Fspi_receive_test:
> >0x00000000 0xDE0B lea (SP)+
> >0x00000001 0xD00B move X0,X:(SP)+
> >0x00000002 0xD80B move R0,X:(SP)+
> >0x00000003 0xD48B move M01,X:(SP)+
> >0x00000004 0xD89F move OMR,X:(SP)
> >0x00000005 0x87CCFFFF movei #-1,M01
> >0x00000007 0x81D80020 bfclr #0x20,OMR
> >0x00000009 0x83D80100 bfset #0x100,OMR
> >0x0000000B 0x81D80010 bfclr #0x10,OMR
> >0x0000000D 0xDE0B lea (SP)+
> >0x0000000E 0xB07B movep X:0xfffb,X0
> >0x0000000F 0xD01F move X0,X:(SP)
> >0x00000010 0xA1FBFC00 bfclr #0xfc00,X:0xfffb
> >0x00000012 0x83DD0100 bfset #0x100,SR
> >0x00000014 0x81DD0200 bfclr #0x200,SR
> >0x00000016 0xF0540F22 move X:0x0f22,X0
> >0x00000018 0xF8540000 move X:0x0000,R0
> >0x0000001A 0xE040 nop
> >0x0000001B 0xD0400000 move X0,X:(R0+0x0000)
> >0x0000001D 0x88F400000020 bftstl #0x20,X:0x0000
> >0x00000020 0xA108 bcs *+9 ; 0x000029
> >0x00000021 0xF8540000 move X:0x0000,R0
> >0x00000023 0xE040 nop
> >0x00000024 0xF0400000 move X:(R0+0x0000),X0
> >0x00000026 0xD0540F23 move X0,X:0x0f23
> >0x00000028 0xA903 bra *+4 ; 0x00002c
> >0x00000029 0x86F40F230080 movei #128,X:0x0f23
> >0x0000002C 0xFE540000 tstw X:0x0000
> >0x0000002E 0xA203 bne *+4 ; 0x000032
> >0x0000002F 0x86F400000000 movei #0,X:0x0000
> >0x00000032 0x86F400000000 movei #0,X:0x0000
> >0x00000035 0x4EB40000 incw X:0x0000
> >0x00000037 0xF1540000 move X:0x0000,Y0
> >0x00000039 0x7E37 lsr Y0
> >0x0000003A 0xF0540000 move X:0x0000,X0
> >0x0000003C 0x7C51 cmp Y0,X0
> >0x0000003D 0xAD07 bls *+8 ; 0x000045
> >0x0000003E 0xF1540000 move X:0x0000,Y0
> >0x00000040 0x7E37 lsr Y0
> >0x00000041 0xF0540000 move X:0x0000,X0
> >0x00000043 0x7C51 cmp Y0,X0
> >0x00000044 0xA005 bcc FSpiPosition+69348762 ;
> 0x00004a
> >0x00000045 0x87C00068 movei #104,X0
> >0x00000047 0x5E740000 cmp X:0x0000,X0
> >0x00000049 0xAC09 bhi *+10 ;
> 0x000053
> >0x0000004A 0x80F40F200002 bfclr #0x2,X:0x0f20
> >0x0000004D 0x82F400000080 bfset #0x80,X:0x0000
> >0x00000050 0x86F40D5DFFFF movei #-1,X:0x0d5d
> >0x00000053 0xF01B move X:(SP)-,X0
> >0x00000054 0x907B movep X0,X:0xfffb
> >0x00000055 0xE040 nop
> >0x00000056 0xF89B move X:(SP)-,OMR
> >0x00000057 0xF49B move X:(SP)-,M01
> >0x00000058 0xF81B move X:(SP)-,R0
> >0x00000059 0xF01B move X:(SP)-,X0
> >0x0000005A 0xEDD9 rti
> >...
> >
> >UWord16 SPDRR:0x0F22;
> >UWord16 SPDTR:0x0F23;
> >
> >...
> >
> >#pragma interrupt
> >spi_receive_test()
> >{
> >/************* interrupt handling - begin *************/
> > asm{lea (SP)+} /* stack pointer incremented */
> > asm{move X:<$fffb, X0} /* move IPR reg. (Interrupt Priority
> Register) to X0 */
> > asm{move X0, X:(SP)} /* save IPR reg. to stack */
> >
> > /* disable channels 0-5 in IPR reg.*/
> > asm{andc #$03FF,X:$FFFB};
> >
> > /* enable interrupts in SR register */
> > archEnableInt();
> >/************* interrupt handling - end *************/
> >
> > SpiRxBuffer[SpiPosition] = SPDRR;
> >
> > if (SpiReg & SPISNDRDY) {
> > SPDTR = SpiTxBuffer[SpiPosition];
> > }
> > else {
> > SPDTR = COM_ERR_NDA;
> > }
> >
> > if (SpiPosition == 0) {
> > SpiTimer = 0;
> > }
> > SpiTimer2 = 0;
> >
> > SpiPosition++;
> >
> > if (((SpiPosition > (SpiTxLength >> 1)) && (SpiPosition >=
> (SpiRxLength >> 1))) || (SpiPosition >= C_SPI_BUFFER_LENGTH)) {
> > asm{andc #$FFFD,X:$0F20}; // spi disable
> > SpiReg |= SPIHWSTOP;
> > asm{movec #$FFFF,X:$0D5D}; // force timerC3 interrupt :)
> > }
> >
> >/************* interrupt handling - begin *************/
> > /* restore IPR reg. and stack pointer */
> > asm{move X:(SP)-, X0} /* moves saved IPR from stack to X0 and
> decrements SP */
> > asm{move X0, X:<$fffb} /* IPR restoring */
> >/************* interrupt handling - end *************/
> >}
> >
> >...


Reply by sankar murmu October 28, 20052005-10-28

Please modify your function as below. This will help you for details about #pragma please gothrough the help available in Codewarrior. spi_receive_test()
{
#pragma interrupt save all

/************* interrupt handling  - begin *************/
    asm{lea (SP)+}            /* stack pointer incremented */
    asm{move X:<$fffb, X0}     /* move IPR reg. (Interrupt Priority Register) to X0 */
    asm{move X0, X:(SP)}       /* save IPR reg. to stack
Regards,
Sankar
On Thu, 27 Oct 2005 Jan Humpl wrote :
>Hi! I've urgent problem with "#pragma interrupt" directive compilation.
>Although compiled function uses Y0 register compiler don't save it. Can
>anyone explain this? And can you suggest how to solve / bypass this
>problem? I wouldn't like to disassemble every isr and check if all
>registers are saved everytime i change isr code. And also i wouldn't
>like use "saveall" parameter. Thanks.
>
>Source code of isr and dissasemling are attached.
>
>I use CW IDE 5.6.1.1658 and 56F801 cpu.
>
>Thanks.
>
>JkH. >------------------------ Yahoo! Groups Sponsor --------------------~-->
>Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
>http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/PNArlB/TM
>--------------------------------~- >
><*> To visit your group on the web, go to:
>    http://groups.yahoo.com/group/motoroladsp/
>
><*> To unsubscribe from this group, send an email to:
>    m...@yahoogroups.com
>
><*>
>
>Address    ObjectCode      Label  Opcode  Operands                    Comment
>
>0x00000000                  Fspi_receive_test:
>0x00000000  0xDE0B                lea      (SP)+
>0x00000001  0xD00B                move    X0,X:(SP)+
>0x00000002  0xD80B                move    R0,X:(SP)+
>0x00000003  0xD48B                move    M01,X:(SP)+
>0x00000004  0xD89F                move    OMR,X:(SP)
>0x00000005  0x87CCFFFF            movei    #-1,M01
>0x00000007  0x81D80020            bfclr    #0x20,OMR
>0x00000009  0x83D80100            bfset    #0x100,OMR
>0x0000000B  0x81D80010            bfclr    #0x10,OMR
>0x0000000D  0xDE0B                lea      (SP)+
>0x0000000E  0xB07B                movep    X:0xfffb,X0
>0x0000000F  0xD01F                move    X0,X:(SP)
>0x00000010  0xA1FBFC00            bfclr    #0xfc00,X:0xfffb
>0x00000012  0x83DD0100            bfset    #0x100,SR
>0x00000014  0x81DD0200            bfclr    #0x200,SR
>0x00000016  0xF0540F22            move    X:0x0f22,X0
>0x00000018  0xF8540000            move    X:0x0000,R0
>0x0000001A  0xE040                nop
>0x0000001B  0xD0400000            move    X0,X:(R0+0x0000)
>0x0000001D  0x88F400000020        bftstl  #0x20,X:0x0000
>0x00000020  0xA108                bcs      *+9                  ; 0x000029
>0x00000021  0xF8540000            move    X:0x0000,R0
>0x00000023  0xE040                nop
>0x00000024  0xF0400000            move    X:(R0+0x0000),X0
>0x00000026  0xD0540F23            move    X0,X:0x0f23
>0x00000028  0xA903                bra      *+4                  ; 0x00002c
>0x00000029  0x86F40F230080        movei    #128,X:0x0f23
>0x0000002C  0xFE540000            tstw    X:0x0000
>0x0000002E  0xA203                bne      *+4                  ; 0x000032
>0x0000002F  0x86F400000000        movei    #0,X:0x0000
>0x00000032  0x86F400000000        movei    #0,X:0x0000
>0x00000035  0x4EB40000            incw    X:0x0000
>0x00000037  0xF1540000            move    X:0x0000,Y0
>0x00000039  0x7E37                lsr      Y0
>0x0000003A  0xF0540000            move    X:0x0000,X0
>0x0000003C  0x7C51                cmp      Y0,X0
>0x0000003D  0xAD07                bls      *+8                  ; 0x000045
>0x0000003E  0xF1540000            move    X:0x0000,Y0
>0x00000040  0x7E37                lsr      Y0
>0x00000041  0xF0540000            move    X:0x0000,X0
>0x00000043  0x7C51                cmp      Y0,X0
>0x00000044  0xA005                bcc      FSpiPosition+69348762  ; 0x00004a
>0x00000045  0x87C00068            movei    #104,X0
>0x00000047  0x5E740000            cmp      X:0x0000,X0
>0x00000049  0xAC09                bhi      *+10                  ; 0x000053
>0x0000004A  0x80F40F200002        bfclr    #0x2,X:0x0f20
>0x0000004D  0x82F400000080        bfset    #0x80,X:0x0000
>0x00000050  0x86F40D5DFFFF        movei    #-1,X:0x0d5d
>0x00000053  0xF01B                move    X:(SP)-,X0
>0x00000054  0x907B                movep    X0,X:0xfffb
>0x00000055  0xE040                nop
>0x00000056  0xF89B                move    X:(SP)-,OMR
>0x00000057  0xF49B                move    X:(SP)-,M01
>0x00000058  0xF81B                move    X:(SP)-,R0
>0x00000059  0xF01B                move    X:(SP)-,X0
>0x0000005A  0xEDD9                rti
>...
>
>UWord16 SPDRR:0x0F22;
>UWord16 SPDTR:0x0F23;
>
>...
>
>#pragma interrupt
>spi_receive_test()
>{
>/************* interrupt handling  - begin *************/
>    asm{lea (SP)+}            /* stack pointer incremented */
>    asm{move X:<$fffb, X0}     /* move IPR reg. (Interrupt Priority Register) to X0 */
>    asm{move X0, X:(SP)}       /* save IPR reg. to stack */
>
>    /* disable channels 0-5 in IPR reg.*/
>    asm{andc #$03FF,X:$FFFB};
>
>      /* enable interrupts in SR register */
>    archEnableInt();
>/************* interrupt handling  - end *************/
>
>    SpiRxBuffer[SpiPosition] = SPDRR;
>
>      if (SpiReg & SPISNDRDY) {
>        SPDTR = SpiTxBuffer[SpiPosition];
>      }
>      else {
>          SPDTR = COM_ERR_NDA;
>       }
>
>       if (SpiPosition == 0) {
>         SpiTimer = 0;
>       }
>       SpiTimer2 = 0;
>
>       SpiPosition++;
>
>       if (((SpiPosition > (SpiTxLength >> 1)) && (SpiPosition >= (SpiRxLength >> 1))) || (SpiPosition >= C_SPI_BUFFER_LENGTH)) {
>        asm{andc #$FFFD,X:$0F20}; // spi disable
>        SpiReg |= SPIHWSTOP;
>        asm{movec #$FFFF,X:$0D5D}; // force timerC3 interrupt :)
>       }
>
>/************* interrupt handling  - begin *************/
>    /* restore IPR reg. and stack pointer  */
>    asm{move X:(SP)-, X0}  /* moves saved IPR from stack to X0 and decrements SP */
>    asm{move X0, X:<$fffb}  /* IPR restoring */
>/************* interrupt handling  - end *************/
>}
>
>...



1963059423@Middle5?OAS_query=null&PARTNER=3

Reply by Jan Humpl October 27, 20052005-10-27
Hi! I've urgent problem with "#pragma interrupt" directive compilation.
Although compiled function uses Y0 register compiler don't save it. Can
anyone explain this? And can you suggest how to solve / bypass this
problem? I wouldn't like to disassemble every isr and check if all
registers are saved everytime i change isr code. And also i wouldn't
like use "saveall" parameter. Thanks.

Source code of isr and dissasemling are attached.

I use CW IDE 5.6.1.1658 and 56F801 cpu.

Thanks.

JkH.