[U-Boot] static var mem alignment issue/question

Tim Harvey tharvey at gateworks.com
Mon Nov 28 21:50:06 CET 2016


Greetings,

In debugging an issue with a rather old branch of U-Boot (2015-04) I
found that the static assignment of a data buffer was not 32-bit
aligned which caused data aborts. However I find that current U-boot
master does not suffer this issue and no matter what I declare static
before the particular variable its always 32-bit aligned. I don't see
any code changes that would cause this and in both cases I'm building
with the same gcc5.2.0 toolchain.

The code in question is this this from cmd/fdt.c:

        } else if (argv[1][0] == 's') {
                char *pathp;            /* path */
                char *prop;             /* property */
                int  nodeoffset;        /* node offset from libfdt */
                static char data[SCRATCHPAD];   /* storage for the property */
                int  len;               /* new length of the property */
                int  ret;

What guarantee's that 'data' above is 32-bit aligned in master that is
missing from the older U-Boot branch I'm using? Perhaps there is some
arg in a Makefile that I'm missing?

Regards,

Tim


More information about the U-Boot mailing list