Skip to content

Commit db1fe8e

Browse files
hakonfammbolivar-nordic
authored andcommitted
[nrf toup] drivers/flash: limit secure read inclusion
Only include secure read call if SPM is enabled and partition manager is in use. Signed-off-by: Håkon Øye Amundsen <[email protected]> (cherry picked from commit b3bc959) Signed-off-by: Martí Bolívar <[email protected]>
1 parent 0c19ec7 commit db1fe8e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/flash/soc_flash_nrf.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
#include <string.h>
1717
#include <nrfx_nvmc.h>
1818

19-
#if CONFIG_ARM_NONSECURE_FIRMWARE
19+
#if CONFIG_ARM_NONSECURE_FIRMWARE && CONFIG_SPM
2020
#include <secure_services.h>
21+
#if USE_PARTITION_MANAGER
2122
#include <pm_config.h>
22-
#endif
23+
#endif /* USE_PARTITION_MANAGER */
24+
#endif /* CONFIG_ARM_NONSECURE_FIRMWARE && CONFIG_SPM */
2325

2426
#if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC)
2527
#include <sys/__assert.h>
@@ -146,7 +148,7 @@ static int flash_nrf_read(struct device *dev, off_t addr,
146148
return 0;
147149
}
148150

149-
#if CONFIG_ARM_NONSECURE_FIRMWARE
151+
#if CONFIG_ARM_NONSECURE_FIRMWARE && CONFIG_SPM && USE_PARTITION_MANAGER
150152
if (addr < PM_APP_ADDRESS) {
151153
return spm_request_read(data, addr, len);
152154
}

0 commit comments

Comments
 (0)