FLASH PARTITION

[English]

FLASH PARTITION API Status

FLASH PARTITION API Reference

Header File

Functions

bk_logic_partition_t *bk_flash_partition_get_info(bk_partition_t partition)

Get the infomation of the specified flash area.

Parameters

partition – The target flash logical partition

Returns

bk flash logic partition struct

bk_err_t bk_flash_partition_erase(bk_partition_t partition, uint32_t offset, uint32_t size)

Erase an area on a Flash logical partition.

Note

Erase on an address will erase all data on a sector that the address is belonged to, this function does not save data that beyond the address area but in the affected sector, the data will be lost.

Parameters
  • partition – The target flash logical partition which should be erased

  • offset – Start address of the erased flash area

  • size – Size of the erased flash area

Returns

  • BK_OK: succeed

  • others: other errors

bk_err_t bk_flash_partition_write(bk_partition_t partition, const uint8_t *buffer, uint32_t offset, uint32_t buffer_len)

Write data to an area on a Flash logical partition.

Parameters
  • partition – The target flash logical partition which should be written

  • buffer – Pointer to the data buffer that will be written to flash

  • off_set – The offset of write address

  • buffer_len – The length of the buffer

Returns

  • BK_OK: succeed

  • others: other errors

bk_err_t bk_flash_partition_read(bk_partition_t partition, uint8_t *out_buffer, uint32_t offset, uint32_t buffer_len)

Read data from an area on a Flash to data buffer in RAM.

Parameters
  • partition – The target flash logical partition which should be read

  • out_buffer – Pointer to the data buffer that stores the data read from flash

  • offsets – The offset of read address

  • buffer_len – The length of the buffer

Returns

  • BK_OK: succeed

  • others: other errors

bk_err_t bk_spec_flash_write_bytes(bk_partition_t partition, const uint8_t *user_buf, uint32_t size, uint32_t offset)

Write data to flash (only operating 4k flash space)

Parameters
  • partition – partition to write (eg:partition BK_PARTITION_RF_FIRMWARE)

  • user_buf – the pointer to data which is to write

  • size – size to write

  • offset – offset to write

Returns

  • BK_OK: succeed

  • BK_ERR_FLASH_ADDR_OUT_OF_RANGE: flash address is out of range

  • others: other errors.

Structures

struct bk_logic_partition_t

Public Members

bk_flash_t partition_owner

flash partition owners

const char *partition_description

flash partition description

uint32_t partition_start_addr

flash partition start address

uint32_t partition_length

flash partition length

uint32_t partition_options

flash partition options

Macros

PAR_OPT_READ_POS
PAR_OPT_READ_DIS
PAR_OPT_READ_EN
PAR_OPT_WRITE_POS
PAR_OPT_WRITE_DIS
PAR_OPT_WRITE_EN
PAR_OPT_EXECUTE_POS
PAR_OPT_EXECUTE_DIS
PAR_OPT_EXECUTE_EN

Enumerations

enum bk_flash_t

Values:

enumerator BK_FLASH_EMBEDDED
enumerator BK_FLASH_SPI
enumerator BK_FLASH_MAX
enumerator BK_FLASH_NONE
enum bk_partition_t

Values:

enumerator BK_PARTITION_BOOTLOADER
enumerator BK_PARTITION_APPLICATION
enumerator BK_PARTITION_OTA
enumerator BK_PARTITION_APPLICATION1
enumerator BK_PARTITION_MATTER_FLASH
enumerator BK_PARTITION_RF_FIRMWARE
enumerator BK_PARTITION_NET_PARAM
enumerator BK_PARTITION_USR_CONFIG
enumerator BK_PARTITION_OTA_FINA_EXECUTIVE
enumerator BK_PARTITION_APPLICATION2
enumerator BK_PARTITION_EASYFLASH
enumerator BK_PARTITION_MAX