I wanted to test the running speed between the hard float and soft float, so I made a simple example:
Code: Select all
unsigned long i, j;
unsigned long start = chTimeNow();
float * data;
float * data2;
data = (float *) calloc(100000, sizeof(float));
data2 = (float *) calloc(100000, sizeof(float));
chprintf((BaseSequentialStream *) &SD1, "Main (SD1 started)\r\n");
chprintf((BaseSequentialStream *) &SD1, "Here\r\n");
chprintf((BaseSequentialStream *) &SD1, "%d\r\n", (int) data[1]);
for (i = 0; i < 100000; i++) {
data[i] = 12;
data2[i] = 22;
}
chprintf((BaseSequentialStream *) &SD1, "%d\r\n", (int) data[1]);
data[1] *= data[2];
for (j = 0; j < 1000; j++) {
for (i = 0; i < 100000; i++)
data[i] *= data2[i];
}
free(data);
free(data2);
chprintf((BaseSequentialStream *) &SD1, "Ticks:%d\r\n", chTimeNow() - start);
chprintf((BaseSequentialStream *) &SD1, "End\r\n");
When I compile with the following flags:
Code: Select all
USE_OPT = -O2 -ggdb -fomit-frame-pointer Everything is working fine
Code: Select all
[2012-12-04 19:23:48.757] Main (SD1 started)
[2012-12-04 19:23:48.762] Here
[2012-12-04 19:23:48.762] 0
[2012-12-04 19:23:48.775] 12
[2012-12-04 19:24:57.492] Ticks:68771
[2012-12-04 19:24:57.492] EndAccording the Raspberry FAQ I have to use the following flags
Code: Select all
USE_OPT = -march=armv6 -mfpu=vfp -mfloat-abi=hardto compile the code with hardware float support, but in this case I'm receiving the following message through UART
Code: Select all
[2012-12-04 19:30:33.910] Main (SD1 It seams that the system stops, what can be the problem with the hardware floating point?
Robert