group::FLASH

The flash memory software module allows the user code to read memory in the flash program space. Reading the flash is portable across all supported MCU’s. However, writing the flash is dependent on the MCU page size.

This interface is typically only used with the bootloader. The preferred way to access the flash is using the Memory (RAM/Flash) interface.

Details

defineFLASH_VERSION


defineFLASH_IOC_IDENT_CHAR


defineFLASH_MIN_WRITE_SIZE

This defines the MCU specific value for the minimum write size. This is also the minimum step and alignment size for writing the flash.


defineFLASH_MAX_WRITE_SIZE

This defines the MCU specific value for the maximum write size for a flash operation.


defineI_FLASH_GETVERSION


defineI_FLASH_GETINFO


defineI_FLASH_SETATTR


defineI_FLASH_SETACTION


defineI_FLASH_ERASEADDR

This request erases the page containing the specified address. The address is specified as the ctl argument.

ioctl(flash_fd, I_FLASH_ERASEADDR, (void*)0x00001000 );

defineI_FLASH_ERASE_ADDR


defineI_FLASH_ERASEPAGE

This request erases the page number specified by the ctl argument.

Example:

ioctl(flash_fd, I_FLASH_ERASEPAGE, 3); //erase page 3

defineI_FLASH_ERASE_PAGE


defineI_FLASH_GETPAGE

This request gets the page number for the specified address. The ctl argument is the address and the return value is the page.

Example:

int page;
page = ioctl(flash_fd, I_FLASH_GETPAGE, (void*)0x00001000 );

defineI_FLASH_GET_PAGE


defineI_FLASH_GETSIZE

This request gets the page number for the specified address. The ctl argument is the address and the return value is the page.

Example:

int page;
size = ioctl(flash_fd, I_FLASH_GET_PAGE);

defineI_FLASH_GET_SIZE


defineI_FLASH_GETPAGEINFO

This request gets the page number for the specified address. The ctl argument is the address and the return value is the page.

Example:

flash_pageinfo_t pageinfo;
page = ioctl(flash_fd, I_FLASH_GETPAGEINFO, &pageinfo );

defineI_FLASH_GET_PAGEINFO


defineI_FLASH_WRITEPAGE

This request is used to write a page to the flash memory.

flash_writepage_t pwrite;
pwrite.addr = 0x1000; //this should be on a boundary for the minimum page size
pwrite.nbyte = 256;  //This has to be a valid page write value for the architecture
memcpy(pwrite.buf, my_data, pwrite.nbyte);
ioctl(flash_fd, I_FLASH_WRITEPAGE, &pwrite);

defineI_FLASH_TOTAL



date: “2019-06-27” layout: post title: struct::flash_info_t katex: true

categories: struct

Methods

Details

public u32o_flags


public u32o_events


public u32resd



date: “2019-06-27” layout: post title: struct::flash_attr_t katex: true

categories: struct

Methods

Details

public u32o_flags


public u32resd



date: “2019-06-27” layout: post title: struct::flash_pageinfo_t katex: true

categories: struct

This data structure holds the details of a flash page.

Methods

Details

public u32page


public u32addr


public u32size



date: “2019-06-27” layout: post title: struct::flash_writepage_t katex: true

categories: struct

This structure is used to write data to the flash using I_FLASH_WRITEPAGE.

Methods

Details

public u32addr

The address to write to


public u32nbyte

The number of bytes to write


public u8buf


X

Thanks for Coming!

Subscribe to news and updates