blob: 33f92902c40ee69e7acbf0886674f620c8c0aa7d [file] [log] [blame]
David Vincze225c58f2019-12-09 17:32:48 +01001/* Manual version of auto-generated version. */
2
3/*
4 * Original code taken from mcuboot project at:
Tamas Banc5b2f2b2020-11-12 09:47:05 +00005 * https://github.com/mcu-tools/mcuboot
David Vincze225c58f2019-12-09 17:32:48 +01006 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
7 * Modifications are Copyright (c) 2020 Arm Limited.
8 */
9
10#ifndef __SYSFLASH_H__
11#define __SYSFLASH_H__
12
13#include "flash_layout.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#if (MCUBOOT_IMAGE_NUMBER == 1)
20/*
21 * NOTE: the definition below returns the same values for true/false on
22 * purpose, to avoid having to mark x as non-used by all callers when
23 * running in single image mode.
24 */
25#define FLASH_AREA_IMAGE_PRIMARY(x) (((x) == 0) ? FLASH_AREA_0_ID : \
26 FLASH_AREA_0_ID)
27#define FLASH_AREA_IMAGE_SECONDARY(x) (((x) == 0) ? FLASH_AREA_2_ID : \
28 FLASH_AREA_2_ID)
29#elif (MCUBOOT_IMAGE_NUMBER == 2)
30/* MCUBoot currently supports only up to 2 updatable firmware images.
31 * If the number of the current image is greater than MCUBOOT_IMAGE_NUMBER - 1
32 * then a dummy value will be assigned to the flash area macros.
33 */
34#define FLASH_AREA_IMAGE_PRIMARY(x) (((x) == 0) ? FLASH_AREA_0_ID : \
35 ((x) == 1) ? FLASH_AREA_1_ID : \
36 255 )
37#define FLASH_AREA_IMAGE_SECONDARY(x) (((x) == 0) ? FLASH_AREA_2_ID : \
38 ((x) == 1) ? FLASH_AREA_3_ID : \
39 255 )
40#else
41#error "Image slot and flash area mapping is not defined"
42#endif
43
44#define FLASH_AREA_IMAGE_SCRATCH FLASH_AREA_SCRATCH_ID
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif /* __SYSFLASH_H__ */