mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11874 from fkjagodzinski/armc6_build-enable_lto_for_release
ARMC6: Add a build profile extension with the link-time optimizer enabledpull/12377/head
commit
32675cc6ac
|
|
@ -27,6 +27,7 @@
|
|||
#include "region_defs.h"
|
||||
#include "tfm_nspm.h"
|
||||
#include "tfm_memory_utils.h"
|
||||
#include "platform/mbed_toolchain.h"
|
||||
|
||||
/*
|
||||
* IPC partitions.
|
||||
|
|
@ -580,7 +581,7 @@ void tfm_spm_init(void)
|
|||
tfm_thrd_start_scheduler(&this_thrd);
|
||||
}
|
||||
|
||||
void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
|
||||
MBED_USED void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
|
||||
{
|
||||
#if TFM_LVL == 2
|
||||
struct spm_partition_desc_t *p_next_partition;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <stdbool.h>
|
||||
#include "tfm_svcalls.h"
|
||||
#endif
|
||||
#include "platform/mbed_toolchain.h"
|
||||
|
||||
/* This SVC handler is called when a secure partition requests access to a
|
||||
* buffer area
|
||||
|
|
@ -135,7 +136,7 @@ __attribute__((naked)) void SVC_Handler(void)
|
|||
#error "Unsupported ARM Architecture."
|
||||
#endif
|
||||
|
||||
uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr)
|
||||
MBED_USED uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr)
|
||||
{
|
||||
uint8_t svc_number;
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -347,6 +347,16 @@ extern "C" void *SUB_REALLOC(void *ptr, size_t size)
|
|||
memcpy(new_ptr, (void *)ptr, copy_size);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
{
|
||||
volatile uint8_t dummy = 0;
|
||||
if (dummy != 0) { // always false
|
||||
// this code will never be executed
|
||||
// it's just to tell the compiler/linker to preserve SUB_REALLOC symbol
|
||||
// when LTO enabled
|
||||
SUPER_REALLOC(NULL, 0);
|
||||
}
|
||||
}
|
||||
#else // #if MBED_HEAP_STATS_ENABLED
|
||||
new_ptr = SUPER_REALLOC(ptr, size);
|
||||
#endif // #if MBED_HEAP_STATS_ENABLED
|
||||
|
|
@ -369,6 +379,16 @@ extern "C" void *SUB_CALLOC(size_t nmemb, size_t size)
|
|||
if (ptr != NULL) {
|
||||
memset(ptr, 0, nmemb * size);
|
||||
}
|
||||
|
||||
{
|
||||
volatile uint8_t dummy = 0;
|
||||
if (dummy != 0) { // always false
|
||||
// this code will never be executed
|
||||
// it's just to tell the compiler/linker to preserve SUB_CALLOC symbol
|
||||
// when LTO enabled
|
||||
SUPER_CALLOC(NULL, 0);
|
||||
}
|
||||
}
|
||||
#else // #if MBED_HEAP_STATS_ENABLED
|
||||
ptr = SUPER_CALLOC(nmemb, size);
|
||||
#endif // #if MBED_HEAP_STATS_ENABLED
|
||||
|
|
|
|||
|
|
@ -1141,7 +1141,7 @@ extern "C" __value_in_regs struct __argc_argv $Sub$$__rt_lib_init(unsigned heapb
|
|||
}
|
||||
#endif
|
||||
|
||||
extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
|
||||
MBED_USED extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
|
||||
{
|
||||
return _mbed_user_setup_stackheap(R0, R1, R2, R3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ extern void SramInit(void);
|
|||
|
||||
#if defined( __ICCARM__)
|
||||
__root
|
||||
#endif /* __ICCARM__ */
|
||||
#else
|
||||
__attribute__((used))
|
||||
#endif
|
||||
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
||||
{
|
||||
BLANKX60,BLANKX600
|
||||
|
|
@ -139,6 +141,11 @@ WEAK_FUNCTION( DMA_SIP7_Int_Handler )
|
|||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector table
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined( __ICCARM__)
|
||||
__root
|
||||
#else
|
||||
__attribute__((used))
|
||||
#endif
|
||||
const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) =
|
||||
{
|
||||
(pFunc) INITIAL_SP, /* Initial Stack Pointer */
|
||||
|
|
|
|||
|
|
@ -60,8 +60,10 @@ extern void SramInit(void);
|
|||
Checksum options
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#if defined( __ICCARM__)
|
||||
__root
|
||||
#else
|
||||
__attribute__((used))
|
||||
#endif
|
||||
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
||||
{
|
||||
|
|
@ -144,6 +146,11 @@ WEAK_FUNCTION( Root_Clk_Err_Handler )
|
|||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector table
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined( __ICCARM__)
|
||||
__root
|
||||
#else
|
||||
__attribute__((used))
|
||||
#endif
|
||||
const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) = {
|
||||
(pFunc) INITIAL_SP, /* Initial Stack Pointer */
|
||||
ADUCM4050_VECTORS
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ WEAK_ALIAS_FUNC(TRNG_IRQHandler, Default_Handler) // 101:
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__ARMCC_VERSION)
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
const uint32_t __vector_table[] @ ".intvec" = {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ WEAK_ALIAS_FUNC(OPA_IRQHandler, Default_Handler) // 62: OPA Interrupt
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__ARMCC_VERSION)
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ WEAK_ALIAS_FUNC(TRNG_IRQHandler, Default_Handler) // 101:
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ WEAK_ALIAS_FUNC(TK_IRQHandler, Default_Handler) // 63:
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@
|
|||
#if defined(__CC_ARM)
|
||||
#define WEAK __attribute__ ((weak))
|
||||
#define ALIAS(f) __attribute__ ((weak, alias(#f)))
|
||||
#define USED __attribute__ ((used))
|
||||
|
||||
#define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \
|
||||
void FUN(void) __attribute__ ((weak, alias(#FUN_ALIAS)));
|
||||
|
||||
#elif defined(__ICCARM__)
|
||||
#define USED __root
|
||||
//#define STRINGIFY(x) #x
|
||||
//#define _STRINGIFY(x) STRINGIFY(x)
|
||||
#define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \
|
||||
|
|
@ -42,6 +44,7 @@ _Pragma(_STRINGIFY(_WEAK_ALIAS_FUNC(FUN, FUN_ALIAS)))
|
|||
#elif defined(__GNUC__)
|
||||
#define WEAK __attribute__ ((weak))
|
||||
#define ALIAS(f) __attribute__ ((weak, alias(#f)))
|
||||
#define USED __attribute__ ((used))
|
||||
|
||||
#define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \
|
||||
void FUN(void) __attribute__ ((weak, alias(#FUN_ALIAS)));
|
||||
|
|
@ -77,7 +80,7 @@ void Default_Handler(void);
|
|||
void Reset_Handler(void);
|
||||
void Reset_Handler_1(void);
|
||||
void Reset_Handler_2(void);
|
||||
void Reset_Handler_Cascade(void *sp, void *pc);
|
||||
USED void Reset_Handler_Cascade(void *sp, void *pc);
|
||||
|
||||
/* Cortex-M4 core handlers */
|
||||
WEAK_ALIAS_FUNC(NMI_Handler, Default_Handler)
|
||||
|
|
@ -190,7 +193,7 @@ WEAK_ALIAS_FUNC(ETMC_IRQHandler, Default_Handler) // 95:
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ WEAK_ALIAS_FUNC(RTC_IRQHandler, Default_Handler) // Real time clock i
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ WEAK_ALIAS_FUNC(CRC_IRQHandler, Default_Handler) // 141: CRC
|
|||
|
||||
/* Vector table */
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
__attribute__ ((section("RESET")))
|
||||
__attribute__ ((section("RESET"), used))
|
||||
const uint32_t __vector_handlers[] = {
|
||||
#elif defined(__ICCARM__)
|
||||
extern uint32_t CSTACK$$Limit;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
******************************************************************************/
|
||||
#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
|
||||
__attribute__((section(".boot_hdr.conf")))
|
||||
__attribute__((section(".boot_hdr.conf"), used))
|
||||
#elif defined(__ICCARM__)
|
||||
#pragma location = ".boot_hdr.conf"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
|
||||
__attribute__((section(".boot_hdr.ivt")))
|
||||
__attribute__((section(".boot_hdr.ivt"), used))
|
||||
#elif defined(__ICCARM__)
|
||||
#pragma location=".boot_hdr.ivt"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -289,12 +289,12 @@ int rtc_isenabled(void)
|
|||
|
||||
#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM
|
||||
|
||||
static void RTC_IRQHandler(void);
|
||||
static void _RTC_IRQHandler(void);
|
||||
static void (*irq_handler)(void);
|
||||
|
||||
volatile uint8_t lp_Fired = 0;
|
||||
|
||||
static void RTC_IRQHandler(void)
|
||||
static void _RTC_IRQHandler(void)
|
||||
{
|
||||
/* Update HAL state */
|
||||
RtcHandle.Instance = RTC;
|
||||
|
|
@ -428,7 +428,7 @@ void rtc_set_wake_up_timer(timestamp_t timestamp)
|
|||
}
|
||||
#endif /* RTC_WUTR_WUTOCLR */
|
||||
|
||||
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_IRQHandler);
|
||||
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)_RTC_IRQHandler);
|
||||
irq_handler = (void (*)(void))lp_ticker_irq_handler;
|
||||
NVIC_EnableIRQ(RTC_WKUP_IRQn);
|
||||
core_util_critical_section_exit();
|
||||
|
|
@ -437,7 +437,7 @@ void rtc_set_wake_up_timer(timestamp_t timestamp)
|
|||
void rtc_fire_interrupt(void)
|
||||
{
|
||||
lp_Fired = 1;
|
||||
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_IRQHandler);
|
||||
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)_RTC_IRQHandler);
|
||||
irq_handler = (void (*)(void))lp_ticker_irq_handler;
|
||||
NVIC_SetPendingIRQ(RTC_WKUP_IRQn);
|
||||
NVIC_EnableIRQ(RTC_WKUP_IRQn);
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ void CC3220SF_LAUNCHXL_initGeneral(void)
|
|||
}
|
||||
|
||||
#if defined TOOLCHAIN_ARM
|
||||
__attribute__((section("signature_section")))
|
||||
__attribute__((section("signature_section"), used))
|
||||
#elif defined TOOLCHAIN_IAR
|
||||
#pragma default_variable_attributes = @ ".dbghdr"
|
||||
#elif defined TOOLCHAIN_GCC_ARM
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ WEAK_ALIAS_FUNC(EUSCIB3_SPI_IRQHandler, Default_Handler)
|
|||
// to ensure that it ends up at physical address 0x0000.0000 or at the start of the
|
||||
// program if located at a start address other than 0.
|
||||
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
|
||||
void (* const interruptVectors[])(void) __attribute__((section("RESET"))) = {
|
||||
void (* const interruptVectors[])(void) __attribute__((section("RESET"), used)) = {
|
||||
(pFunc) &Image$$ARM_LIB_STACK$$ZI$$Limit, // The initial stack pointer
|
||||
#elif defined(__ICCARM__)
|
||||
void (* const __vector_table[])(void) @ ".intvec" = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"ARMC6": {
|
||||
"common": ["-flto"],
|
||||
"ld": ["--lto", "--lto_level=Oz"]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue