From 7275f9845fa709c5fd32f31660ec195e09bf67e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se>
Date: Mon, 13 Jun 2016 16:16:46 +0200
Subject: [PATCH] cpu: Conditionally define LITTLE_ENDIAN

Caused problems with redefined macros when building with a recent newlib
---
 cpu/saml21/include/atmel/saml21e15a.h | 4 +++-
 cpu/saml21/include/atmel/saml21e16a.h | 4 +++-
 cpu/saml21/include/atmel/saml21e17a.h | 4 +++-
 cpu/saml21/include/atmel/saml21g16a.h | 4 +++-
 cpu/saml21/include/atmel/saml21g17a.h | 4 +++-
 cpu/saml21/include/atmel/saml21g18a.h | 4 +++-
 cpu/saml21/include/atmel/saml21j16a.h | 4 +++-
 cpu/saml21/include/atmel/saml21j17a.h | 4 +++-
 cpu/saml21/include/atmel/saml21j18a.h | 4 +++-
 9 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/cpu/saml21/include/atmel/saml21e15a.h b/cpu/saml21/include/atmel/saml21e15a.h
index 9b502c1635..d664a44182 100644
--- a/cpu/saml21/include/atmel/saml21e15a.h
+++ b/cpu/saml21/include/atmel/saml21e15a.h
@@ -231,7 +231,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21e16a.h b/cpu/saml21/include/atmel/saml21e16a.h
index 488b73331b..2328351e6d 100644
--- a/cpu/saml21/include/atmel/saml21e16a.h
+++ b/cpu/saml21/include/atmel/saml21e16a.h
@@ -231,7 +231,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21e17a.h b/cpu/saml21/include/atmel/saml21e17a.h
index f1251e0753..4b5bd13750 100644
--- a/cpu/saml21/include/atmel/saml21e17a.h
+++ b/cpu/saml21/include/atmel/saml21e17a.h
@@ -231,7 +231,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21g16a.h b/cpu/saml21/include/atmel/saml21g16a.h
index a6dcda6888..f18470f736 100644
--- a/cpu/saml21/include/atmel/saml21g16a.h
+++ b/cpu/saml21/include/atmel/saml21g16a.h
@@ -235,7 +235,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21g17a.h b/cpu/saml21/include/atmel/saml21g17a.h
index 1cb991433b..559c532f57 100644
--- a/cpu/saml21/include/atmel/saml21g17a.h
+++ b/cpu/saml21/include/atmel/saml21g17a.h
@@ -235,7 +235,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21g18a.h b/cpu/saml21/include/atmel/saml21g18a.h
index 884e97c5ce..72f77ba6bf 100644
--- a/cpu/saml21/include/atmel/saml21g18a.h
+++ b/cpu/saml21/include/atmel/saml21g18a.h
@@ -235,7 +235,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21j16a.h b/cpu/saml21/include/atmel/saml21j16a.h
index 2f036b5e98..36ff67dab0 100644
--- a/cpu/saml21/include/atmel/saml21j16a.h
+++ b/cpu/saml21/include/atmel/saml21j16a.h
@@ -239,7 +239,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21j17a.h b/cpu/saml21/include/atmel/saml21j17a.h
index c53599cd6f..8f5688b80b 100644
--- a/cpu/saml21/include/atmel/saml21j17a.h
+++ b/cpu/saml21/include/atmel/saml21j17a.h
@@ -239,7 +239,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
diff --git a/cpu/saml21/include/atmel/saml21j18a.h b/cpu/saml21/include/atmel/saml21j18a.h
index fc8eb48b72..b989e40433 100644
--- a/cpu/saml21/include/atmel/saml21j18a.h
+++ b/cpu/saml21/include/atmel/saml21j18a.h
@@ -239,7 +239,9 @@ void PICOP_Handler               ( void );
  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
  */
 
-#define LITTLE_ENDIAN          1
+#ifndef LITTLE_ENDIAN
+#   define LITTLE_ENDIAN       1
+#endif
 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
 #define __MPU_PRESENT          0         /*!< MPU present or not */
 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
-- 
GitLab