FLASH_Write_Protection
[STM32F10x_StdPeriph_Examples]

Defines

#define BANK1_WRITE_END_ADDR   ((uint32_t)0x08008000)
#define BANK1_WRITE_START_ADDR   ((uint32_t)0x08006000)
#define FLASH_PAGE_SIZE   ((uint16_t)0x400)
#define FLASH_PAGES_TO_BE_PROTECTED   (FLASH_WRProt_Pages24to27 | FLASH_WRProt_Pages28to31)
#define WRITE_PROTECTION_DISABLE

Enumerations

enum  TestStatus {
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED
}

Functions

void BusFault_Handler (void)
 This function handles Bus Fault exception.
void DebugMon_Handler (void)
 This function handles Debug Monitor exception.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void MemManage_Handler (void)
 This function handles Memory Manage exception.
void NMI_Handler (void)
 This function handles NMI exception.
void PendSV_Handler (void)
 This function handles PendSV_Handler exception.
void SVC_Handler (void)
 This function handles SVCall exception.
void SysTick_Handler (void)
 This function handles SysTick Handler.
void UsageFault_Handler (void)
 This function handles Usage Fault exception.

Variables

uint32_t Address = 0x0
uint16_t Data = 0x1753
uint32_t EraseCounter = 0x0
volatile FLASH_Status FLASHStatus = FLASH_COMPLETE
volatile TestStatus MemoryProgramStatus = PASSED
uint32_t NbrOfPage
uint32_t ProtectedPages = 0x0
uint32_t WRPR_Value = 0xFFFFFFFF

Define Documentation

#define BANK1_WRITE_END_ADDR   ((uint32_t)0x08008000)
#define BANK1_WRITE_START_ADDR   ((uint32_t)0x08006000)
#define FLASH_PAGE_SIZE   ((uint16_t)0x400)
#define FLASH_PAGES_TO_BE_PROTECTED   (FLASH_WRProt_Pages24to27 | FLASH_WRProt_Pages28to31)

Definition at line 42 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/main.c.

Referenced by main().

#define WRITE_PROTECTION_DISABLE

Enumeration Type Documentation

enum TestStatus
Enumerator:
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 

Definition at line 33 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/main.c.


Function Documentation

void BusFault_Handler ( void   ) 

This function handles Bus Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 85 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void DebugMon_Handler ( void   ) 

This function handles Debug Monitor exception.

Parameters:
None 
Return values:
None 

Definition at line 120 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void HardFault_Handler ( void   ) 

This function handles Hard Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 59 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

int main ( void   ) 

Main program.

Parameters:
None 
Return values:
None 

< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file

Definition at line 72 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/main.c.

References Address, BANK1_WRITE_END_ADDR, BANK1_WRITE_START_ADDR, Data, EraseCounter, FAILED, FLASH_ClearFlag(), FLASH_COMPLETE, FLASH_EnableWriteProtection(), FLASH_EraseOptionBytes(), FLASH_ErasePage(), FLASH_FLAG_BSY, FLASH_FLAG_EOP, FLASH_FLAG_PGERR, FLASH_FLAG_WRPRTERR, FLASH_GetWriteProtectionOptionByte(), FLASH_PAGE_SIZE, FLASH_PAGES_TO_BE_PROTECTED, FLASH_ProgramHalfWord(), FLASH_Unlock(), FLASHStatus, MemoryProgramStatus, NbrOfPage, ProtectedPages, and WRPR_Value.

void MemManage_Handler ( void   ) 

This function handles Memory Manage exception.

Parameters:
None 
Return values:
None 

Definition at line 72 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void NMI_Handler ( void   ) 

This function handles NMI exception.

Parameters:
None 
Return values:
None 

Definition at line 50 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void PendSV_Handler ( void   ) 

This function handles PendSV_Handler exception.

Parameters:
None 
Return values:
None 

Definition at line 129 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void SVC_Handler ( void   ) 

This function handles SVCall exception.

Parameters:
None 
Return values:
None 

Definition at line 111 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void SysTick_Handler ( void   ) 

This function handles SysTick Handler.

Parameters:
None 
Return values:
None 

Definition at line 138 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.

void UsageFault_Handler ( void   ) 

This function handles Usage Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 98 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/stm32f10x_it.c.


Variable Documentation

uint32_t Address = 0x0
uint16_t Data = 0x1753
uint32_t EraseCounter = 0x0
volatile FLASH_Status FLASHStatus = FLASH_COMPLETE
volatile TestStatus MemoryProgramStatus = PASSED
uint32_t NbrOfPage
uint32_t ProtectedPages = 0x0

Definition at line 59 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/main.c.

Referenced by main().

uint32_t WRPR_Value = 0xFFFFFFFF

Definition at line 59 of file STM32F10x_StdPeriph_Examples/FLASH/Write_Protection/main.c.

Referenced by main().

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32