Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf noup] drivers: flash: Allow reading secure mem by nrf_rram. #2352

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions drivers/flash/soc_flash_nrf_rram.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL);
#define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size)
#define ERASE_VALUE 0xFF

nordicjm marked this conversation as resolved.
Show resolved Hide resolved
#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER
#include <soc_secure.h>
#include <pm_config.h>
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */

#ifdef CONFIG_MULTITHREADING
static struct k_sem sem_lock;
#define SYNC_INIT() k_sem_init(&sem_lock, 1, 1)
Expand Down Expand Up @@ -279,6 +284,12 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_
}
addr += RRAM_START;

#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS
if (addr < PM_APP_ADDRESS) {
return soc_secure_mem_read(data, (void *)addr, len);
}
#endif

memcpy(data, (void *)addr, len);

return 0;
Expand Down
Loading