Merge remote-tracking branch 'madcowswe/LTO' into devel

This commit is contained in:
Paul Guenette
2020-10-20 23:32:16 -04:00
6 changed files with 18 additions and 5 deletions
@@ -302,6 +302,7 @@ static void prvPortStartFirstTask( void )
" isb \n"
" svc 0 \n" /* System call to start first task. */
" nop \n"
" .ltorg \n"
);
}
/*-----------------------------------------------------------*/
@@ -695,7 +696,8 @@ static void vPortEnableVFP( void )
" \n"
" orr r1, r1, #( 0xf << 20 ) \n" /* Enable CP10 and CP11 coprocessors, then save back. */
" str r1, [r0] \n"
" bx r14 "
" bx r14 \n"
" .ltorg "
);
}
/*-----------------------------------------------------------*/
@@ -369,7 +369,7 @@ typedef tskTCB TCB_t;
/*lint -e956 A manual analysis and inspection has been used to determine which
static variables must be declared volatile. */
PRIVILEGED_INITIALIZED_DATA TCB_t * volatile pxCurrentTCB = NULL;
__attribute__((used)) PRIVILEGED_INITIALIZED_DATA TCB_t * volatile pxCurrentTCB = NULL;
/* Lists for ready and blocked tasks. --------------------*/
PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ];/*< Prioritised ready tasks. */
@@ -2758,6 +2758,7 @@ BaseType_t xSwitchRequired = pdFALSE;
#endif /* configUSE_APPLICATION_TASK_TAG */
/*-----------------------------------------------------------*/
__attribute__((used))
void vTaskSwitchContext( void )
{
if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE )
+1
View File
@@ -75,6 +75,7 @@ void NMI_Handler(void)
/* USER CODE END NonMaskableInt_IRQn 1 */
}
__attribute__((used))
void get_regs(void** stack_ptr) {
void* volatile r0 __attribute__((unused)) = stack_ptr[0];
void* volatile r1 __attribute__((unused)) = stack_ptr[1];
+10 -2
View File
@@ -137,7 +137,7 @@ FLAGS += '-g'
-- linker flags
LDFLAGS += board.ldflags
LDFLAGS += '-lc -lm -lnosys' -- libs
LDFLAGS += '-flto -lc -lm -lnosys' -- libs
LDFLAGS += '-mthumb -mfloat-abi=hard -specs=nosys.specs -specs=nano.specs -u _printf_float -u _scanf_float -Wl,--cref -Wl,--gc-sections'
LDFLAGS += '-Wl,--undefined=uxTopUsedPriority'
@@ -149,6 +149,11 @@ else
OPT += '-O2'
end
if tup.getconfig("USE_LTO") == "true" then
OPT += '-flto'
LDFLAGS += '-flto'
end
-- common flags for ASM, C and C++
OPT += '-ffast-math -fno-finite-math-only'
tup.append_table(FLAGS, OPT)
@@ -159,7 +164,10 @@ toolchain = GCCToolchain('arm-none-eabi-', 'build', FLAGS, LDFLAGS)
-- Load list of source files Makefile that was autogenerated by CubeMX
vars = parse_makefile_vars(board.dir..'/Makefile')
all_stm_sources = (vars['C_SOURCES'] or '')..' '..(vars['CPP_SOURCES'] or '')..' '..(vars['ASM_SOURCES'] or '')
-- ASM sources must precede C sources due to LTO removing weak symbols which appear after strong symbols
-- in the call to the linker: https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
all_stm_sources = (vars['ASM_SOURCES'] or '')..' '..(vars['CPP_SOURCES'] or '')..' '..(vars['C_SOURCES'] or '')
for src in string.gmatch(all_stm_sources, "%S+") do
stm_sources += board.dir..'/'..src
end
+1 -1
View File
@@ -57,7 +57,7 @@ void init_communication(void) {
}
extern "C" {
int _write(int file, const char* data, int len);
int _write(int file, const char* data, int len) __attribute__((used));
}
// @brief This is what printf calls internally
+1
View File
@@ -5,6 +5,7 @@ CONFIG_USB_PROTOCOL=native
CONFIG_UART_PROTOCOL=ascii
CONFIG_DEBUG=false
CONFIG_DOCTEST=false
CONFIG_USE_LTO=true
# Uncomment this to error on compilation warnings
#CONFIG_STRICT=true