MT7687 API Reference  LinkIt SDK v4
FLASH

This section describes the programming interfaces of the FLASH driver. More...

Overview

This section describes the programming interfaces of the FLASH driver.

Terms and acronyms

The following provides descriptions to the terms commonly used in the FLASH driver and how to use its various functions.

Terms Details
XIP eXecute In Place: A method of executing programs directly from long term storage rather than copying it into the RAM

Supported features

The general purpose of FLASH is to save data into the embedded FLASH storage and read them back. The features supported by this module are listed below:

How to use this driver

Functions

hal_flash_status_t hal_flash_init (void)
 flash init More...
 
hal_flash_status_t hal_flash_deinit (void)
 flash deinit More...
 
hal_flash_status_t hal_flash_erase (uint32_t start_address, hal_flash_block_t block_type)
 flash erase More...
 
hal_flash_status_t hal_flash_read (uint32_t start_address, uint8_t *buffer, uint32_t length)
 flash read More...
 
hal_flash_status_t hal_flash_write (uint32_t address, const uint8_t *data, uint32_t length)
 flash write More...
 

Modules

 Enum
 

Function Documentation

hal_flash_status_t hal_flash_deinit ( void  )

flash deinit

Returns
HAL_FLASH_STATUS_OK on success
hal_flash_status_t hal_flash_erase ( uint32_t  start_address,
hal_flash_block_t  block_type 
)

flash erase

Parameters
[in]start_addressis starting address to erase from
[in]block_typeis the size of block to be erased
Returns
HAL_FLASH_STATUS_OK on success
Note
The start_address should be align with the block_type
hal_flash_status_t hal_flash_init ( void  )

flash init

Returns
HAL_FLASH_STATUS_OK on success
hal_flash_status_t hal_flash_read ( uint32_t  start_address,
uint8_t *  buffer,
uint32_t  length 
)

flash read

Parameters
[in]start_addressis starting address to read the data from
[out]bufferis place to hold the incoming data
[in]lengthis the length of the data content
Returns
HAL_FLASH_STATUS_OK on success
hal_flash_status_t hal_flash_write ( uint32_t  address,
const uint8_t *  data,
uint32_t  length 
)

flash write

Parameters
[in]addressis starting address to write from.Before the address can be written to for the first time, the address located sector or block must first be erased.
[in]lengthis data length
[in]datais source data to be written
Returns
HAL_FLASH_STATUS_OK on success