Skip to content

Commit 1b423cc

Browse files
committed
LTO
1 parent 8250565 commit 1b423cc

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,10 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
853853
# add_definitions(-DMYNEWT_VAL_BLE_HS_LOG_LVL=0)
854854
endif()
855855

856+
if (CMAKE_BUILD_TYPE MATCHES Release)
857+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
858+
endif()
859+
856860
add_subdirectory(displayapp/fonts)
857861
target_compile_options(infinitime_fonts PUBLIC
858862
${COMMON_FLAGS}

src/FreeRTOS/port.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void vPortStartFirstTask( void )
7373
#ifdef SOFTDEVICE_PRESENT
7474
::"i"(configKERNEL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
7575
#endif
76+
" .ltorg \n"
7677
);
7778
}
7879

@@ -92,6 +93,7 @@ void vPortSVCHandler( void )
9293
" bx r14 \n"
9394
" \n"
9495
" .align 2 \n"
96+
" .ltorg \n"
9597
);
9698
}
9799

@@ -122,7 +124,7 @@ void xPortPendSVHandler( void )
122124
" msr basepri, r0 \n"
123125
" dsb \n"
124126
" isb \n"
125-
" bl vTaskSwitchContext \n"
127+
" bl _vTaskSwitchContext \n"
126128
" mov r0, #0 \n"
127129
" msr basepri, r0 \n"
128130
" ldmia sp!, {r3} \n"
@@ -143,6 +145,12 @@ void xPortPendSVHandler( void )
143145
" bx r14 \n"
144146
" \n"
145147
" .align 2 \n"
148+
" .ltorg \n"
146149
::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
147150
);
148151
}
152+
153+
// Need __attribute__((used)) to prevent LTO stripping, as used in ASM above
154+
void __attribute__((used)) _vTaskSwitchContext(void) {
155+
vTaskSwitchContext();
156+
}

src/systemtask/SystemTask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
8787

8888
void SystemTask::Start() {
8989
systemTasksMsgQueue = xQueueCreate(10, 1);
90-
if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 1, &taskHandle)) {
90+
if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 400, this, 1, &taskHandle)) {
9191
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
9292
}
9393
}

0 commit comments

Comments
 (0)