px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_flash.h : Internal FLASH write routines

Description

This component can clear and write a page of internal FLASH.

File(s):

These routines must always reside in the bootloader section. If mixing application code and bootloader code, the prefix BOOTLOADER_SECTION can be used to place these functions in a section called ".bootloader". See <avr/boot.h>

Example of setting ".bootloader" section address in Makefile:

LDFLAGS += -Wl,--section-start,.bootloader=0x1FF00

Macros

#define PX_FLASH_PAGE_SIZE   SPM_PAGESIZE
 FLASH Page size in bytes. More...
 
#define PX_FLASH_NR_OF_PAGES   ((PX_FLASHEND + 1) / PX_FLASH_PAGE_SIZE)
 Total number of FLASH pages (application and bootloader section) More...
 

Functions

void px_flash_erase_page (const uint16_t page)
 Function to erase a page. More...
 
void px_flash_wr_page (const uint16_t page, const uint8_t *data)
 Function to write a page. More...
 

Macro Definition Documentation

◆ PX_FLASH_PAGE_SIZE

#define PX_FLASH_PAGE_SIZE   SPM_PAGESIZE

FLASH Page size in bytes.

Definition at line 56 of file px_flash.h.

◆ PX_FLASH_NR_OF_PAGES

#define PX_FLASH_NR_OF_PAGES   ((PX_FLASHEND + 1) / PX_FLASH_PAGE_SIZE)

Total number of FLASH pages (application and bootloader section)

Definition at line 59 of file px_flash.h.

Function Documentation

◆ px_flash_erase_page()

void px_flash_erase_page ( const uint16_t  page)

Function to erase a page.

Parameters
page0 to (PX_FLASH_NR_OF_PAGES - 1)

Definition at line 39 of file px_flash.c.

◆ px_flash_wr_page()

void px_flash_wr_page ( const uint16_t  page,
const uint8_t *  data 
)

Function to write a page.

Parameters
page0 to (PX_FLASH_NR_OF_PAGES - 1)
dataPointer to buffer containing data to write

Definition at line 60 of file px_flash.c.