Add definition of portDONT_DISCARD to ARMv7-M ports (#50)

Enabling Link Time Optimization (LTO) causes some of the functions used
in assembly to be incorrectly stripped off, resulting in linker error.
To avoid this, these functions are marked with portDONT_DISCARD macro,
definition of which is port specific. This commit adds the definition
of portDONT_DISCARD for ARMv7-M ports.

Signed-off-by: Gaurav Aggarwal
diff --git a/portable/GCC/ARM_CM0/portmacro.h b/portable/GCC/ARM_CM0/portmacro.h
index 3b402b4..2e59a83 100644
--- a/portable/GCC/ARM_CM0/portmacro.h
+++ b/portable/GCC/ARM_CM0/portmacro.h
@@ -73,6 +73,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 

diff --git a/portable/GCC/ARM_CM3/portmacro.h b/portable/GCC/ARM_CM3/portmacro.h
index 29bccbb..673d937 100644
--- a/portable/GCC/ARM_CM3/portmacro.h
+++ b/portable/GCC/ARM_CM3/portmacro.h
@@ -73,6 +73,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 /* Scheduler utilities. */

diff --git a/portable/GCC/ARM_CM3_MPU/portmacro.h b/portable/GCC/ARM_CM3_MPU/portmacro.h
index eef4358..61da741 100644
--- a/portable/GCC/ARM_CM3_MPU/portmacro.h
+++ b/portable/GCC/ARM_CM3_MPU/portmacro.h
@@ -109,6 +109,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 /* SVC numbers for various services. */

diff --git a/portable/GCC/ARM_CM4F/portmacro.h b/portable/GCC/ARM_CM4F/portmacro.h
index e1e7fad..b94366d 100644
--- a/portable/GCC/ARM_CM4F/portmacro.h
+++ b/portable/GCC/ARM_CM4F/portmacro.h
@@ -73,6 +73,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 /* Scheduler utilities. */

diff --git a/portable/GCC/ARM_CM4_MPU/portmacro.h b/portable/GCC/ARM_CM4_MPU/portmacro.h
index eef4358..61da741 100644
--- a/portable/GCC/ARM_CM4_MPU/portmacro.h
+++ b/portable/GCC/ARM_CM4_MPU/portmacro.h
@@ -109,6 +109,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 /* SVC numbers for various services. */

diff --git a/portable/GCC/ARM_CM7/r0p1/portmacro.h b/portable/GCC/ARM_CM7/r0p1/portmacro.h
index c01d305..124e807 100644
--- a/portable/GCC/ARM_CM7/r0p1/portmacro.h
+++ b/portable/GCC/ARM_CM7/r0p1/portmacro.h
@@ -73,6 +73,7 @@
 #define portSTACK_GROWTH			( -1 )

 #define portTICK_PERIOD_MS			( ( TickType_t ) 1000 / configTICK_RATE_HZ )

 #define portBYTE_ALIGNMENT			8

+#define portDONT_DISCARD			__attribute__(( used ))

 /*-----------------------------------------------------------*/

 

 /* Scheduler utilities. */