C++ class with float variables causes crash
Posted: Tue Jan 31, 2012 1:32 am
So this is a problem which has confused me for a few days. At first I thought it was related to the I2C crashes I was experiencing, but I've managed to separate the two issues. I have created a test case for the F4 discovery.
With main.cpp line 52 uncommented the system will crash. without it, it works fine.
It also seems that it works if the class is defined in the main.cpp file, rather than externally. I have tested on windows using gcc 4.6.2 and mac with the latest linaro gcc, on both the F4 discovery and my own board. The problem occurs with the latest chibios from the trunk.
I don't believe it is a problem with chprintf() because my own printf library has exactly the same fault.
With main.cpp line 52 uncommented the system will crash. without it, it works fine.
It also seems that it works if the class is defined in the main.cpp file, rather than externally. I have tested on windows using gcc 4.6.2 and mac with the latest linaro gcc, on both the F4 discovery and my own board. The problem occurs with the latest chibios from the trunk.
I don't believe it is a problem with chprintf() because my own printf library has exactly the same fault.