libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
Flash Defines

Defined Constants and Types for the SWM050 Flash API More...

Collaboration diagram for Flash Defines:

Functions

uint32_t flash_write (uint32_t *dest, uint32_t *src, uint8_t cnt)
 Write to the user flash. More...
 
uint32_t flash_read (uint32_t *src, uint32_t *dest, uint8_t cnt)
 Read from the user flash. More...
 
uint32_t flash_erase (void)
 Erase the user flash. More...
 

Detailed Description

Defined Constants and Types for the SWM050 Flash API

LGPL License Terms libopencm3 License

Function Documentation

◆ flash_erase()

uint32_t flash_erase ( void  )

Erase the user flash.

Erases the entire 0.5k user flash area. Must be performed only when the system clock is 18Mhz.

Returns
1 if successful, 0 if error

Definition at line 93 of file flash.c.

References iap_erase.

◆ flash_read()

uint32_t flash_read ( uint32_t *  src,
uint32_t *  dest,
uint8_t  cnt 
)

Read from the user flash.

Reads words from the 0.5k user flash area. Must be performed only when the system clock is 18Mhz.

Parameters
[in]srcSource address The memory area to copy from. From 0x00 - 0x1FC, as long as it is word-aligned
[out]destDestination address The memory area to copy to.
[in]cntNumber of words to read From 1 - 128 as long as (src + (cnt * 4)) < 0x200
Returns
1 if successful, 0 if error

Definition at line 79 of file flash.c.

References iap_write_read.

◆ flash_write()

uint32_t flash_write ( uint32_t *  dest,
uint32_t *  src,
uint8_t  cnt 
)

Write to the user flash.

Writes words to the 0.5k user flash area. Must be performed only when the system clock is 18Mhz.

Parameters
[in]destDestination address The memory area to copy to. From 0x00 - 0x1FC, as long as it is word-aligned
[in]srcSource address The memory area to copy from.
[in]cntNumber of words to write From 1-128 as long as (dest + (cnt * 4)) < 0x200
Returns
1 if successful, 0 if error

Definition at line 55 of file flash.c.

References iap_write_read.