CTS-SAT-1-OBC-Firmware
|
#include <string.h>
#include "stm32/stm32_internal_flash_drivers.h"
#include "stm32l4r5xx.h"
#include "stm32l4xx_hal.h"
#include "stm32l4xx_hal_flash.h"
#include "stm32l4xx_hal_flash_ex.h"
Functions | |
uint8_t | STM32_internal_flash_write (uint32_t address, uint8_t *data, uint32_t length, STM32_Internal_Flash_Write_Status_t *status) |
Writes data to the flash memory in chunks of 8 bytes. | |
uint8_t | STM32_internal_flash_read (uint32_t address, uint8_t *buffer, uint32_t length) |
Reads data from the flash memory. | |
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. | |
uint8_t | STM32_internal_flash_get_option_bytes (FLASH_OBProgramInitTypeDef *ob_data) |
Gets option bytes configuration from the stm32 internal flash memory. | |
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). | |
uint8_t | STM32_internal_flash_get_active_flash_bank () |
Returns active flash bank. | |
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.
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 |
uint8_t STM32_internal_flash_get_active_flash_bank | ( | ) |
Returns active flash bank.
uint8_t STM32_internal_flash_get_option_bytes | ( | FLASH_OBProgramInitTypeDef * | ob_data | ) |
Gets option bytes configuration from the stm32 internal flash memory.
ob_data | pointer to an FLASH_OBProgramInitTypeDef structure that contains the configuration information for the programming. |
uint8_t STM32_internal_flash_read | ( | uint32_t | address, |
uint8_t * | buffer, | ||
uint32_t | length ) |
Reads data from the flash memory.
address | address to start reading from |
buffer | buffer to store the read data, must be length long |
length | number of bytes to read |
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
wanted_active_flash_bank | 1 or 2 |
uint8_t STM32_internal_flash_write | ( | uint32_t | address, |
uint8_t * | data, | ||
uint32_t | length, | ||
STM32_Internal_Flash_Write_Status_t * | status ) |
Writes data to the flash memory in chunks of 8 bytes.
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. |