STM8L15x Standard Peripherals Drivers: Option Bytes Programming functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Option Bytes Programming functions

Option Bytes Programming functions. More...

Functions

void FLASH_EraseOptionByte (uint16_t Address)
 Erases option byte.
uint16_t FLASH_GetBootSize (void)
 Returns the Boot memory size in bytes.
uint16_t FLASH_GetCodeSize (void)
 Returns the Code Area size in bytes.
FunctionalState FLASH_GetReadOutProtectionStatus (void)
 Returns the FLASH Read Out Protection Status.
void FLASH_ProgramOptionByte (uint16_t Address, uint8_t Data)
 Programs option byte.

Detailed Description

Option Bytes Programming functions.

 ===============================================================================
                        Option Bytes Programming functions
 ===============================================================================  

   The FLASH_Option Bytes Programming_functions, includes the following functions:

   - void FLASH_ProgramOptionByte(uint16_t Address, uint8_t Data);
   - void FLASH_EraseOptionByte(uint16_t Address);
   - FunctionalState FLASH_GetReadOutProtectionStatus(void);
   - uint16_t FLASH_GetBootSize(void);
   - uint16_t FLASH_GetCodeSize(void);
   
   Any operation of erase or program should follow these steps:
   
   1. Call the FLASH_Unlock(FLASH_MemType_Data); function to enable the Flash 
      option control register access
   
   2. Call the desired function to erase or program data
      - void FLASH_ProgramOptionByte(uint16_t Address, uint8_t Data); => to program
        the option byte Address with the desired Data value.  
      - void FLASH_EraseOptionByte(uint16_t Address); => to erase the option byte
        Address. 			 
   
   3. Once all needed option bytes to be programmed are correctly written, call the
      FLASH_Lock(FLASH_MemType_Data) to disable the memory access ( It is recommended to
      protect the FLASH memory against possible unwanted operation)


Function Documentation

void FLASH_EraseOptionByte ( uint16_t  Address)

Erases option byte.

Parameters:
Address: Option byte address to erase
Return values:
None

Definition at line 432 of file stm8l15x_flash.c.

References FLASH, FLASH_CLEAR_BYTE, FLASH_CR2_OPT, FLASH_MemType_Program, IS_OPTION_BYTE_ADDRESS, and PointerAttr.

uint16_t FLASH_GetBootSize ( void  )

Returns the Boot memory size in bytes.

Parameters:
None
Return values:
Bootmemory size in bytes

Definition at line 478 of file stm8l15x_flash.c.

References OPT.

uint16_t FLASH_GetCodeSize ( void  )

Returns the Code Area size in bytes.

Parameters:
None
Return values:
CodeArea size in bytes

Definition at line 502 of file stm8l15x_flash.c.

References OPT.

FunctionalState FLASH_GetReadOutProtectionStatus ( void  )

Returns the FLASH Read Out Protection Status.

Parameters:
None
Return values:
FLASHRead Out Protection Status. This parameter can be a ENABLE or DISABLE

Definition at line 455 of file stm8l15x_flash.c.

References DISABLE, ENABLE, FLASH_READOUTPROTECTION_KEY, and OPT.

void FLASH_ProgramOptionByte ( uint16_t  Address,
uint8_t  Data 
)

Programs option byte.

Parameters:
Address: option byte address to program
Data: Value to write
Return values:
None

Definition at line 410 of file stm8l15x_flash.c.

References FLASH, FLASH_CR2_OPT, FLASH_MemType_Program, IS_OPTION_BYTE_ADDRESS, and PointerAttr.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com