1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/flashdb: fix FAL partition offsets

This commit is contained in:
Fabian Hüßler 2023-05-12 15:38:28 +02:00
parent 6e1e78d126
commit bd75060bec

View File

@ -26,6 +26,7 @@
#define FAL_CFG_H
#include "board.h"
#include "mtd_default.h"
#ifdef __cplusplus
extern "C" {
@ -49,28 +50,21 @@ extern struct fal_flash_dev mtd_flash0;
&mtd_flash0, \
}
#if !defined(FAL_MTD)
#if !defined(FAL_MTD) || defined(DOXYGEN)
/**
* @brief Default MTD to use for flashdb
*/
#define FAL_MTD MTD_0
#define FAL_MTD mtd_default_get_dev(0)
#endif
#if !defined(FAL_PART_LABEL)
/**
* @brief Default FAL partition to use for flashdb
*/
#define FAL_PART_LABEL FAL_PART0_LABEL
#endif
#if !defined(FAL_PART0_LABEL)
#if !defined(FAL_PART0_LABEL) || defined(DOXYGEN)
/**
* @brief Have at least the label of partition 0 defined
*/
#define FAL_PART0_LABEL "part0"
#endif
#if !defined(FAL_PART0_LENGTH)
#if !defined(FAL_PART0_LENGTH) || defined(DOXYGEN)
/**
* @brief Have at least the length of partition 0 defined
*/
@ -80,9 +74,18 @@ extern struct fal_flash_dev mtd_flash0;
/**
* @brief Partition 0
*/
#ifdef FAL_PART0_LABEL
#if defined(FAL_PART0_LABEL) || defined(DOXYGEN)
#if !defined(FAL_PART0_OFFSET) || defined(DOXYGEN)
/**
* @brief Offset of partition 0
*/
#define FAL_PART0_OFFSET 0
#endif
/**
* @brief Partition 0 compound definition
*/
#define FAL_ROW_PART0 { FAL_PART_MAGIC_WORD, FAL_PART0_LABEL, "fal_mtd", \
0, FAL_PART0_LENGTH, 0 },
FAL_PART0_OFFSET, FAL_PART0_LENGTH, 0 },
#else
#define FAL_ROW_PART0
#endif
@ -90,9 +93,18 @@ extern struct fal_flash_dev mtd_flash0;
/**
* @brief Partition 1
*/
#ifdef FAL_PART1_LABEL
#if defined(FAL_PART1_LABEL) || defined(DOXYGEN)
#if !defined(FAL_PART1_OFFSET) || defined(DOXYGEN)
/**
* @brief Offset of partition 1
*/
#define FAL_PART1_OFFSET (FAL_PART0_OFFSET + FAL_PART0_LENGTH)
#endif
/**
* @brief Partition 1 compound definition
*/
#define FAL_ROW_PART1 { FAL_PART_MAGIC_WORD, FAL_PART1_LABEL, "fal_mtd", \
FAL_PART0_LENGTH, FAL_PART1_LENGTH, 0 },
FAL_PART1_OFFSET, FAL_PART1_LENGTH, 0 },
#else
#define FAL_ROW_PART1
#endif
@ -100,9 +112,18 @@ extern struct fal_flash_dev mtd_flash0;
/**
* @brief Partition 2
*/
#ifdef FAL_PART2_LABEL
#define FAL_ROW_PART2 { FAL_PART_MAGIC_WORD, FAL_PART2_LABEL, "fal_mtd",
FAL_PART1_LENGTH, FAL_PART2_LENGTH, 0 },
#if defined(FAL_PART2_LABEL) || defined(DOXYGEN)
#if !defined(FAL_PART2_OFFSET) || defined(DOXYGEN)
/**
* @brief Offset of partition 2
*/
#define FAL_PART2_OFFSET (FAL_PART1_OFFSET + FAL_PART1_LENGTH)
#endif
/**
* @brief Partition 2 compound definition
*/
#define FAL_ROW_PART2 { FAL_PART_MAGIC_WORD, FAL_PART2_LABEL, "fal_mtd", \
FAL_PART2_OFFSET, FAL_PART2_LENGTH, 0 },
#else
#define FAL_ROW_PART2
#endif
@ -110,9 +131,18 @@ extern struct fal_flash_dev mtd_flash0;
/**
* @brief Partition 3
*/
#ifdef FAL_PART3_LABEL
#define FAL_ROW_PART3 { FAL_PART_MAGIC_WORD, FAL_PART3_LABEL, "fal_mtd",
FAL_PART2_LENGTH, FAL_PART3_LENGTH, 0 },
#if defined(FAL_PART3_LABEL) || defined(DOXYGEN)
#if !defined(FAL_PART3_OFFSET) || defined(DOXYGEN)
/**
* @brief Offset of partition 3
*/
#define FAL_PART3_OFFSET (FAL_PART2_OFFSET + FAL_PART2_LENGTH)
#endif
/**
* @brief Partition 3 compound definition
*/
#define FAL_ROW_PART3 { FAL_PART_MAGIC_WORD, FAL_PART3_LABEL, "fal_mtd", \
FAL_PART3_OFFSET, FAL_PART3_LENGTH, 0 },
#else
#define FAL_ROW_PART3
#endif