2017-12-08 18:50:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Nordic Semiconductor ASA
|
|
|
|
* Copyright (c) 2015 Runtime Inc
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zephyr.h>
|
|
|
|
#include <flash_map.h>
|
|
|
|
|
2018-11-29 14:30:36 +08:00
|
|
|
#if defined(DT_FLASH_DEV_NAME)
|
|
|
|
#define FA_DEV_ID SOC_FLASH_0_ID
|
2019-02-04 01:17:24 +08:00
|
|
|
#elif defined(CONFIG_SPI_FLASH_W25QXXDV) || defined(DT_JEDEC_SPI_NOR_0_LABEL)
|
2018-11-29 14:30:36 +08:00
|
|
|
#define FA_DEV_ID SPI_FLASH_0_ID
|
|
|
|
#endif
|
|
|
|
|
2017-12-08 18:50:46 +08:00
|
|
|
const struct flash_area default_flash_map[] = {
|
|
|
|
/* FLASH_AREA_BOOTLOADER */
|
|
|
|
{
|
|
|
|
.fa_id = 0,
|
2018-11-29 14:30:36 +08:00
|
|
|
.fa_device_id = FA_DEV_ID,
|
2017-12-08 18:50:46 +08:00
|
|
|
.fa_off = FLASH_AREA_MCUBOOT_OFFSET,
|
|
|
|
.fa_size = FLASH_AREA_MCUBOOT_SIZE,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* FLASH_AREA_IMAGE_0 */
|
|
|
|
{
|
|
|
|
.fa_id = 1,
|
2018-11-29 14:30:36 +08:00
|
|
|
.fa_device_id = FA_DEV_ID,
|
2017-12-08 18:50:46 +08:00
|
|
|
.fa_off = FLASH_AREA_IMAGE_0_OFFSET,
|
|
|
|
.fa_size = FLASH_AREA_IMAGE_0_SIZE,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* FLASH_AREA_IMAGE_1 */
|
|
|
|
{
|
|
|
|
.fa_id = 2,
|
2018-11-29 14:30:36 +08:00
|
|
|
.fa_device_id = FA_DEV_ID,
|
2017-12-08 18:50:46 +08:00
|
|
|
.fa_off = FLASH_AREA_IMAGE_1_OFFSET,
|
|
|
|
.fa_size = FLASH_AREA_IMAGE_1_SIZE,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* FLASH_AREA_IMAGE_SCRATCH */
|
|
|
|
{
|
|
|
|
.fa_id = 3,
|
2018-11-29 14:30:36 +08:00
|
|
|
.fa_device_id = FA_DEV_ID,
|
2017-12-08 18:50:46 +08:00
|
|
|
.fa_off = FLASH_AREA_IMAGE_SCRATCH_OFFSET,
|
|
|
|
.fa_size = FLASH_AREA_IMAGE_SCRATCH_SIZE,
|
|
|
|
},
|
|
|
|
|
2018-05-04 15:25:18 +08:00
|
|
|
#ifdef CONFIG_FS_FLASH_STORAGE_PARTITION
|
2018-04-19 22:55:53 +08:00
|
|
|
/* FLASH_AREA_STORAGE */
|
2017-12-08 18:50:46 +08:00
|
|
|
{
|
|
|
|
.fa_id = 4,
|
2018-11-29 14:30:36 +08:00
|
|
|
.fa_device_id = FA_DEV_ID,
|
2018-04-19 22:55:53 +08:00
|
|
|
.fa_off = FLASH_AREA_STORAGE_OFFSET,
|
|
|
|
.fa_size = FLASH_AREA_STORAGE_SIZE,
|
2017-12-08 18:50:46 +08:00
|
|
|
},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
const int flash_map_entries = ARRAY_SIZE(default_flash_map);
|
|
|
|
const struct flash_area *flash_map = default_flash_map;
|