|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2018-2022 Arm Limited. All rights reserved. |
3 |
| - * Copyright (c) 2020 Nordic Semiconductor ASA. All rights reserved. |
| 2 | + * Copyright (c) 2025 Nordic Semiconductor ASA. All rights reserved. |
4 | 3 | *
|
5 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 5 | * you may not use this file except in compliance with the License.
|
|
18 | 17 | #ifndef __FLASH_LAYOUT_H__
|
19 | 18 | #define __FLASH_LAYOUT_H__
|
20 | 19 |
|
21 |
| -#error "not supported yet" |
| 20 | +#ifdef BL2 |
| 21 | +#error "BL2 is not supported for this platform" |
| 22 | +#endif |
| 23 | + |
| 24 | +/* Flash layout on NRF54L15 Application MCU without BL2: |
| 25 | + * |
| 26 | + * 0x0000_0000 Secure image primary (512 KB) |
| 27 | + * 0x0008_0000 Protected Storage Area (16 KB) |
| 28 | + * 0x0008_4000 Internal Trusted Storage Area (16 KB) |
| 29 | + * 0x0008_8000 OTP / NV counters area (8 KB) |
| 30 | + * 0x0008_A000 Non-secure image primary (844 KB) |
| 31 | + * 0x0015_D000 Non-secure storage, used when built with NRF_NS_STORAGE=ON, |
| 32 | + * otherwise unused (32 KB) |
| 33 | + */ |
| 34 | + |
| 35 | +/* This header file is included from linker scatter file as well, where only a |
| 36 | + * limited C constructs are allowed. Therefore it is not possible to include |
| 37 | + * here the platform_base_address.h to access flash related defines. To resolve |
| 38 | + * this some of the values are redefined here with different names, these are |
| 39 | + * marked with comment. |
| 40 | + */ |
| 41 | + |
| 42 | +/* Use Flash memory to store Code data */ |
| 43 | +#define FLASH_BASE_ADDRESS (0x0) |
| 44 | + |
| 45 | +/* nRF54L15 has 1524 kB of non volatile memory (RRAM) but the last 96kB are reserved |
| 46 | + * for FLPR MCU in Zephyr. For simplicity and for possible support for running FLPR along |
| 47 | + * with TF-M later FLPR non volatile memory is not used by TF-M. */ |
| 48 | +#define FLASH_TOTAL_SIZE (0x165000) /* 1428 kB since the last 96kB are reserved for FLPR */ |
| 49 | +#define TOTAL_ROM_SIZE FLASH_TOTAL_SIZE |
| 50 | + |
| 51 | +/* nRF54L15 has 256 kB of volatile memory (SRAM) but the last 96kB are reserved |
| 52 | + * for FLPR MCU in Zephyr. For simplicity and for possible support for running FLPR along |
| 53 | + * with TF-M later FLPR volatile memory is not used by TF-M. */ |
| 54 | +#define SRAM_BASE_ADDRESS (0x20000000) |
| 55 | +#define TOTAL_RAM_SIZE (0x00028000) /* 160 kB, since the last 96kB are reserved for FLPR */ |
| 56 | + |
| 57 | +#define FLASH_S_PARTITION_SIZE (0x80000) /* S partition: 512 kB*/ |
| 58 | +#define FLASH_NS_PARTITION_SIZE (0xD3000) /* NS partition: 844 kB*/ |
| 59 | + |
| 60 | +#define S_ROM_ALIAS_BASE FLASH_BASE_ADDRESS |
| 61 | +#define NS_ROM_ALIAS_BASE FLASH_BASE_ADDRESS |
| 62 | + |
| 63 | +/* Use SRAM memory to store RW data */ |
| 64 | +#define S_RAM_ALIAS_BASE SRAM_BASE_ADDRESS |
| 65 | +#define NS_RAM_ALIAS_BASE SRAM_BASE_ADDRESS |
| 66 | + |
| 67 | +/* Sector size of the embedded flash hardware (erase/program) */ |
| 68 | +#define FLASH_AREA_IMAGE_SECTOR_SIZE (0x1000) /* 4 KB. Flash memory program/erase operations have a page granularity. */ |
| 69 | + |
| 70 | +#if (FLASH_S_PARTITION_SIZE > FLASH_NS_PARTITION_SIZE) |
| 71 | +#define FLASH_MAX_PARTITION_SIZE FLASH_S_PARTITION_SIZE |
| 72 | +#else |
| 73 | +#define FLASH_MAX_PARTITION_SIZE FLASH_NS_PARTITION_SIZE |
| 74 | +#endif |
| 75 | + |
| 76 | +/* Offset and size definition in flash area used by assemble.py */ |
| 77 | +#define SECURE_IMAGE_MAX_SIZE FLASH_S_PARTITION_SIZE |
| 78 | +#define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE |
| 79 | + |
| 80 | +#define SECURE_STORAGE_PARTITIONS_START (FLASH_BASE_ADDRESS + FLASH_S_PARTITION_SIZE) |
| 81 | + |
| 82 | +/* Protected Storage (PS) Service definitions */ |
| 83 | +#define FLASH_PS_AREA_OFFSET (SECURE_STORAGE_PARTITIONS_START) |
| 84 | +#define FLASH_PS_AREA_SIZE (0x4000) /* 16 KB */ |
| 85 | + |
| 86 | +/* Internal Trusted Storage (ITS) Service definitions */ |
| 87 | +#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET + FLASH_PS_AREA_SIZE) |
| 88 | +#define FLASH_ITS_AREA_SIZE (0x4000) /* 16 KB */ |
| 89 | + |
| 90 | +/* OTP_definitions */ |
| 91 | +#define FLASH_OTP_NV_COUNTERS_AREA_OFFSET (FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE) |
| 92 | +#define FLASH_OTP_NV_COUNTERS_AREA_SIZE (0x2000) /* 8KB */ |
| 93 | + |
| 94 | +#define FLASH_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE |
| 95 | + |
| 96 | +#define SECURE_STORAGE_PARTITIONS_END (FLASH_OTP_NV_COUNTERS_AREA_OFFSET + FLASH_OTP_NV_COUNTERS_AREA_SIZE) |
| 97 | +/* END OF PARTITIONS LAYOUT */ |
| 98 | + |
| 99 | +#define SECURE_IMAGE_OFFSET (0x0) |
| 100 | +#define NON_SECURE_IMAGE_OFFSET (SECURE_STORAGE_PARTITIONS_END) |
| 101 | + |
| 102 | +/* Non-secure storage region */ |
| 103 | +#define NRF_FLASH_NS_STORAGE_AREA_SIZE (0x8000) /* 32 KB */ |
| 104 | +#define NRF_FLASH_NS_STORAGE_AREA_OFFSET (FLASH_TOTAL_SIZE - \ |
| 105 | + NRF_FLASH_NS_STORAGE_AREA_SIZE) |
| 106 | + |
| 107 | +/* Flash device name used by BL2 |
| 108 | + * Name is defined in flash driver file: Driver_Flash.c |
| 109 | + */ |
| 110 | +//#define FLASH_DEV_NAME Driver_FLASH0 |
| 111 | +/* Smallest flash programmable unit in bytes */ |
| 112 | +#define TFM_HAL_FLASH_PROGRAM_UNIT (0x4) |
| 113 | + |
| 114 | +/* Protected Storage (PS) Service definitions |
| 115 | + * Note: Further documentation of these definitions can be found in the |
| 116 | + * TF-M PS Integration Guide. |
| 117 | + */ |
| 118 | +#define TFM_HAL_PS_FLASH_DRIVER Driver_FLASH0 |
| 119 | + |
| 120 | +/* In this target the CMSIS driver requires only the offset from the base |
| 121 | + * address instead of the full memory address. |
| 122 | + */ |
| 123 | +/* Base address of dedicated flash area for PS */ |
| 124 | +#define TFM_HAL_PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET |
| 125 | +/* Size of dedicated flash area for PS */ |
| 126 | +#define TFM_HAL_PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE |
| 127 | +#define PS_RAM_FS_SIZE TFM_HAL_PS_FLASH_AREA_SIZE |
| 128 | +/* Number of physical erase sectors per logical FS block */ |
| 129 | +#define TFM_HAL_PS_SECTORS_PER_BLOCK (1) |
| 130 | +/* Smallest flash programmable unit in bytes */ |
| 131 | +#define TFM_HAL_PS_PROGRAM_UNIT (0x4) |
| 132 | + |
| 133 | +/* Internal Trusted Storage (ITS) Service definitions |
| 134 | + * Note: Further documentation of these definitions can be found in the |
| 135 | + * TF-M ITS Integration Guide. The ITS should be in the internal flash, but is |
| 136 | + * allocated in the external flash just for development platforms that don't |
| 137 | + * have internal flash available. |
| 138 | + */ |
| 139 | +#define TFM_HAL_ITS_FLASH_DRIVER Driver_FLASH0 |
| 140 | + |
| 141 | +/* In this target the CMSIS driver requires only the offset from the base |
| 142 | + * address instead of the full memory address. |
| 143 | + */ |
| 144 | +/* Base address of dedicated flash area for ITS */ |
| 145 | +#define TFM_HAL_ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET |
| 146 | +/* Size of dedicated flash area for ITS */ |
| 147 | +#define TFM_HAL_ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE |
| 148 | +#define ITS_RAM_FS_SIZE TFM_HAL_ITS_FLASH_AREA_SIZE |
| 149 | +/* Number of physical erase sectors per logical FS block */ |
| 150 | +#define TFM_HAL_ITS_SECTORS_PER_BLOCK (1) |
| 151 | +/* Smallest flash programmable unit in bytes */ |
| 152 | +#define TFM_HAL_ITS_PROGRAM_UNIT (0x4) |
| 153 | + |
| 154 | +/* OTP / NV counter definitions */ |
| 155 | +#define TFM_OTP_NV_COUNTERS_AREA_SIZE (FLASH_OTP_NV_COUNTERS_AREA_SIZE / 2) |
| 156 | +#define TFM_OTP_NV_COUNTERS_AREA_ADDR FLASH_OTP_NV_COUNTERS_AREA_OFFSET |
| 157 | +#define TFM_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_OTP_NV_COUNTERS_SECTOR_SIZE |
| 158 | +#define TFM_OTP_NV_COUNTERS_BACKUP_AREA_ADDR (TFM_OTP_NV_COUNTERS_AREA_ADDR + \ |
| 159 | + TFM_OTP_NV_COUNTERS_AREA_SIZE) |
| 160 | + |
22 | 161 |
|
23 | 162 | #endif /* __FLASH_LAYOUT_H__ */
|
0 commit comments