[ros-users] ros on armhf (beagleboard, pandaboard, raspberryPi, gumstix) error/alignment fault/kernel exception - possibly solved

Austin Hendrix legotown at aol.com
Sun Mar 3 10:59:42 UTC 2013


Awesome! I've been running into the same thing over the past few days, but I haven't had time to look into it extensively.

I'll keep my eyes peeled for a patch. Have you made any measurements of how it affects performance on arm and x86?

-Austin

On Mar 3, 2013, at 2:23 AM, Peter Rudolph <semael23 at gmail.com> wrote:

> He guys!
> I tried to solved and it seems solved! First i will explain the problem itself: while de-/serializing unaligned pointercasts are done. normally this is not a problem! but since newer versions of arm-gcc use float support with options -mfloat-abi=hard/softfp, there are many possibilities to hit this alignment fault, because NEON instructions must be aligned! This is a very big problem... compiling ROS with -Wcast-align shows the potential lines! Solving this by setting "-mno-unaligned-access" as compiler-flag does NOT work! Every prebuilt-compiler i used seemed to ignore this switch.
> 
> example from www, demonstrates the error (compile it w/o any optimization(-O0), else compiler will re-align the pointercast, but this won't work for ROS, since everything is built w/ optimization(-O2)):
> 
> #include <stdio.h>
> 
> int main(int argc, char* argv[])
> {
>    char __attribute__ ((aligned(32))) buffer[8] = { 0 };
>    float* fval_p;
> 
>    fval_p = (float*)&buffer[1];
>    *fval_p = 0.1234;
> 
>    printf("\nfloat at &buf[1] is %f\n", *fval_p);
> 
>    return 0;
> }
> 
> Build my own example from this, to check what works correctly and serious...
> 
> Only possibility was to hack the correct lines in roscpp_serialization. I only changed the lines from pointercasts to simple memcpy's and now everything seems to work fine! No alignment faults, no bus errors, no kernel exceptions! Tried a lightweight openni version, my own robot stack, and gmapping! navigation stack will follow!
> 
> Due to having no time now, patchfile will follow, too!
> 
> Regards,
> sem23
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users




More information about the ros-users mailing list