Browse Source

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.
pull/5180/head
Glenn Ruben Bakke 6 years ago
parent
commit
cf383412ef
  1. 5
      ports/nrf/Makefile
  2. 8
      ports/nrf/drivers/flash.h
  3. 2
      ports/nrf/nrfx_config.h

5
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 += \

8
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

2
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)

Loading…
Cancel
Save