add code to initialize flash

Change-Id: I2a208abb39a9da8796e2a4bcb803ce32686cb95f
This commit is contained in:
Kevin Redon 2019-01-03 18:00:47 +01:00
parent 9bebe583ae
commit 5c7d9805c2
2 changed files with 21 additions and 0 deletions

View File

@ -126,9 +126,23 @@ void USB_DEVICE_INSTANCE_init(void)
USB_DEVICE_INSTANCE_PORT_init();
}
struct flash_descriptor FLASH_0;
void FLASH_0_CLOCK_init(void)
{
hri_mclk_set_AHBMASK_NVMCTRL_bit(MCLK);
}
void FLASH_0_init(void)
{
FLASH_0_CLOCK_init();
flash_init(&FLASH_0, NVMCTRL);
}
void system_init(void)
{
init_mcu();
USB_DEVICE_INSTANCE_init();
FLASH_0_init();
}

View File

@ -26,6 +26,13 @@ extern "C" {
void USB_DEVICE_INSTANCE_CLOCK_init(void);
void USB_DEVICE_INSTANCE_init(void);
#include <hal_flash.h>
extern struct flash_descriptor FLASH_0;
void FLASH_0_init(void);
void FLASH_0_CLOCK_init(void);
/**
* \brief Perform system initialization, initialize pins and clocks for
* peripherals