diff --git a/include/libopencm3/stm32/flash.h b/include/libopencm3/stm32/flash.h index acaba1e2..c95ca361 100644 --- a/include/libopencm3/stm32/flash.h +++ b/include/libopencm3/stm32/flash.h @@ -32,6 +32,8 @@ # include #elif defined(STM32F7) # include +#elif defined(STM32L0) +# include #elif defined(STM32L1) # include #elif defined(STM32L4) diff --git a/include/libopencm3/stm32/l0/flash.h b/include/libopencm3/stm32/l0/flash.h new file mode 100644 index 00000000..6eaef6e5 --- /dev/null +++ b/include/libopencm3/stm32/l0/flash.h @@ -0,0 +1,62 @@ +/** @defgroup flash_defines FLASH Defines + * + * @brief Defined Constants and Types for the STM32L0xx Flash memory + * + * @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 + * + * 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 . + */ + +#ifndef LIBOPENCM3_FLASH_H +#define LIBOPENCM3_FLASH_H +/**@{*/ + +#include + +/* --- 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 diff --git a/lib/stm32/l0/Makefile b/lib/stm32/l0/Makefile index 94bfe3e7..d2a7a6b3 100644 --- a/lib/stm32/l0/Makefile +++ b/lib/stm32/l0/Makefile @@ -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 diff --git a/lib/stm32/l0/flash.c b/lib/stm32/l0/flash.c new file mode 100644 index 00000000..b1ba6420 --- /dev/null +++ b/lib/stm32/l0/flash.c @@ -0,0 +1,27 @@ +/** @defgroup gpio_file GPIO + * + * @ingroup STM32L0xx + * + * @brief libopencm3 STM32L0xx General Purpose I/O + * + * 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 . + */ + +#include