|
PER Firmware
|
STM32G4 internal-flash public API. More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Functions | |
| bool | PHAL_FLASH_read (uint32_t address, void *destination, uint32_t length_bytes) |
| Copy bytes from internal flash into a buffer. | |
| bool | PHAL_FLASH_write (uint32_t address, const void *source, uint32_t length_bytes) |
| Program bytes into erased internal flash. | |
| bool | PHAL_FLASH_erase (uint32_t address, uint32_t length_bytes) |
| Erase every internal flash page touched by a range. | |
Variables | |
| static constexpr uint32_t | PHAL_FLASH_WRITE_ALIGNMENT_BYTES = 8U |
STM32G4 internal-flash public API.
The public layer accepts byte ranges and hides controller unlock, cache, bank, page, and status-register details in flash_priv.c.
| bool PHAL_FLASH_erase | ( | uint32_t | address, |
| uint32_t | length_bytes ) |
Erase every internal flash page touched by a range.
The address may be unaligned. Every complete page touched by the range is erased. A zero-length erase succeeds without modifying flash.
| address | Address of the first byte in the range. |
| length_bytes | Number of bytes in the range. |
| bool PHAL_FLASH_read | ( | uint32_t | address, |
| void * | destination, | ||
| uint32_t | length_bytes ) |
Copy bytes from internal flash into a buffer.
The requested range must be within internal flash. The address is a CPU address, not an offset from FLASH_BASE. A zero-length read succeeds without accessing either pointer.
| address | Address of the first byte to read. |
| destination | Buffer that receives the data. |
| length_bytes | Number of bytes to read. |
| bool PHAL_FLASH_write | ( | uint32_t | address, |
| const void * | source, | ||
| uint32_t | length_bytes ) |
Program bytes into erased internal flash.
The destination must be erased before writing. The complete programmed range is checked for erased-state bytes before any programming starts. A zero-length write succeeds without accessing either pointer.
| address | Address of the first byte to write; must be 8-byte aligned. |
| source | Buffer containing the data to write. |
| length_bytes | Number of bytes to write. |
|
staticconstexpr |
STM32G4 flash programming granularity.
Writes are padded with erased-state bytes (0xFF) to this size when the requested length is not a multiple of the programming granularity.