1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/riotboot_gen_hdr/common.h
Benjamin Valentin 9d350f08c0 dist/tools/riotboot_gen_hdr/genhdr: add update command
Sometimes we want to roll-back to a previous firmware version.
To do so we need a higher riotbot version numbers still.

Add an update command to the riotboot_gen_hdr tool so that an existing
firmware image can be re-rolled out with a new version number.
2024-01-09 16:15:27 +01:00

43 lines
1.1 KiB
C

/*
* Copyright (C) 2017 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU General Public
* License v2. See the file LICENSE for more details.
*/
#ifndef COMMON_H
#define COMMON_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Write len bytes of a given buffer into a file
*
* @param[in] filename name of the file to be written
* @param[in] buf a pointer to the buffer which needs to be written
* @param[in] len the number of bytes from buf to be written
*
*/
int to_file(const char *filename, const void *buf, size_t len);
/**
* @brief Read len bytes from a given file into a buffer
*
* @param[in] filename name of the file to be read
* @param[out] buf a pointer to the buffer to store the content
* @param[out] len the number of bytes to be read
*
* @return Number of bytes read, or negative error
*/
int from_file(const char *filename, const void *buf, size_t len);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* COMMON_H */