[Icc-430] V7.05 BETA0 - error in handling of longs in div32u/mod32u?

bailey at peak.org bailey at peak.org
Tue Jan 23 22:38:50 PST 2007


Any chance you have a mix of modules/libraries built with different
compiler versions (and calling conventions)?  I had a weird case of this
myself not too long ago...

    Kirk Bailey
    bailey at peak.org

> Eh? All the internal routines, including div32u etc have been modified. Do
> you have a test case showing it's not working?
>
> At 08:43 PM 1/23/2007, Kris Heidenstrom wrote:
>>Richard wrote
>>
>>
>>>V7.05
>>[...]
>>>     - Interface to the 32 bit internal functions for longs and floating
>>>       point now use R12/R13 in addition to R14/R15 for argument
>>> passing,
>>>       resulting in smaller and faster code.
>>[...]
>>
>>There seems to be a problem with division of longs. I'm not
>>100% sure of the details, but what I think has happened is this.
>>
>>The canned code block for div32u (also used by mod32u) has
>>not been updated to use R12,13 and is still assuming that one
>>parameter will be passed on the stack. At the end of the canned
>>code block, the code copies the return address from (SP+0) to
>>(SP+4), then adds 4 to SP, then returns. This would be right if
>>there was a 32-bit parameter on the stack, but this parameter is
>>now passed in registers. As a result, some data further up the
>>stack is clobbered, and the MCU may or may not return to
>>somewhere meaningful, depending on the stack usage of the
>>function that invokes div32u/mod32u. I'm not sure whether
>>the canned code for div32u/mod32u comes from a library, or is
>>hard-coded into the compiler, but in either case, I think it needs
>>to be updated to be compatible with this new calling convention.
>>
>>Regards
>>
>>Kris
>>--
>>Kris Heidenstrom         Embedded systems designer / programmer
>>kris at abbey.co.nz         Abbey Systems Ltd - Telemetry Specialists
>>Wellington NEW ZEALAND   Voice +64-4-385-6611  Fax +64-4-385-6848
>>
>>
>>_______________________________________________
>>Icc-430 mailing list
>>Icc-430 at imagecraft.com
>>http://dragonsgate.net/mailman/listinfo/icc-430
>
> // richard (This email is for mailing lists. To reach me directly, please
> use richard at imagecraft.com)
>
> _______________________________________________
> Icc-430 mailing list
> Icc-430 at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-430
>




More information about the Icc-430 mailing list