[FL-1558] Technical Debt: console, bootloader, targets, stdglue, etc... (#590)

* ApiHal: console abstraction, change uart baud rate to 230400. Bootloader: drop F5. Furi: prevent thread local output to serial console in stdglue.
* ApiHal: take control over system initialization, reorder some subsystems in a hope of fixing USB issues.
* Main: cleanup dead code. ISR: take care of HSECSS by our self. USB: leave clock configuration alone.
* F6 cube: switch RCC to LL.
* Cli: rollback return behavior.
This commit is contained in:
あく
2021-07-20 20:14:42 +03:00
committed by GitHub
parent 0dc4081b85
commit f25d000d53
36 changed files with 988 additions and 1757 deletions

View File

@@ -2,15 +2,8 @@
#include "check.h"
#include "memmgr.h"
#include <main.h>
#include <cmsis_os2.h>
#include <stdio.h>
#include <string.h>
#include <api-hal.h>
#include <m-dict.h>
#include "FreeRTOS.h"
#include "task.h"
extern UART_HandleTypeDef DEBUG_UART;
DICT_DEF2(
FuriStdglueCallbackDict,
@@ -29,6 +22,7 @@ static FuriStdglue* furi_stdglue = NULL;
static ssize_t stdout_write(void* _cookie, const char* data, size_t size) {
furi_assert(furi_stdglue);
bool consumed = false;
osKernelState_t state = osKernelGetState();
osThreadId_t thread_id = osThreadGetId();
if(state == osKernelRunning && thread_id &&
@@ -50,6 +44,7 @@ static ssize_t stdout_write(void* _cookie, const char* data, size_t size) {
FuriStdglueCallbackDict_get(furi_stdglue->thread_outputs, (uint32_t)thread_id);
if(callback_ptr) {
(*callback_ptr)(_cookie, data, size);
consumed = true;
}
furi_check(osMutexRelease(furi_stdglue->mutex) == osOK);
}
@@ -63,7 +58,7 @@ static ssize_t stdout_write(void* _cookie, const char* data, size_t size) {
return 0;
}
// Debug uart
HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)data, (uint16_t)size, HAL_MAX_DELAY);
if(!consumed) api_hal_console_tx((const uint8_t*)data, size);
// All data consumed
return size;
}