CW7.1 port to CW10.5, general purpose registers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW7.1 port to CW10.5, general purpose registers

962 Views
uCRFun
Contributor I


Our team is in the process of porting a CW7.1 project to CW10.5, however we've not yet been able to successfully get the code up and running completely.  The issue we've encountered is that we continually run into exception errors.  Aside from the exception errors, I'm experiencing an issue which is making if difficult to get to root cause.  The problem is, when I step through the disassembly for a specific assembly function, "setintlevel" in this case, the "d1" register is not passed the value from "d0" on the initial instruction.  In this particular case "d0" contains the expected value.  This is a problem because "d1" is eventually used to update the "SR".  I have experimented with adding a line, just below the "move.l  d0,d1" where "d2" is passed the value from "d0" and that seems to work fine.  For other calls to this function however, I see that "d0" contains garbage on entry to this function.  The question I have is, has anyone seen situations where the general purpose registers are not updated as expected when viewing and stepping through the disassembly code in CW10.5?  When I view and step through disassembly in CW7.1, registers change/update as I expect.

 

 


_setintlevel:
   move.l  d0,d1   ; fetch new level (0-7) passed    
   asl.l   #8,d1        ; shift level into place    
     
.if (HAS_RTXCms&&HAS_GLOBALPPL)
;
;   while switching globalppl level raise to kernel ceiling
;
      move.l  pKWS,a0      ; load address of kernel workspace

      move.w  #SUPVMODE | (RTXC_LEVEL << 8),sr

      move.l  KWS_globalppl(a0),d0 ; get current priority level
      asr.l   #8,d0        ; shift level into place in D0 for return

      move.l  d1,KWS_globalppl(a0)    ; save new processor priority level
.else
     ; set-up the return value.
     ; read bits 9,10 & 11 from the status register
     ; then shift down
    move.w sr,d0
    asr.l  #8,d0
    andi.l #7,d0
   
.endc ; HAS_RTXCms&&HAS_GLOBALPPL

    ori.l   #SUPVMODE,d1 ; set Supv bits
    move.w  d1,sr        ; set processor to new level  
    

      rts                  ; return

_setintlevel_end:
      FUNCTION  "_setintlevel", _setintlevel, _setintlevel_end - _setintlevel

      .end



 

Thanks

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

811 Views
Carlos_Musich
NXP Employee
NXP Employee

Starting from CW7.2 the Compiler Parameter passing convention and Library Set have changed. Please notice that CW7.2 and CW10.x use same compiler parameter passing convention and same Library Set even when the IDE in CW10.x changed.

1.Compiler

The parameter passing convention has been fixed to "Register ABI". "Standard ABI" and "Compact ABI" are no longer available, but you can use those parameter passing options by using a __declspec() directive. This is shown on the TN268

http://www.freescale.com/files/soft_dev_tools/doc/app_note/TN268.pdf

If you use assembly functions in your code this may cause problems. The reason is that previous CW versions pass parameters through the stack. CW7.2 and CW10 do it by registers. In C language there is no problem as CW solves these differences, but assembly functions must be edited to work properly. You can find a useful video showing how to edit these functions in the next link:

http://www.youtube.com/watch?v=SlHldoQWt_8

2.Library Set

The new Library set called "Embedded Warrior Libraries" or "EWL" has been created. This provides more flexibility to reduce memory footprint when using stdio operations, since it can disable functionality from the I/O operation reducing its footprint.

Hope this helps.

Carlos

0 Kudos
Reply