Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FuriHal: remove clock startup time tracking from clean builds #2764

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions firmware/targets/f7/furi_hal/furi_hal_clock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <furi_hal_clock.h>
#include <furi_hal_resources.h>
#include <furi_hal_rtc.h>
#include <furi.h>

#include <stm32wbxx_ll_pwr.h>
Expand Down Expand Up @@ -143,7 +142,10 @@ void furi_hal_clock_switch_to_hsi() {
}

void furi_hal_clock_switch_to_pll() {
#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t clock_start_time = DWT->CYCCNT;
#endif

LL_RCC_HSE_Enable();
LL_RCC_PLL_Enable();
LL_RCC_PLLSAI1_Enable();
Expand All @@ -166,11 +168,12 @@ void furi_hal_clock_switch_to_pll() {
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
;

#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t total = DWT->CYCCNT - clock_start_time;
if(total > (20 * 0x148)) {
furi_hal_rtc_set_flag(FuriHalRtcFlagLegacySleep);
furi_crash("Slow HSE/PLL startup");
}
#endif
}

void furi_hal_clock_suspend_tick() {
Expand Down