diff --git a/conf/Makefile.arm-linux b/conf/Makefile.arm-linux index 3efce866b2..9fef12bc6c 100644 --- a/conf/Makefile.arm-linux +++ b/conf/Makefile.arm-linux @@ -41,6 +41,9 @@ endif ARCH_CFLAGS ?= -mtune=cortex-a8 -march=armv7-a +# with armv7, unaligned data can still be read +CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=1 + # add ARM specifc flags to CFLAGS, LDFLAGS CFLAGS += $(FLOAT_ABI) $(ARCH_CFLAGS) LDFLAGS += $(FLOAT_ABI) diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index e461cd670b..375cf1f2bd 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -104,6 +104,9 @@ CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS) # on old lpc, avoid using double precision in some geodetic functions CFLAGS += -DUSE_SINGLE_PRECISION_LLA_ECEF +# LPC21 doesn't support unaligned data access +CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=0 + # Assembler flags. ASFLAGS = -Wa,-adhlns=$(OBJDIR)/$(notdir $(<:.S=.lst)) diff --git a/conf/Makefile.nps b/conf/Makefile.nps index 675db2360e..675b56d142 100644 --- a/conf/Makefile.nps +++ b/conf/Makefile.nps @@ -52,6 +52,9 @@ CXXFLAGS += $(shell pkg-config --cflags-only-I ivy-glib) LDFLAGS += $($(TARGET).LDFLAGS) -pthread +# x86/64 and armv7 allow unaligned access +CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=1 + # # General rules # diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index 2d41a9c041..a51adf0334 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -115,6 +115,9 @@ else CFLAGS += -DSTM32F1 endif +# with cortex-m3 and m4 unaligned data can still be read +CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=1 + CFLAGS += $($(TARGET).CFLAGS) AFLAGS = -ahls -mapcs-32 diff --git a/sw/airborne/subsystems/datalink/datalink.h b/sw/airborne/subsystems/datalink/datalink.h index 4c21f3fd74..8d4a53c456 100644 --- a/sw/airborne/subsystems/datalink/datalink.h +++ b/sw/airborne/subsystems/datalink/datalink.h @@ -33,12 +33,6 @@ #define EXTERN extern #endif -#ifdef __IEEE_BIG_ENDIAN /* From machine/ieeefp.h */ -#define Swap32IfBigEndian(_u) { _u = (_u << 32) | (_u >> 32); } -#else -#define Swap32IfBigEndian(_) {} -#endif - #include "std.h" #include "pprzlink/dl_protocol.h" diff --git a/sw/ext/pprzlink b/sw/ext/pprzlink index 6efd540406..1f3c7cd218 160000 --- a/sw/ext/pprzlink +++ b/sw/ext/pprzlink @@ -1 +1 @@ -Subproject commit 6efd540406cb5a2fdc6b27cc5befaa43bf54a4e6 +Subproject commit 1f3c7cd2186ec019d46c73dc2ed73a8714705ba5