Dear Andrew Gabbasov,

> Packed structure cfi_qry contains unaligned 16- and 32-bits members,
> accessing which causes problems when cfi_flash driver is compiled with
> -munaligned-access option: flash initialization hangs, probably
> due to data error.
> 
> Since fixing the code to use some other way of accessing those fields
> seems quite expensive, just force the compiler to use
> -mno-unaligned-access.
> 
> Signed-off-by: Andrew Gabbasov <andrew_gabba...@mentor.com>
> ---
>  drivers/mtd/Makefile |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
> index 543c845..a120f0b 100644
> --- a/drivers/mtd/Makefile
> +++ b/drivers/mtd/Makefile
> @@ -46,6 +46,9 @@ all:        $(LIB)
>  $(LIB):      $(obj).depend $(OBJS)
>       $(call cmd_link_o_target, $(OBJS))
> 
> +# SEE README.arm-unaligned-accesses
> +$(obj)cfi_flash.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> +
>  #########################################################################
> 
>  # defines $(obj).depend target

I'd say rather fix the structure than use this workaround. See, using

u8[3]
u16

will make unaligned access. The fix would be to split that u16 into two u8 and 
add a proper accessor. It'll be much larger effort, but it'd also be more 
correct.

Best regards,
Marek Vasut
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to