[FL-2480] Use SysTick as the main OS timer (#1140)
* Use SysTick as OS tick timer * Use LPTIM2 as tickless idle timer * Remove dummy LPTIM2 IRQ handler * Clean up clock init code * Rename os timer to idle timer * Advance hal ticks along with FreeRTOS's * Improve SysTick control during tickless idle * Improve idle timer precision * Correct SysTick IRQ priority * Main, FuriHal: move system startup to separate thread * Minor code cleanup Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -6,32 +6,31 @@
|
||||
|
||||
#define TAG "Main"
|
||||
|
||||
#ifdef FURI_RAM_EXEC
|
||||
int main() {
|
||||
// Initialize FURI layer
|
||||
furi_init();
|
||||
|
||||
// Flipper critical FURI HAL
|
||||
furi_hal_init_early();
|
||||
static const osThreadAttr_t init_thread_attr = {
|
||||
.name = "Init",
|
||||
.stack_size = 4096,
|
||||
};
|
||||
|
||||
void init_task() {
|
||||
// Flipper FURI HAL
|
||||
furi_hal_init();
|
||||
|
||||
// Init flipper
|
||||
flipper_init();
|
||||
|
||||
furi_run();
|
||||
|
||||
while(1) {
|
||||
}
|
||||
osThreadExit();
|
||||
}
|
||||
#else
|
||||
|
||||
int main() {
|
||||
// Initialize FURI layer
|
||||
furi_init();
|
||||
|
||||
// Flipper critical FURI HAL
|
||||
furi_hal_init_early();
|
||||
|
||||
#ifdef FURI_RAM_EXEC
|
||||
osThreadNew(init_task, NULL, &init_thread_attr);
|
||||
#else
|
||||
furi_hal_light_sequence("RGB");
|
||||
|
||||
// Delay is for button sampling
|
||||
@@ -52,21 +51,16 @@ int main() {
|
||||
furi_hal_power_reset();
|
||||
} else {
|
||||
furi_hal_light_sequence("rgb G");
|
||||
|
||||
// Flipper FURI HAL
|
||||
furi_hal_init();
|
||||
|
||||
// Init flipper
|
||||
flipper_init();
|
||||
|
||||
furi_run();
|
||||
osThreadNew(init_task, NULL, &init_thread_attr);
|
||||
}
|
||||
|
||||
while(1) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Run Kernel
|
||||
furi_run();
|
||||
|
||||
furi_crash("Kernel is Dead");
|
||||
}
|
||||
|
||||
void Error_Handler(void) {
|
||||
furi_crash("ErrorHandler");
|
||||
}
|
||||
|
Reference in New Issue
Block a user