Skip to content

Commit 9c9a957

Browse files
committed
LTO
1 parent ba1934f commit 9c9a957

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/CMakeLists.txt

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

852+
if (CMAKE_BUILD_TYPE MATCHES Release)
853+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
854+
endif()
855+
852856
add_subdirectory(displayapp/fonts)
853857
target_compile_options(infinitime_fonts PUBLIC
854858
${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
@@ -85,7 +85,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
8585

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

0 commit comments

Comments
 (0)