From cf383412efab088ab448ec22c838d483f4d082de Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Wed, 3 Apr 2019 23:51:38 +0200 Subject: [PATCH] nrf/flash: Update flash driver to use nrfx_nvmc driver. The the nrfx driver is aware of chip specific registers, while the raw HAL abstraction is not. This driver enables use of NVMC in non-secure domain for nrf9160. --- ports/nrf/Makefile | 5 +---- ports/nrf/drivers/flash.h | 8 ++++---- ports/nrf/nrfx_config.h | 2 ++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index c02109a156..1b70851eb8 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -181,10 +181,7 @@ SRC_NRFX += $(addprefix lib/nrfx/drivers/src/,\ nrfx_timer.c \ nrfx_pwm.c \ nrfx_gpiote.c \ - ) - -SRC_NRFX_HAL += $(addprefix lib/nrfx/hal/,\ - nrf_nvmc.c \ + nrfx_nvmc.c \ ) SRC_C += \ diff --git a/ports/nrf/drivers/flash.h b/ports/nrf/drivers/flash.h index 7e6fff37a9..3dd5d06dd4 100644 --- a/ports/nrf/drivers/flash.h +++ b/ports/nrf/drivers/flash.h @@ -27,7 +27,7 @@ #ifndef __MICROPY_INCLUDED_LIB_FLASH_H__ #define __MICROPY_INCLUDED_LIB_FLASH_H__ -#include "nrf_nvmc.h" +#include "nrfx_nvmc.h" #if defined(NRF51) #define FLASH_PAGESIZE (1024) @@ -55,9 +55,9 @@ void flash_operation_finished(flash_state_t result); #else -#define flash_page_erase nrf_nvmc_page_erase -#define flash_write_byte nrf_nvmc_write_byte -#define flash_write_bytes nrf_nvmc_write_bytes +#define flash_page_erase nrfx_nvmc_page_erase +#define flash_write_byte nrfx_nvmc_byte_write +#define flash_write_bytes nrfx_nvmc_bytes_write #endif diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h index d8a7d521da..99085a2fe8 100644 --- a/ports/nrf/nrfx_config.h +++ b/ports/nrf/nrfx_config.h @@ -103,6 +103,8 @@ #define NRFX_PWM2_ENABLED 1 #define NRFX_PWM3_ENABLED (NRF52840) +#define NRFX_NVMC_ENABLED 1 + // Peripheral Resource Sharing #if defined(NRF51) || defined(NRF52832) #define NRFX_PRS_BOX_0_ENABLED (NRFX_TWI_ENABLED && NRFX_TWI0_ENABLED && NRFX_SPI_ENABLED && NRFX_SPI0_ENABLED)