[FL-2263] Flasher service & RAM exec (#1006)
* WIP on stripping fw * Compact FW build - use RAM_EXEC=1 COMPACT=1 DEBUG=0 * Fixed uninitialized storage struct; small fixes to compact fw * Flasher srv w/mocked flash ops * Fixed typos & accomodated FFF changes * Alternative fw startup branch * Working load & jmp to RAM fw * +manifest processing for stage loader; + crc verification for stage payload * Fixed questionable code & potential leaks * Lowered screen update rate; added radio stack update stubs; working dfu write * Console EP with manifest & stage validation * Added microtar lib; minor ui fixes for updater * Removed microtar * Removed mtar #2 * Added a better version of microtar * TAR archive api; LFS backup & restore core * Recursive backup/restore * LFS worker thread * Added system apps to loader - not visible in UI; full update process with restarts * Typo fix * Dropped BL & f6; tooling for updater WIP * Minor py fixes * Minor fixes to make it build after merge * Ported flash workaround from BL + fixed visuals * Minor cleanup * Chmod + loader app search fix * Python linter fix * Removed usb stuff & float read support for staged loader == -10% of binary size * Added backup/restore & update pb requests * Added stub impl to RPC for backup/restore/update commands * Reworked TAR to use borrowed Storage api; slightly reduced build size by removing `static string`; hidden update-related RPC behind defines * Moved backup&restore to storage * Fixed new message types * Backup/restore/update RPC impl * Moved furi_hal_crc to LL; minor fixes * CRC HAL rework to LL * Purging STM HAL * Brought back minimal DFU boot mode (no gui); additional crc state checks * Added splash screen, BROKEN usb function * Clock init rework WIP * Stripped graphics from DFU mode * Temp fix for unused static fun * WIP update picker - broken! * Fixed UI * Bumping version * Fixed RTC setup * Backup to update folder instead of ext root * Removed unused scenes & more usb remnants from staged loader * CI updates * Fixed update bundle name * Temporary restored USB handler * Attempt to prevent .text corruption * Comments on how I spent this Saturday * Added update file icon * Documentation updates * Moved common code to lib folder * Storage: more unit tests * Storage: blocking dir open, differentiate file and dir when freed. * Major refactoring; added input processing to updater to allow retrying on failures (not very useful prob). Added API for extraction of thread return value * Removed re-init check for manifest * Changed low-level path manipulation to toolbox/path.h; makefile cleanup; tiny fix in lint.py * Increased update worker stack size * Text fixes in backup CLI * Displaying number of update stages to run; removed timeout in handling errors * Bumping version * Added thread cleanup for spawner thread * Updated build targets to exclude firmware bundle from 'ALL' * Fixed makefile for update_package; skipping VCP init for update mode (ugly) * Switched github build from ALL to update_package * Added +x for dist_update.sh * Cli: add total heap size to "free" command * Moved (RAM) suffix to build version instead of git commit no. * DFU comment * Some fixes suggested by clang-tidy * Fixed recursive PREFIX macro * Makefile: gather all new rules in updater namespace. FuriHal: rename bootloader to boot, isr safe delays * Github: correct build target name in firmware build * FuriHal: move target switch to boot * Makefile: fix firmware flash * Furi, FuriHal: move kernel start to furi, early init * Drop bootloader related stuff * Drop cube. Drop bootloader linker script. * Renamed update_hl, moved constants to #defines * Moved update-related boot mode to separate bitfield * Reworked updater cli to single entry point; fixed crash on tar cleanup * Added Python replacement for dist shell scripts * Linter fixes for dist.py +x * Fixes for environment suffix * Dropped bash scripts * Added dirty build flag to version structure & interfaces * Version string escapes * Fixed flag logic in dist.py; added support for App instances being imported and not terminating the whole program * Fixed fw address in ReadMe.md * Rpc: fix crash on double screen start * Return back original boot behavior and fix jump to system bootloader * Cleanup code, add error sequence for RTC * Update firmware readme * FuriHal: drop boot, restructure RTC registers usage and add header register check * Furi goes first * Toolchain: add ccache support * Renamed update bundle dir Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
#endif
|
||||
|
||||
#include "furi_hal_bootloader.h"
|
||||
#include "furi_hal_clock.h"
|
||||
#include "furi_hal_crypto.h"
|
||||
#include "furi_hal_console.h"
|
||||
@@ -40,12 +39,27 @@ template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
#include "furi_hal_uart.h"
|
||||
#include "furi_hal_info.h"
|
||||
#include "furi_hal_random.h"
|
||||
#include "furi_hal_crc.h"
|
||||
|
||||
/** Init furi_hal */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Early FuriHal init, only essential subsystems */
|
||||
void furi_hal_init_early();
|
||||
|
||||
/** Early FuriHal deinit */
|
||||
void furi_hal_deinit_early();
|
||||
|
||||
/** Init FuriHal */
|
||||
void furi_hal_init();
|
||||
|
||||
/**
|
||||
* Init critical parts of furi_hal
|
||||
* That code should not use memory allocations
|
||||
/** Transfer execution to address
|
||||
*
|
||||
* @param[in] address pointer to new executable
|
||||
*/
|
||||
void furi_hal_init_critical();
|
||||
void furi_hal_switch(void* address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* @file furi_hal_bootloader.h
|
||||
* Bootloader HAL API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Boot modes */
|
||||
typedef enum { FuriHalBootloaderModeNormal, FuriHalBootloaderModeDFU } FuriHalBootloaderMode;
|
||||
|
||||
/** Initialize boot subsystem
|
||||
*/
|
||||
void furi_hal_bootloader_init();
|
||||
|
||||
/** Set bootloader mode
|
||||
*
|
||||
* @param[in] mode FuriHalBootloaderMode
|
||||
*/
|
||||
void furi_hal_bootloader_set_mode(FuriHalBootloaderMode mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -6,16 +6,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t instructions_per_us;
|
||||
/** Init Delay subsystem */
|
||||
void furi_hal_delay_init();
|
||||
|
||||
/** Init DWT
|
||||
*/
|
||||
void furi_hal_delay_init(void);
|
||||
/** Get instructions per microsecond count */
|
||||
uint32_t furi_hal_delay_instructions_per_microsecond();
|
||||
|
||||
/** Increase tick counter.
|
||||
* Should be called from SysTick ISR
|
||||
|
@@ -13,8 +13,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Init I2C
|
||||
*/
|
||||
/** Early Init I2C */
|
||||
void furi_hal_i2c_init_early();
|
||||
|
||||
/** Early DeInit I2C */
|
||||
void furi_hal_i2c_deinit_early();
|
||||
|
||||
/** Init I2C */
|
||||
void furi_hal_i2c_init();
|
||||
|
||||
/** Acquire i2c bus handle
|
||||
|
@@ -24,6 +24,12 @@ void furi_hal_light_init();
|
||||
*/
|
||||
void furi_hal_light_set(Light light, uint8_t value);
|
||||
|
||||
/** Execute sequence
|
||||
*
|
||||
* @param sequence Sequence to execute
|
||||
*/
|
||||
void furi_hal_light_sequence(const char* sequence);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -31,15 +31,32 @@ typedef enum {
|
||||
} FuriHalRtcFlag;
|
||||
|
||||
typedef enum {
|
||||
FuriHalRtcRegisterBoot,
|
||||
FuriHalRtcRegisterBootVersion,
|
||||
FuriHalRtcRegisterSystem,
|
||||
FuriHalRtcRegisterSystemVersion,
|
||||
FuriHalRtcRegisterLfsFingerprint,
|
||||
FuriHalRtcRegisterFaultData,
|
||||
FuriHalRtcRegisterPinFails,
|
||||
FuriHalRtcBootModeNormal = 0, /**< Normal boot mode, default value */
|
||||
FuriHalRtcBootModeDfu, /**< Boot to DFU (MCU bootloader by ST) */
|
||||
FuriHalRtcBootModePreUpdate, /**< Boot to Update, pre update */
|
||||
FuriHalRtcBootModeUpdate, /**< Boot to Update, main */
|
||||
FuriHalRtcBootModePostUpdate, /**< Boot to Update, post update */
|
||||
} FuriHalRtcBootMode;
|
||||
|
||||
typedef enum {
|
||||
FuriHalRtcRegisterHeader, /**< RTC structure header */
|
||||
FuriHalRtcRegisterSystem, /**< Various system bits */
|
||||
FuriHalRtcRegisterVersion, /**< Pointer to Version */
|
||||
FuriHalRtcRegisterLfsFingerprint, /**< LFS geometry fingerprint */
|
||||
FuriHalRtcRegisterFaultData, /**< Pointer to last fault message */
|
||||
FuriHalRtcRegisterPinFails, /**< Failed pins count */
|
||||
/* Index of FS directory entry corresponding to FW update to be applied */
|
||||
FuriHalRtcRegisterUpdateFolderFSIndex,
|
||||
|
||||
FuriHalRtcRegisterMAX, /**< Service value, do not use */
|
||||
} FuriHalRtcRegister;
|
||||
|
||||
/** Early initialization */
|
||||
void furi_hal_rtc_init_early();
|
||||
|
||||
/** Early deinitialization */
|
||||
void furi_hal_rtc_deinit_early();
|
||||
|
||||
/** Initialize RTC subsystem */
|
||||
void furi_hal_rtc_init();
|
||||
|
||||
@@ -57,6 +74,10 @@ void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag);
|
||||
|
||||
bool furi_hal_rtc_is_flag_set(FuriHalRtcFlag flag);
|
||||
|
||||
void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode);
|
||||
|
||||
FuriHalRtcBootMode furi_hal_rtc_get_boot_mode();
|
||||
|
||||
void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime);
|
||||
|
||||
void furi_hal_rtc_get_datetime(FuriHalRtcDateTime* datetime);
|
||||
|
@@ -7,6 +7,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Early initialize SPI HAL */
|
||||
void furi_hal_spi_init_early();
|
||||
|
||||
/** Early deinitialize SPI HAL */
|
||||
void furi_hal_spi_deinit_early();
|
||||
|
||||
/** Initialize SPI HAL */
|
||||
void furi_hal_spi_init();
|
||||
|
||||
@@ -99,4 +105,4 @@ bool furi_hal_spi_bus_trx(
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -70,55 +70,55 @@ const char* furi_hal_version_get_model_name();
|
||||
*
|
||||
* @return OTP Version
|
||||
*/
|
||||
const FuriHalVersionOtpVersion furi_hal_version_get_otp_version();
|
||||
FuriHalVersionOtpVersion furi_hal_version_get_otp_version();
|
||||
|
||||
/** Get hardware version
|
||||
*
|
||||
* @return Hardware Version
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_version();
|
||||
uint8_t furi_hal_version_get_hw_version();
|
||||
|
||||
/** Get hardware target
|
||||
*
|
||||
* @return Hardware Target
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_target();
|
||||
uint8_t furi_hal_version_get_hw_target();
|
||||
|
||||
/** Get hardware body
|
||||
*
|
||||
* @return Hardware Body
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_body();
|
||||
uint8_t furi_hal_version_get_hw_body();
|
||||
|
||||
/** Get hardware body color
|
||||
*
|
||||
* @return Hardware Color
|
||||
*/
|
||||
const FuriHalVersionColor furi_hal_version_get_hw_color();
|
||||
FuriHalVersionColor furi_hal_version_get_hw_color();
|
||||
|
||||
/** Get hardware connect
|
||||
*
|
||||
* @return Hardware Interconnect
|
||||
*/
|
||||
const uint8_t furi_hal_version_get_hw_connect();
|
||||
uint8_t furi_hal_version_get_hw_connect();
|
||||
|
||||
/** Get hardware region
|
||||
*
|
||||
* @return Hardware Region
|
||||
*/
|
||||
const FuriHalVersionRegion furi_hal_version_get_hw_region();
|
||||
FuriHalVersionRegion furi_hal_version_get_hw_region();
|
||||
|
||||
/** Get hardware display id
|
||||
*
|
||||
* @return Display id
|
||||
*/
|
||||
const FuriHalVersionDisplay furi_hal_version_get_hw_display();
|
||||
FuriHalVersionDisplay furi_hal_version_get_hw_display();
|
||||
|
||||
/** Get hardware timestamp
|
||||
*
|
||||
* @return Hardware Manufacture timestamp
|
||||
*/
|
||||
const uint32_t furi_hal_version_get_hw_timestamp();
|
||||
uint32_t furi_hal_version_get_hw_timestamp();
|
||||
|
||||
/** Get pointer to target name
|
||||
*
|
||||
@@ -144,12 +144,6 @@ const char* furi_hal_version_get_ble_local_device_name_ptr();
|
||||
*/
|
||||
const uint8_t* furi_hal_version_get_ble_mac();
|
||||
|
||||
/** Get address of version structure of bootloader, stored in chip flash.
|
||||
*
|
||||
* @return Address of boot version structure.
|
||||
*/
|
||||
const struct Version* furi_hal_version_get_bootloader_version();
|
||||
|
||||
/** Get address of version structure of firmware.
|
||||
*
|
||||
* @return Address of firmware version structure.
|
||||
|
Reference in New Issue
Block a user