Hi,
I am new to Freescale development. Using a MC9S08DZ60 board for my project. I have created a project in Eclipse 10.1 version using support for IEEE32 type floating point.
My project uses a couple of floating point operations and 5 global variables. Whenever I attempt to do a floating point arithmetic operation with integer or character type, the global variables are getting modified unneccessarily.
For e.g. when I try to typecast an integer to float type or add / subtract a float variable with integer / character, my global variables are getting corrupted.
Can somebody please guide me where I am going wrong?
Here is portion of code, which is causing this behaviour:
void HexToASCII(float Slip, char *String){char i;unsigned long intPart, FractPart;float tempfloat;unsigned long templong;tempfloat = Slip;intPart = (unsigned long) Slip;tempfloat = (Slip - (float) intPart); /* This behaviour is observed here after executing this line and all further lines */tempfloat = tempfloat * 10;FractPart = (unsigned long) tempfloat;
Thanks..
Solved! Go to Solution.
Software FP operations require a lot of stack space. Probably STACKSIZE specified in prm file is too low for FP and stack overflows. Try increasing it.
Software FP operations require a lot of stack space. Probably STACKSIZE specified in prm file is too low for FP and stack overflows. Try increasing it.
kef wrote:Software FP operations require a lot of stack space. Probably STACKSIZE specified in prm file is too low for FP and stack overflows. Try increasing it.
Yes, stack size was culprit. Default stack size was 128 bytes. I increased it to 512 and it got solved. It took little time to find out how to increase the stack size, when developing with eclipse IDE. It is located in CPU component properties.
For those new to eclipse:
In the Project window, right click on the CPU under tab - ProcessorExpert.pe->CPUs->Cpu:MC....
Click on Inspector. Then in component inspector window, under stack specification, modify the stack size as required.
Thank you very much kef.