![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
cfg_store flash backend for the STM32WB55, safe with the BLE stack running on the CPU2 (AN5289, "Flash memory management"). More...
#include "cfg_store.h"#include "main.h"#include "cmsis_os2.h"#include "hw_conf.h"#include <string.h>Go to the source code of this file.
Macros | |
| #define | CFG_PAGE0_ADDR 0x0807E000u |
| #define | CFG_PAGE_SIZE 0x1000u |
Enumerations | |
| enum | op_t { OP_ERASE , OP_PROGRAM } |
Functions | |
| const void * | cfg_flash_page (int page) |
| memory-mapped page | |
| static int | single_op (op_t op, uint32_t addr, uint64_t dw) |
| int | cfg_flash_write (int page, const void *data, uint32_t len) |
| erase + program; 0 = ok | |
Variables | |
| volatile uint8_t | g_cpu2_ready |
cfg_store flash backend for the STM32WB55, safe with the BLE stack running on the CPU2 (AN5289, "Flash memory management").
Pages: the last two 4 KB pages of the CPU1 application area, 0x0807E000 and 0x0807F000. The linker script keeps them out of FLASH (STM32WB55RGVX_FLASH.ld: FLASH LENGTH = 504K).
Every erase and every double-word program is one "single flash operation":
Called only by the AppTask, only while disarmed: a page erase stalls the CPU1 for ~22 ms (the IMU FIFO absorbs it, the IWDG window is 500 ms).
Definition in file cfg_flash_wb.c.
| #define CFG_PAGE0_ADDR 0x0807E000u |
Definition at line 36 of file cfg_flash_wb.c.
| #define CFG_PAGE_SIZE 0x1000u |
Definition at line 37 of file cfg_flash_wb.c.
| enum op_t |
| Enumerator | |
|---|---|
| OP_ERASE | |
| OP_PROGRAM | |
Definition at line 47 of file cfg_flash_wb.c.
| const void * cfg_flash_page | ( | int | page | ) |
memory-mapped page
Definition at line 41 of file cfg_flash_wb.c.
References CFG_PAGE0_ADDR, CFG_PAGE_SIZE, and CFG_PAGES.
Referenced by cfg_flash_write(), cfg_load(), cfg_save(), and latest_page().
|
static |
Definition at line 49 of file cfg_flash_wb.c.
References addr(), OP_ERASE, and st().
Referenced by cfg_flash_write().
| int cfg_flash_write | ( | int | page, |
| const void * | data, | ||
| uint32_t | len | ||
| ) |
erase + program; 0 = ok
Definition at line 79 of file cfg_flash_wb.c.
References cfg_flash_page(), CFG_PAGE_SIZE, CFG_PAGES, g_cpu2_ready, off, OP_ERASE, OP_PROGRAM, and single_op().
Referenced by cfg_save().
| volatile uint8_t g_cpu2_ready |
Definition at line 39 of file cfg_flash_wb.c.
Referenced by cfg_flash_write().