pico-binary-info
Portable Pi Pico binary_info parser
Loading...
Searching...
No Matches
Initialization

Functions for initializing a pico_binary_info struct. More...

Functions

int pico_binary_info_init (struct pico_binary_info *info, const uint8_t *image, size_t len)
 Initialize a pico_binary_info struct using a pointer to a pico binary image which is in memory, or a memory mapped file.
int pico_binary_info_init_fd (struct pico_binary_info *info, int fd, size_t len)
 Initialize a pico_binary_info struct using a file handle.

Detailed Description

Functions for initializing a pico_binary_info struct.

Function Documentation

◆ pico_binary_info_init()

int pico_binary_info_init ( struct pico_binary_info * info,
const uint8_t * image,
size_t len )

Initialize a pico_binary_info struct using a pointer to a pico binary image which is in memory, or a memory mapped file.

Use this on systems where mmap is available, or where loading the entire binary into memory is feasible.

Parameters
infothe binary info struct to initialize
imagepointer to the start of the binary image
lensize of the binary image
Returns
0 for success, negative error code on failure

◆ pico_binary_info_init_fd()

int pico_binary_info_init_fd ( struct pico_binary_info * info,
int fd,
size_t len )

Initialize a pico_binary_info struct using a file handle.

Use this on systems where posix/newlib open and read` are available.

Parameters
infothe binary info struct to initialize
fdan open, seekable descriptor positioned anywhere
lenthe total length of the image (e.g. from fstat/lseek)
Returns
0 for success, negative error code on failure