group::MEM

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.

Details

defineMEM_VERSION


defineMEM_IOC_IDENT_CHAR


defineI_MEM_GETVERSION


defineI_MEM_GETINFO


defineI_MEM_SETATTR


defineI_MEM_SETACTION


defineI_MEM_ERASEPAGE

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

Example:

ioctl(mem_fd, I_MEM_ERASEPAGE, 3); //erase page 3

This function has no effect for pages that are not flash pages.


defineI_MEM_ERASE_PAGE


defineI_MEM_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:

mem_pageinfo_t pageinfo;
pageinfo.type = MEM_PAGEINO_TYPE_FLASH;
paginfo.num = 0;
//This will get the size and address of flash page 0
ioctl(mem_fd, I_MEM_GET_PAGEINFO, &pageinfo );

Or to lookup based on the address:

mem_pageinfo_t pageinfo;
pageinfo.type = MEM_PAGEINFO_TYPE_QUERY;
paginfo.addr = 0x00001000;
//This will get the size and address of flash page 0
ioctl(mem_fd, I_MEM_GETPAGEINFO, &pageinfo );

The type, num, and size parameters will then be populated.


defineI_MEM_WRITEPAGE

This request writes a page to flash memory.


defineI_MEM_TOTAL


enum@22

  • MEM_FLAG_IS_QUERY Query the page type. This is used when the address is known but the page number, size, and type are not known
  • MEM_FLAG_IS_RAM RAM
  • MEM_FLAG_IS_FLASH Flash
  • MEM_FLAG_IS_TIGHTLY_COUPLED Tightly coupled memory (OR with RAM or FLASH)
  • MEM_FLAG_IS_EXTERNAL External memory chip (OR with RAM or FLASH)

This lists each type of page.



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

categories: struct

Methods

Details

public u32flash_pages

The total number of flash pages


public u32flash_size

The total size of the flash memory


public u32ram_pages

The total number of RAM pages


public u32ram_size

The total size of the RAM


public u32system_ram_page

First page for system shared RAM


public u32usage_size


public u32 *usage


public u32external_ram_pages

The total number of external RAM pages


public u32external_ram_size

The total size of external RAM


public u32tightlycoupled_ram_pages

The total number of external RAM pages


public u32tightlycoupled_ram_size

The total size of external RAM


public u32resd



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

categories: struct

This defines the attributes of the memory.

It is used with I_MEM_GETINFO. The attributes are read-only so I_MEM_SETATTR has no effect.

Methods

Details

public u32o_flags


public u32resd



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

categories: struct

This structure contains the details for a page of memory.

Methods

Details

public s32num


public u32o_flags


public u32addr


public u32size



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

categories: struct

Methods

Details

public u32addr

The address to write to


public u32nbyte

The number of bytes to write


public u8buf

A buffer for writing to the flash


X

Thanks for Coming!

Subscribe to news and updates