stm32l0: flash: use common functionality

Provides all the basic core functionality shared with L1.  No special L0
functionality supported at this point.
This commit is contained in:
Karl Palsson 2017-05-01 22:33:55 +00:00
parent ce787c0f40
commit 2547bf66d9
4 changed files with 92 additions and 0 deletions

View File

@ -32,6 +32,8 @@
# include <libopencm3/stm32/f4/flash.h>
#elif defined(STM32F7)
# include <libopencm3/stm32/f7/flash.h>
#elif defined(STM32L0)
# include <libopencm3/stm32/l0/flash.h>
#elif defined(STM32L1)
# include <libopencm3/stm32/l1/flash.h>
#elif defined(STM32L4)

View File

@ -0,0 +1,62 @@
/** @defgroup flash_defines FLASH Defines
*
* @brief <b>Defined Constants and Types for the STM32L0xx Flash memory</b>
*
* @ingroup STM32L0xx_defines
*
* @version 1.0.0
*
* LGPL License Terms @ref lgpl_license
*/
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2017 Karl Palsson <karlp@tweak.net.au>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBOPENCM3_FLASH_H
#define LIBOPENCM3_FLASH_H
/**@{*/
#include <libopencm3/stm32/common/flash_common_l01.h>
/* --- FLASH registers ----------------------------------------------------- */
/* L0 has some alternative names for the same registers */
#define FLASH_OPTR FLASH_OBR
#define FLASH_WRPROT1 FLASH_WRPR1
#define FLASH_WRPROT2 FLASH_WRPR2
/* --- FLASH_ACR values ---------------------------------------------------- */
#define FLASH_ACR_PRE_READ (1 << 6)
#define FLASH_ACR_DISAB_BUF (1 << 5)
/* --- FLASH_PECR values ---------------------------------------------------- */
#define FLASH_PECR_NZDISABLE (1 << 23)
/* --- FLASH_SR values ----------------------------------------------------- */
#define FLASH_SR_RDERR (1 << 13)
#define FLASH_SR_NOTZEROERR (1 << 16)
#define FLASH_SR_FWWERR (1 << 17)
/* --- FLASH_OPTR values ----------------------------------------------------- */
#define FLASH_OPTR_NBOOT1 (1 << 31)
BEGIN_DECLS
END_DECLS
/**@}*/
#endif

View File

@ -44,6 +44,7 @@ OBJS += gpio_common_all.o gpio_common_f0234.o rcc_common_all.o
OBJS += adc_common_v2.o
OBJS += crs_common_all.o
OBJS += exti_common_all.o
OBJS += flash.o flash_common_l01.o
OBJS += i2c_common_v2.o
OBJS += rng_common_v1.o

27
lib/stm32/l0/flash.c Normal file
View File

@ -0,0 +1,27 @@
/** @defgroup gpio_file GPIO
*
* @ingroup STM32L0xx
*
* @brief <b>libopencm3 STM32L0xx General Purpose I/O</b>
*
* LGPL License Terms @ref lgpl_license
*/
/*
* This file is part of the libopencm3 project.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libopencm3/stm32/flash.h>