Add a production-ready, educational bootloader extension for STM32 MCUs. Core features: - Custom binary protocol with CRC16/CRC32 verification - AES-256 encryption for firmware security - Dual-bank firmware management with rollback support - Version management and firmware validation - Modular architecture with BSP abstraction layer Project structure: - include/: Header files (bootloader.h, bsp_flash.h, bsp_uart.h) - src/: Core implementation (bootloader, protocol, crypto, firmware manager) - port/: MCU-specific adaptation layer (STM32F4xx) - docs/: Documentation (integration guide, porting guide) Supported platforms: - STM32F4xx (primary) - STM32F1xx (via porting) Quick start: 1. Copy extension module to project 2. Configure bootloader_config.h 3. Modify linker script for APP_BASE_ADDR 4. Build and flash bootloader to 0x08000000 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
884 B
C
26 lines
884 B
C
#ifndef BSP_FLASH_H
|
|
#define BSP_FLASH_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct {
|
|
int (*init)(void);
|
|
int (*read)(uint32_t address, uint8_t *buffer, uint32_t length);
|
|
int (*write)(uint32_t address, const uint8_t *data, uint32_t length);
|
|
int (*erase)(uint32_t address, uint32_t length);
|
|
bool (*verify)(uint32_t address, const uint8_t *data, uint32_t length);
|
|
} bsp_flash_ops_t;
|
|
|
|
void bsp_flash_register(const bsp_flash_ops_t *ops);
|
|
int bsp_flash_init(void);
|
|
int bsp_flash_erase(uint32_t address, uint32_t length);
|
|
int bsp_flash_write(uint32_t address, const uint8_t *data, uint32_t length);
|
|
int bsp_flash_read(uint32_t address, uint8_t *buffer, uint32_t length);
|
|
bool bsp_flash_verify(uint32_t address, const uint8_t *data, uint32_t length);
|
|
|
|
|
|
bool bsp_flash_is_app_addr(uint32_t address);
|
|
bool bsp_flash_check_app_valid(uint32_t app_addr);
|
|
#endif
|