Bootloader size optimizations (#873)

This commit is contained in:
hedger
2021-12-07 17:17:08 +03:00
committed by GitHub
parent 03d7476e4f
commit f54ae2597e
7 changed files with 11 additions and 51 deletions

View File

@@ -87,29 +87,7 @@ typedef struct {
static FuriHalVersion furi_hal_version = {0};
static void furi_hal_version_set_name(const char* name) {
if(name != NULL) {
strlcpy(furi_hal_version.name, name, FURI_HAL_VERSION_ARRAY_NAME_LENGTH);
snprintf(
furi_hal_version.device_name,
FURI_HAL_VERSION_DEVICE_NAME_LENGTH,
"xFlipper %s",
furi_hal_version.name);
} else {
snprintf(furi_hal_version.device_name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH, "xFlipper");
}
furi_hal_version.device_name[0] = 0;
// BLE Mac address
uint32_t udn = LL_FLASH_GetUDN();
uint32_t company_id = LL_FLASH_GetSTCompanyID();
uint32_t device_id = LL_FLASH_GetDeviceID();
furi_hal_version.ble_mac[0] = (uint8_t)(udn & 0x000000FF);
furi_hal_version.ble_mac[1] = (uint8_t)((udn & 0x0000FF00) >> 8);
furi_hal_version.ble_mac[2] = (uint8_t)((udn & 0x00FF0000) >> 16);
furi_hal_version.ble_mac[3] = (uint8_t)device_id;
furi_hal_version.ble_mac[4] = (uint8_t)(company_id & 0x000000FF);
furi_hal_version.ble_mac[5] = (uint8_t)((company_id & 0x0000FF00) >> 8);
}
static void furi_hal_version_load_otp_default() {

View File

@@ -194,10 +194,12 @@ void target_display_init() {
// Create payload
u8g2_ClearBuffer(&fb);
u8g2_SetDrawColor(&fb, 0x01);
u8g2_SetFont(&fb, u8g2_font_helvB08_tf);
u8g2_DrawXBM(&fb, 0, 64 - 50, 128, 50, I_DFU_128x50);
#ifndef SLIM_BOOTLOADER
u8g2_SetFont(&fb, u8g2_font_helvB08_tf);
u8g2_DrawStr(&fb, 2, 8, "Update & Recovery Mode");
u8g2_DrawStr(&fb, 2, 21, "DFU started");
#endif
// Send buffer
u8g2_SetPowerSave(&fb, 0);
u8g2_SendBuffer(&fb);

View File

@@ -87,29 +87,7 @@ typedef struct {
static FuriHalVersion furi_hal_version = {0};
static void furi_hal_version_set_name(const char* name) {
if(name != NULL) {
strlcpy(furi_hal_version.name, name, FURI_HAL_VERSION_ARRAY_NAME_LENGTH);
snprintf(
furi_hal_version.device_name,
FURI_HAL_VERSION_DEVICE_NAME_LENGTH,
"xFlipper %s",
furi_hal_version.name);
} else {
snprintf(furi_hal_version.device_name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH, "xFlipper");
}
furi_hal_version.device_name[0] = 0;
// BLE Mac address
uint32_t udn = LL_FLASH_GetUDN();
uint32_t company_id = LL_FLASH_GetSTCompanyID();
uint32_t device_id = LL_FLASH_GetDeviceID();
furi_hal_version.ble_mac[0] = (uint8_t)(udn & 0x000000FF);
furi_hal_version.ble_mac[1] = (uint8_t)((udn & 0x0000FF00) >> 8);
furi_hal_version.ble_mac[2] = (uint8_t)((udn & 0x00FF0000) >> 16);
furi_hal_version.ble_mac[3] = (uint8_t)device_id;
furi_hal_version.ble_mac[4] = (uint8_t)(company_id & 0x000000FF);
furi_hal_version.ble_mac[5] = (uint8_t)((company_id & 0x0000FF00) >> 8);
}
static void furi_hal_version_load_otp_default() {

View File

@@ -194,10 +194,12 @@ void target_display_init() {
// Create payload
u8g2_ClearBuffer(&fb);
u8g2_SetDrawColor(&fb, 0x01);
u8g2_SetFont(&fb, u8g2_font_helvB08_tf);
u8g2_DrawXBM(&fb, 0, 64 - 50, 128, 50, I_DFU_128x50);
#ifndef SLIM_BOOTLOADER
u8g2_SetFont(&fb, u8g2_font_helvB08_tf);
u8g2_DrawStr(&fb, 2, 8, "Update & Recovery Mode");
u8g2_DrawStr(&fb, 2, 21, "DFU started");
#endif
// Send buffer
u8g2_SetPowerSave(&fb, 0);
u8g2_SendBuffer(&fb);