I have problems with floating point calculations. When I do this simple test the floating point calculation complete failed.
1: Create a Generic Application with the Freescale Beekit 1.9.8 and codebase ARM7 SMAC 1.1.2
2: Set the security option in the property list tab
3: Export the solution to IAR 5.20
I use the terminal I/O screen in the view menu to watch the debug messages.
4: Go to the options windows and change the follow options.
a) General Options > Library Configuration > Library low-level interface implementation to Semihosted
b) General Options > Library options > Printf formatter to Full.
5: Add the follow lines to the generic_app(void) function
printf("Test float 1 %2.2f\n\r", 142.567);
printf("Test float 2 %2.5f\n\r", 67.52);
printf("Test float 3 %2.2f\n\r", 9.3332);
printf("Test float 5 %4.2f\n\r", 9372.43);
6: Download and debug the application to a MC13224v development board.
7: Now open the terminal I/O windows and watch the result. I get the follow strange ouput.
Test float 1 -740805657577357739210128000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
Test float 2 -0.00000
Test float 3 0.00
Test float 5 0.00
Test float 1 -740805657577357739210128000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
Test float 2 -0.00000
Test float 3 0.00
Test float 5 0.00
When I do the same test with the MAC codebase project, I got the same result. Why doesn't this work?
An extra printf statement will result in a correct calculation. Sometimes you must add or remove 1 statement. Bug in the IAR printf lib? I found in the EWARM 5.30 release note description something about this problem.
Jan2,
As this is a Compiler issue i would recommend that you try and send your question to the IAR support.
I think they are better suited to help you.
BR,
Mads