#include <stdint.h>
#include "stm32l4xx_hal.h"
#include "stm32l4xx_hal_flash.h"
Go to the source code of this file.
◆ STM32_INTERNAL_FLASH_memory_region_addresses_t
Flash Partitions.
- Note
- look in the STM32L4R5ZITx_FLASH.ld file to see the address of each partition, update this as needed
| Enumerator |
|---|
| STM32_INTERNAL_FLASH_MEMORY_REGION_RAM_ADDRESS | |
| STM32_INTERNAL_FLASH_MEMORY_REGION_RAM_2_ADDRESS | |
| STM32_INTERNAL_FLASH_MEMORY_REGION_RAM_3_ADDRESS | |
| STM32_INTERNAL_FLASH_MEMORY_REGION_FLASH_ADDRESS | |
| STM32_INTERNAL_FLASH_MEMORY_REGION_GOLDEN_COPY_ADDRESS | |
◆ STM32_internal_flash_erase()
| uint8_t STM32_internal_flash_erase |
( |
uint16_t | start_page_erase, |
|
|
uint16_t | number_of_pages_to_erase, |
|
|
uint32_t * | page_error ) |
Erase pages from bank 2 of flash memory which is located at 0x08100000.
- Parameters
-
| start_page_erase | what page to start erasing from |
| number_of_pages_to_erase | how many pages to erase |
| page_error | address of page which failed on error, defaults to UINT32_MAX on success |
- Returns
- 0 on success, 1 if HAL_FLASH_Unlock() failed, 2 if HAL_FLASH_Lock() failed
◆ STM32_internal_flash_get_active_flash_bank()
| uint8_t STM32_internal_flash_get_active_flash_bank |
( |
| ) |
|
Returns active flash bank.
- Returns
- 1 is Flash Bank 1, 2 is Flash Bank 2
◆ STM32_internal_flash_get_option_bytes()
| uint8_t STM32_internal_flash_get_option_bytes |
( |
FLASH_OBProgramInitTypeDef * | ob_data | ) |
|
Gets option bytes configuration from the stm32 internal flash memory.
- Parameters
-
| ob_data | pointer to an FLASH_OBProgramInitTypeDef structure that contains the configuration information for the programming. |
- Returns
- 0 always
◆ STM32_internal_flash_read()
| uint8_t STM32_internal_flash_read |
( |
uint32_t | address, |
|
|
uint8_t * | buffer, |
|
|
uint32_t | length ) |
Reads data from the flash memory.
- Parameters
-
| address | address to start reading from |
| buffer | buffer to store the read data, must be length long |
| length | number of bytes to read |
- Returns
- 0 on success, > 0 on error
◆ STM32_internal_flash_set_active_flash_bank()
| uint8_t STM32_internal_flash_set_active_flash_bank |
( |
uint8_t | wanted_active_flash_bank | ) |
|
Sets the active flash bank to either 1 or 2 (only if it is different than the current active flash bank).
On Success, will load application in desired flash bank
By Default, the active flash bank is 1
- Parameters
-
| wanted_active_flash_bank | 1 or 2 |
- Returns
- 0 on success, > 0 otherwise
◆ STM32_internal_flash_write()
Writes data to the flash memory in chunks of 8 bytes.
- Parameters
-
| address | Address in the flash memory where the data will be written. |
| data | uint8_t buffer containing the data to be written. |
| length | Length of the data to be written. |
- Returns
- 0 on success, > 0 on error
- Note
- Currently, only allowed to write to golden copy region
-
Writes data in chunks of 8 bytes. Ex: Suppose we wanted to write to address 0x00, and suppose that at address 0x00, the first 8 bytes looks like the following: [1,2,3,4,5,6,7,8]. If we wanted to write [25,26,27,28], it would result in the following: [25,26,27,28,0,0,0,0], clearing the rest of the bytes.