evk_flash.h
This module is composed of all functionalities related to the MCU’s flash memory.
- Copyright
Copyright (C) 2020-2021 SPARK Microsystems International Inc. All rights reserved.
- License
This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.
- Author
SPARK FW Team.
Defines
-
EVK_FLASH_COUNTER (__COUNTER__ - EVK_FLASH_COUNTER_BASE)
Create a local counter macro.
-
EVK_FLASH_GENERATE_ERR_CODE (-(EVK_FLASH_COUNTER + 1))
Automatically increase error count each time invoked. Starts at -(0 + 1) = -1.
Typedefs
-
typedef enum evk_flash_error evk_flash_error_t
Flash error status.
Enums
-
enum evk_flash_error
Flash error status.
Values:
-
enumerator EVK_FLASH_ERR_NONE = 0
No error was detected.
-
enumerator EVK_FLASH_ERR = EVK_FLASH_GENERATE_ERR_CODE
Write flash error.
-
enumerator EVK_FLASH_ERR_BUSY = EVK_FLASH_GENERATE_ERR_CODE
Flash is busy.
-
enumerator EVK_FLASH_ERR_TIMEOUT = EVK_FLASH_GENERATE_ERR_CODE
Flash write/read timeout.
-
enumerator EVK_FLASH_ERR_ARGUMENT = EVK_FLASH_GENERATE_ERR_CODE
Flash function argument error.
-
enumerator EVK_FLASH_ERR_UNKNOWN = EVK_FLASH_GENERATE_ERR_CODE
There is an unknown error occurring.
-
enumerator EVK_FLASH_ERR_NONE = 0
Functions
-
evk_flash_error_t evk_flash_prog(uint32_t address, const void *buffer, uint32_t size)
Program a region in a block of the MCU’s flash memory.
Note
The block must be previously erased.
- Parameters:
address – [in] Flash memory address to write.
buffer – [in] Buffer to write.
size – [in] Size of the buffer.
- Returns:
The EVK error code.
-
evk_flash_error_t evk_flash_erase(uint32_t address)
Erase a memory block of the MCU’s flash memory.
Note
The state of an erased block is undefined. A block must be erased before being programmed.
- Parameters:
address – [in] The address of the flash memory.
- Returns:
The EVK error code.