Coldfire V2 : parameter passing problem

paha11 wrote on Friday, July 06, 2012:


I’m trying to get the FreeRTOS running on our custom board with MCF5232 using CodeWarrior 7.2. I came out from Demo project “ColdFire_MCF52221_CodeWarrior”. After some debugging to find out why interrupts are not executed I run into function


in portasm.S which expects its argument on the stack but from the disasembly I could see that the paraemetr is passed in D0 register.

    link    A6,#-8
    movem.l D6-D7,(SP)
    move.w  SR,D7       /* current sr    */
    move.l  D7,D0       /* prepare return value  */
    andi.l  #0x0700,D0  /* mask out IPL  */
    lsr.l   #8,D0       /* IPL   */
    move.l  8(A6),D6    /* get argument +++++++++++++++++++++++ expected value on stack  */
    andi.l  #0x07,D6    /* least significant three bits  */
    lsl.l   #8,D6       /* move over to make mask    */
    andi.l  #0x0000F8FF,D7  /* zero out current IPL  */
    or.l    D6,D7           /* place new IPL in sr   */
    move.w  D7,SR
    movem.l (SP),D6-D7
    lea     8(SP),SP
    unlk    A6

Code generated by compiler

    moveq    #4,d0              ;   ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) where argument is #4
    jsr      _@DummyFn1   ; I don't know why but ulPortSetIPL is also referenced as _@DummyFn1

Could anyone please help me how get over this problem and make the call properly? Maybe some settings in CodeWarrior are necessary but when I looked into the example project settings Code Generation -> Cold Fire Processor I could see that Parameter Passing is Register but the combobox is disabled. The same as in my project.

Thank you for any help


xz8987f wrote on Friday, July 06, 2012:

The ColdFire compiler has changed the register passing. CodeWarrior 7.2 is rather old and it looks you mix up the old compiler with a newer port. So you probably better move up to the actual 10.2 version of the tools, or you need to backport or use an older FreeRTOS port. I believe there is a __registerABI or similar pragma you could use as well.

Hope this helps,

rtel wrote on Saturday, July 07, 2012:

See the firs item here for a fix:


paha11 wrote on Sunday, July 08, 2012:

Hello guys
Thank you both for the help. I fixed the code according to the known issues.

As to the codewarrior, is version 10.2 also available for free as the  version 7.2? (to 128KB) I downloaded cw  for coldfire family from freescale site so I supposed it was the latest version.


xz8987f wrote on Monday, July 09, 2012:

Yes, MCU10.2 comes as well with a free special edition with a code limitation. In case you consider using it with Processor Expert: describes the latest embedded component port for it. Also available from the FreeRTOS community/interactive web site.

Hope this helps,