Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Abstraction layer to write firmware images to flash. More...

Data Structures

struct  flash_img_context
 
struct  flash_img_check
 Structure for verify flash region integrity. More...
 

Functions

int flash_img_init_id (struct flash_img_context *ctx, uint8_t area_id)
 Initialize context needed for writing the image to the flash.
 
int flash_img_init (struct flash_img_context *ctx)
 Initialize context needed for writing the image to the flash.
 
size_t flash_img_bytes_written (struct flash_img_context *ctx)
 Read number of bytes of the image written to the flash.
 
int flash_img_buffered_write (struct flash_img_context *ctx, const uint8_t *data, size_t len, bool flush)
 Process input buffers to be written to the image slot 1.
 
int flash_img_check (struct flash_img_context *ctx, const struct flash_img_check *fic, uint8_t area_id)
 Verify flash memory length bytes integrity from a flash area.
 

Detailed Description

Abstraction layer to write firmware images to flash.

Function Documentation

◆ flash_img_buffered_write()

int flash_img_buffered_write ( struct flash_img_context ctx,
const uint8_t data,
size_t  len,
bool  flush 
)

#include <zephyr/dfu/flash_img.h>

Process input buffers to be written to the image slot 1.

flash memory in single blocks. Will store remainder between calls.

A final call to this function with flush set to true will write out the remaining block buffer to flash. Since flash is written to in blocks, the contents of flash from the last byte written up to the next multiple of CONFIG_IMG_BLOCK_BUF_SIZE is padded with 0xff.

Parameters
ctxcontext
datadata to write
lenNumber of bytes to write
flushwhen true this forces any buffered data to be written to flash
Returns
0 on success, negative errno code on fail

◆ flash_img_bytes_written()

size_t flash_img_bytes_written ( struct flash_img_context ctx)

#include <zephyr/dfu/flash_img.h>

Read number of bytes of the image written to the flash.

Parameters
ctxcontext
Returns
Number of bytes written to the image flash.

◆ flash_img_check()

int flash_img_check ( struct flash_img_context ctx,
const struct flash_img_check fic,
uint8_t  area_id 
)

#include <zephyr/dfu/flash_img.h>

Verify flash memory length bytes integrity from a flash area.

The start point is indicated by an offset value.

The function is enabled via CONFIG_IMG_ENABLE_IMAGE_CHECK Kconfig options.

Parameters
[in]ctxcontext.
[in]ficflash img check data.
[in]area_idflash area id of partition where the image should be verified.
Returns
0 on success, negative errno code on fail

◆ flash_img_init()

int flash_img_init ( struct flash_img_context ctx)

#include <zephyr/dfu/flash_img.h>

Initialize context needed for writing the image to the flash.

Parameters
ctxcontext to be initialized
Returns
0 on success, negative errno code on fail

◆ flash_img_init_id()

int flash_img_init_id ( struct flash_img_context ctx,
uint8_t  area_id 
)

#include <zephyr/dfu/flash_img.h>

Initialize context needed for writing the image to the flash.

Parameters
ctxcontext to be initialized
area_idflash area id of partition where the image should be written
Returns
0 on success, negative errno code on fail