Skip to content

Commit 07e672c

Browse files
authored
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
1 parent 334de5d commit 07e672c

File tree

6 files changed

+6
-0
lines changed

6 files changed

+6
-0
lines changed

portable/GCC/ARM_CM0/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef unsigned long UBaseType_t;
7373
#define portSTACK_GROWTH ( -1 )
7474
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
7575
#define portBYTE_ALIGNMENT 8
76+
#define portDONT_DISCARD __attribute__(( used ))
7677
/*-----------------------------------------------------------*/
7778

7879

portable/GCC/ARM_CM3/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef unsigned long UBaseType_t;
7373
#define portSTACK_GROWTH ( -1 )
7474
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
7575
#define portBYTE_ALIGNMENT 8
76+
#define portDONT_DISCARD __attribute__(( used ))
7677
/*-----------------------------------------------------------*/
7778

7879
/* Scheduler utilities. */

portable/GCC/ARM_CM3_MPU/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ typedef struct MPU_SETTINGS
109109
#define portSTACK_GROWTH ( -1 )
110110
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
111111
#define portBYTE_ALIGNMENT 8
112+
#define portDONT_DISCARD __attribute__(( used ))
112113
/*-----------------------------------------------------------*/
113114

114115
/* SVC numbers for various services. */

portable/GCC/ARM_CM4F/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef unsigned long UBaseType_t;
7373
#define portSTACK_GROWTH ( -1 )
7474
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
7575
#define portBYTE_ALIGNMENT 8
76+
#define portDONT_DISCARD __attribute__(( used ))
7677
/*-----------------------------------------------------------*/
7778

7879
/* Scheduler utilities. */

portable/GCC/ARM_CM4_MPU/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ typedef struct MPU_SETTINGS
109109
#define portSTACK_GROWTH ( -1 )
110110
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
111111
#define portBYTE_ALIGNMENT 8
112+
#define portDONT_DISCARD __attribute__(( used ))
112113
/*-----------------------------------------------------------*/
113114

114115
/* SVC numbers for various services. */

portable/GCC/ARM_CM7/r0p1/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef unsigned long UBaseType_t;
7373
#define portSTACK_GROWTH ( -1 )
7474
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
7575
#define portBYTE_ALIGNMENT 8
76+
#define portDONT_DISCARD __attribute__(( used ))
7677
/*-----------------------------------------------------------*/
7778

7879
/* Scheduler utilities. */

0 commit comments

Comments
 (0)