diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a97a0158b..76dc0156a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -842,6 +842,10 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") # add_definitions(-DMYNEWT_VAL_BLE_HS_LOG_LVL=0) endif() +if (CMAKE_BUILD_TYPE MATCHES Release) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +endif() + add_subdirectory(displayapp/fonts) target_compile_options(infinitime_fonts PUBLIC ${COMMON_FLAGS} diff --git a/src/FreeRTOS/port.c b/src/FreeRTOS/port.c index 5b5b4f176e..47d9dcf03b 100644 --- a/src/FreeRTOS/port.c +++ b/src/FreeRTOS/port.c @@ -73,6 +73,7 @@ void vPortStartFirstTask( void ) #ifdef SOFTDEVICE_PRESENT ::"i"(configKERNEL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) #endif + " .ltorg \n" ); } @@ -92,6 +93,7 @@ void vPortSVCHandler( void ) " bx r14 \n" " \n" " .align 2 \n" + " .ltorg \n" ); } @@ -122,7 +124,7 @@ void xPortPendSVHandler( void ) " msr basepri, r0 \n" " dsb \n" " isb \n" - " bl vTaskSwitchContext \n" + " bl _vTaskSwitchContext \n" " mov r0, #0 \n" " msr basepri, r0 \n" " ldmia sp!, {r3} \n" @@ -143,6 +145,12 @@ void xPortPendSVHandler( void ) " bx r14 \n" " \n" " .align 2 \n" + " .ltorg \n" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) ); } + +// Need __attribute__((used)) to prevent LTO stripping, as used in ASM above +void __attribute__((used)) _vTaskSwitchContext(void) { + vTaskSwitchContext(); +} diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index eb013d6d1a..6f28e6bb8c 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -85,7 +85,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, void SystemTask::Start() { systemTasksMsgQueue = xQueueCreate(10, 1); - if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 1, &taskHandle)) { + if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 400, this, 1, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } }