diff --git a/Makefile b/Makefile index 01e0cb46..db022c1b 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ space:= space+= SRCLIBDIR:= $(subst $(space),\$(space),$(realpath lib)) -TARGETS:= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/l0 stm32/l1 \ +TARGETS:= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7 stm32/l0 stm32/l1 \ lpc13xx lpc17xx lpc43xx/m4 lpc43xx/m0 lm3s lm4f \ efm32/efm32tg efm32/efm32g efm32/efm32lg efm32/efm32gg \ sam/3a sam/3n sam/3s sam/3u sam/3x \ diff --git a/README.md b/README.md index 2a262294..46a2120d 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,9 @@ Other toolchains _should_ work, but have not been nearly as well tested. Toolchains targetting linux, such as "gcc-arm-linux-gnu" or the like are _not_ appropriate. +_NOTE_ We recommend, that you use g-a-c version 2.8 2014q3 or newer +to build all platforms covered by libopencm3 succesfully. + Building -------- @@ -92,9 +95,15 @@ them as environment variables, for example: * `FP_FLAGS` - Control the floating-point ABI If the Cortex-M core supports a hard float ABI, it will be compiled with - floating-point support by default. In cases where this is not desired, the - behavior can be specified by setting `FP_FLAGS` Currently, M4F cores default - to `-mfloat-abi=hard -mfpu=fpv4-sp-d16` and others to no FP flags + best floating-point support by default. In cases where this is not desired, the + behavior can be specified by setting `FP_FLAGS`. + + Currently, M4F cores default to `-mfloat-abi=hard -mfpu=fpv4-sp-d16`, + M7 core defaults to double precision `-mfloat-abi=hard -mfpu=fpv5-d16` + and other architectures to no FP flags forcing to use software computation. + + You may find which FP_FLAGS you can use in particular architecture in readme.txt + shipped with gcc-arm-embedded package. Examples: diff --git a/doc/DoxygenLayout.xml b/doc/DoxygenLayout.xml index 9a9958ce..ea54c494 100644 --- a/doc/DoxygenLayout.xml +++ b/doc/DoxygenLayout.xml @@ -11,6 +11,7 @@ + diff --git a/doc/Makefile b/doc/Makefile index dd54ebac..5b1ac1f9 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -3,7 +3,7 @@ # 14 September 2012 # (C) Ken Sarkies -ARCHS := stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 +ARCHS := stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 ARCHS += stm32l0 stm32l1 ARCHS += efm32g efm32gg efm32lg efm32tg ARCHS += lm3s lm4f diff --git a/doc/cm3/DoxygenLayout_cm3.xml b/doc/cm3/DoxygenLayout_cm3.xml index 8bb2549b..136c6bf5 100644 --- a/doc/cm3/DoxygenLayout_cm3.xml +++ b/doc/cm3/DoxygenLayout_cm3.xml @@ -10,6 +10,7 @@ + diff --git a/doc/efm32g/DoxygenLayout_efm32g.xml b/doc/efm32g/DoxygenLayout_efm32g.xml index ee422abd..2738abda 100644 --- a/doc/efm32g/DoxygenLayout_efm32g.xml +++ b/doc/efm32g/DoxygenLayout_efm32g.xml @@ -11,6 +11,7 @@ + diff --git a/doc/efm32gg/DoxygenLayout_efm32gg.xml b/doc/efm32gg/DoxygenLayout_efm32gg.xml index 0360b9ac..bc1a3302 100644 --- a/doc/efm32gg/DoxygenLayout_efm32gg.xml +++ b/doc/efm32gg/DoxygenLayout_efm32gg.xml @@ -11,6 +11,7 @@ + diff --git a/doc/efm32lg/DoxygenLayout_efm32lg.xml b/doc/efm32lg/DoxygenLayout_efm32lg.xml index e15e5f2e..3d58f090 100644 --- a/doc/efm32lg/DoxygenLayout_efm32lg.xml +++ b/doc/efm32lg/DoxygenLayout_efm32lg.xml @@ -11,6 +11,7 @@ + diff --git a/doc/efm32tg/DoxygenLayout_efm32tg.xml b/doc/efm32tg/DoxygenLayout_efm32tg.xml index 9a694f5f..5b1079a0 100644 --- a/doc/efm32tg/DoxygenLayout_efm32tg.xml +++ b/doc/efm32tg/DoxygenLayout_efm32tg.xml @@ -11,6 +11,7 @@ + diff --git a/doc/lm3s/DoxygenLayout_lm3s.xml b/doc/lm3s/DoxygenLayout_lm3s.xml index b66addc3..f89e4da3 100644 --- a/doc/lm3s/DoxygenLayout_lm3s.xml +++ b/doc/lm3s/DoxygenLayout_lm3s.xml @@ -11,6 +11,7 @@ + diff --git a/doc/lm4f/DoxygenLayout_lm4f.xml b/doc/lm4f/DoxygenLayout_lm4f.xml index 63495484..7b3c7898 100644 --- a/doc/lm4f/DoxygenLayout_lm4f.xml +++ b/doc/lm4f/DoxygenLayout_lm4f.xml @@ -11,6 +11,7 @@ + diff --git a/doc/lpc13xx/DoxygenLayout_lpc13xx.xml b/doc/lpc13xx/DoxygenLayout_lpc13xx.xml index 87b3faad..c35dc3c0 100644 --- a/doc/lpc13xx/DoxygenLayout_lpc13xx.xml +++ b/doc/lpc13xx/DoxygenLayout_lpc13xx.xml @@ -10,6 +10,7 @@ + diff --git a/doc/lpc17xx/DoxygenLayout_lpc17xx.xml b/doc/lpc17xx/DoxygenLayout_lpc17xx.xml index 37ebdad5..7c151b11 100644 --- a/doc/lpc17xx/DoxygenLayout_lpc17xx.xml +++ b/doc/lpc17xx/DoxygenLayout_lpc17xx.xml @@ -10,6 +10,7 @@ + diff --git a/doc/lpc43xx/DoxygenLayout_lpc43xx.xml b/doc/lpc43xx/DoxygenLayout_lpc43xx.xml index a113900d..5e59dcf3 100644 --- a/doc/lpc43xx/DoxygenLayout_lpc43xx.xml +++ b/doc/lpc43xx/DoxygenLayout_lpc43xx.xml @@ -10,6 +10,7 @@ + diff --git a/doc/sam3a/DoxygenLayout_sam3a.xml b/doc/sam3a/DoxygenLayout_sam3a.xml index 29ef241d..00eff856 100644 --- a/doc/sam3a/DoxygenLayout_sam3a.xml +++ b/doc/sam3a/DoxygenLayout_sam3a.xml @@ -11,6 +11,7 @@ + diff --git a/doc/sam3n/DoxygenLayout_sam3n.xml b/doc/sam3n/DoxygenLayout_sam3n.xml index 48cb64ae..eae8940e 100644 --- a/doc/sam3n/DoxygenLayout_sam3n.xml +++ b/doc/sam3n/DoxygenLayout_sam3n.xml @@ -11,6 +11,7 @@ + diff --git a/doc/sam3s/DoxygenLayout_sam3s.xml b/doc/sam3s/DoxygenLayout_sam3s.xml index b2277d72..240ca46c 100644 --- a/doc/sam3s/DoxygenLayout_sam3s.xml +++ b/doc/sam3s/DoxygenLayout_sam3s.xml @@ -11,6 +11,7 @@ + diff --git a/doc/sam3u/DoxygenLayout_sam3u.xml b/doc/sam3u/DoxygenLayout_sam3u.xml index 2a4b5938..ca4a4e67 100644 --- a/doc/sam3u/DoxygenLayout_sam3u.xml +++ b/doc/sam3u/DoxygenLayout_sam3u.xml @@ -11,6 +11,7 @@ + diff --git a/doc/sam3x/DoxygenLayout_sam3x.xml b/doc/sam3x/DoxygenLayout_sam3x.xml index 71bc2078..b17c38cd 100644 --- a/doc/sam3x/DoxygenLayout_sam3x.xml +++ b/doc/sam3x/DoxygenLayout_sam3x.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f0/DoxygenLayout_stm32f0.xml b/doc/stm32f0/DoxygenLayout_stm32f0.xml index c477fccd..577cb951 100644 --- a/doc/stm32f0/DoxygenLayout_stm32f0.xml +++ b/doc/stm32f0/DoxygenLayout_stm32f0.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f1/DoxygenLayout_stm32f1.xml b/doc/stm32f1/DoxygenLayout_stm32f1.xml index 210952d0..ccd68760 100644 --- a/doc/stm32f1/DoxygenLayout_stm32f1.xml +++ b/doc/stm32f1/DoxygenLayout_stm32f1.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f2/DoxygenLayout_stm32f2.xml b/doc/stm32f2/DoxygenLayout_stm32f2.xml index 24a92328..485af00d 100644 --- a/doc/stm32f2/DoxygenLayout_stm32f2.xml +++ b/doc/stm32f2/DoxygenLayout_stm32f2.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f3/DoxygenLayout_stm32f3.xml b/doc/stm32f3/DoxygenLayout_stm32f3.xml index 8b477f5f..abdbf8e3 100644 --- a/doc/stm32f3/DoxygenLayout_stm32f3.xml +++ b/doc/stm32f3/DoxygenLayout_stm32f3.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f4/DoxygenLayout_stm32f4.xml b/doc/stm32f4/DoxygenLayout_stm32f4.xml index 044cae31..4dcd0918 100644 --- a/doc/stm32f4/DoxygenLayout_stm32f4.xml +++ b/doc/stm32f4/DoxygenLayout_stm32f4.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32f7/Doxyfile b/doc/stm32f7/Doxyfile new file mode 100644 index 00000000..18703265 --- /dev/null +++ b/doc/stm32f7/Doxyfile @@ -0,0 +1,38 @@ +# HTML Documentation for STM32F7 code level + +# 14 September 2012 +# (C) Ken Sarkies + +#--------------------------------------------------------------------------- +# Common Include File +#--------------------------------------------------------------------------- + +@INCLUDE = ../Doxyfile_common + +#--------------------------------------------------------------------------- +# Local settings +#--------------------------------------------------------------------------- + +WARN_LOGFILE = doxygen_stm32f7.log + +INPUT = ../../include/libopencm3/license.dox \ + ../../include/libopencm3/stm32/f7 \ + ../../include/libopencm3/stm32/common + +INPUT += ../../lib/stm32/f7 \ + ../../lib/stm32/common + +EXCLUDE = + +EXCLUDE_PATTERNS = *_common_f*3.h *_common_f*3.c \ + *_common_*f013.h *_common_*f013.c \ + *_common_*f01.h *_common_*f01.c \ \ + *_common_*f03.h *_common_*f03.c + +LAYOUT_FILE = DoxygenLayout_stm32f7.xml + +GENERATE_TAGFILE = stm32f7.tag + +ENABLE_PREPROCESSING = YES + + diff --git a/doc/stm32f7/Doxyfile_latex b/doc/stm32f7/Doxyfile_latex new file mode 100644 index 00000000..28517110 --- /dev/null +++ b/doc/stm32f7/Doxyfile_latex @@ -0,0 +1,37 @@ +# LaTeX Documentation for STM32F7 code level + +# 14 September 2012 +# (C) Ken Sarkies + +#--------------------------------------------------------------------------- +# Common Include File +#--------------------------------------------------------------------------- + +@INCLUDE = ../Doxyfile_common + +#--------------------------------------------------------------------------- +# Local settings +#--------------------------------------------------------------------------- + +WARN_LOGFILE = doxygen_stm32f7_latex.log + +INPUT = ../../include/libopencm3/docmain.dox \ + ../../include/libopencm3/license.dox \ + ../../include/libopencm3/stm32/f7 \ + ../../include/libopencm3/stm32/common + +INPUT += ../../lib/stm32/f4 \ + ../../lib/stm32/common + +EXCLUDE = ../../include/libopencm3/stm32/f4/doc-stm32f7.h + +EXCLUDE_PATTERNS = + +LAYOUT_FILE = DoxygenLayout_stm32f7.xml + +GENERATE_HTML = NO + +GENERATE_LATEX = YES + +LATEX_HEADER = header_stm32f7.tex + diff --git a/doc/stm32f7/DoxygenLayout_stm32f7.xml b/doc/stm32f7/DoxygenLayout_stm32f7.xml new file mode 100644 index 00000000..067c4b8a --- /dev/null +++ b/doc/stm32f7/DoxygenLayout_stm32f7.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stm32f7/header_stm32f7.tex b/doc/stm32f7/header_stm32f7.tex new file mode 100644 index 00000000..03ff59c2 --- /dev/null +++ b/doc/stm32f7/header_stm32f7.tex @@ -0,0 +1,61 @@ +\documentclass{book} +\usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry} +\usepackage{makeidx} +\usepackage{natbib} +\usepackage{graphicx} +\usepackage{multicol} +\usepackage{float} +\usepackage{listings} +\usepackage{color} +\usepackage{ifthen} +\usepackage[table]{xcolor} +\usepackage{textcomp} +\usepackage{alltt} +\usepackage{ifpdf} +\ifpdf +\usepackage[pdftex, + pagebackref=true, + colorlinks=true, + linkcolor=blue, + unicode + ]{hyperref} +\else +\usepackage[ps2pdf, + pagebackref=true, + colorlinks=true, + linkcolor=blue, + unicode + ]{hyperref} +\usepackage{pspicture} +\fi +\usepackage[utf8]{inputenc} +\usepackage{mathptmx} +\usepackage[scaled=.90]{helvet} +\usepackage{courier} +\usepackage{sectsty} +\usepackage{amssymb} +\usepackage[titles]{tocloft} +\usepackage{doxygen} +\lstset{language=C++,inputencoding=utf8,basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,tabsize=4,numbers=left } +\makeindex +\setcounter{tocdepth}{3} +\renewcommand{\footrulewidth}{0.4pt} +\renewcommand{\familydefault}{\sfdefault} +\hfuzz=15pt +\setlength{\emergencystretch}{15pt} +\hbadness=750 +\tolerance=750 +\begin{document} +\hypersetup{pageanchor=false,citecolor=blue} +\begin{titlepage} +\vspace*{7cm} +\begin{center} +{\Huge libopencm3: API Reference\\ STM STM32F7 ARM Cortex M7 Series}\\ +\vspace*{1cm} +{\large Generated by Doxygen 1.8.2}\\ +\vspace*{0.5cm} +{\small Thu Sep 13 2012 23:26:45}\\ +\end{center} +\end{titlepage} +\pagenumbering{arabic} +\hypersetup{pageanchor=true,citecolor=blue} diff --git a/doc/stm32f7/index.html b/doc/stm32f7/index.html new file mode 100644 index 00000000..7715877a --- /dev/null +++ b/doc/stm32f7/index.html @@ -0,0 +1,8 @@ + + + + + + Documentation index

+ + diff --git a/doc/stm32l0/DoxygenLayout_stm32l0.xml b/doc/stm32l0/DoxygenLayout_stm32l0.xml index 31dbab87..f7e1add3 100644 --- a/doc/stm32l0/DoxygenLayout_stm32l0.xml +++ b/doc/stm32l0/DoxygenLayout_stm32l0.xml @@ -11,6 +11,7 @@ + diff --git a/doc/stm32l1/DoxygenLayout_stm32l1.xml b/doc/stm32l1/DoxygenLayout_stm32l1.xml index d23816aa..039ec48c 100644 --- a/doc/stm32l1/DoxygenLayout_stm32l1.xml +++ b/doc/stm32l1/DoxygenLayout_stm32l1.xml @@ -11,6 +11,7 @@ + diff --git a/doc/vf6xx/DoxygenLayout_vf6xx.xml b/doc/vf6xx/DoxygenLayout_vf6xx.xml index 714a2be9..9b427673 100644 --- a/doc/vf6xx/DoxygenLayout_vf6xx.xml +++ b/doc/vf6xx/DoxygenLayout_vf6xx.xml @@ -11,6 +11,8 @@ + + diff --git a/include/libopencm3/dispatch/nvic.h b/include/libopencm3/dispatch/nvic.h index 644e27e3..89e87801 100644 --- a/include/libopencm3/dispatch/nvic.h +++ b/include/libopencm3/dispatch/nvic.h @@ -12,6 +12,8 @@ # include #elif defined(STM32F4) # include +#elif defined(STM32F7) +# include #elif defined(STM32L0) # include #elif defined(STM32L1) diff --git a/include/libopencm3/stm32/f7/doc-stm32f7.h b/include/libopencm3/stm32/f7/doc-stm32f7.h new file mode 100644 index 00000000..720693f7 --- /dev/null +++ b/include/libopencm3/stm32/f7/doc-stm32f7.h @@ -0,0 +1,32 @@ +/** @mainpage libopencm3 STM32F7 + +@version 1.0.0 + +@date 15 September 2014 + +API documentation for ST Microelectronics STM32F7 Cortex M7 series. + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup STM32F7xx STM32F7xx +Libraries for ST Microelectronics STM32F7xx series. + +@version 1.0.0 + +@date 15 September 2014 + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup STM32F7xx_defines STM32F7xx Defines + +@brief Defined Constants and Types for the STM32F7xx series + +@version 1.0.0 + +@date 15 September 2014 + +LGPL License Terms @ref lgpl_license +*/ + diff --git a/include/libopencm3/stm32/f7/gpio.h b/include/libopencm3/stm32/f7/gpio.h new file mode 100644 index 00000000..6e88e225 --- /dev/null +++ b/include/libopencm3/stm32/f7/gpio.h @@ -0,0 +1,37 @@ +/** @defgroup gpio_defines GPIO Defines + +@brief Defined Constants and Types for the STM32F7xx General Purpose I/O + +@ingroup STM32F7xx_defines + +@version 1.0.0 + +@date 1 July 2012 + +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 . + */ + +#ifndef LIBOPENCM3_GPIO_H +#define LIBOPENCM3_GPIO_H + +#include + +#endif + diff --git a/include/libopencm3/stm32/f7/irq.json b/include/libopencm3/stm32/f7/irq.json new file mode 100644 index 00000000..0dc069e6 --- /dev/null +++ b/include/libopencm3/stm32/f7/irq.json @@ -0,0 +1,98 @@ +{ + "irqs": [ + "nvic_wwdg", + "pvd", + "tamp_stamp", + "rtc_wkup", + "flash", + "rcc", + "exti0", + "exti1", + "exti2", + "exti3", + "exti4", + "dma1_stream0", + "dma1_stream1", + "dma1_stream2", + "dma1_stream3", + "dma1_stream4", + "dma1_stream5", + "dma1_stream6", + "adc", + "can1_tx", + "can1_rx0", + "can1_rx1", + "can1_sce", + "exti9_5", + "tim1_brk_tim9", + "tim1_up_tim10", + "tim1_trg_com_tim11", + "tim1_cc", + "tim2", + "tim3", + "tim4", + "i2c1_ev", + "i2c1_er", + "i2c2_ev", + "i2c2_er", + "spi1", + "spi2", + "usart1", + "usart2", + "usart3", + "exti15_10", + "rtc_alarm", + "usb_fs_wkup", + "tim8_brk_tim12", + "tim8_up_tim13", + "tim8_trg_com_tim14", + "tim8_cc", + "dma1_stream7", + "fsmc", + "sdio", + "tim5", + "spi3", + "uart4", + "uart5", + "tim6_dac", + "tim7", + "dma2_stream0", + "dma2_stream1", + "dma2_stream2", + "dma2_stream3", + "dma2_stream4", + "eth", + "eth_wkup", + "can2_tx", + "can2_rx0", + "can2_rx1", + "can2_sce", + "otg_fs", + "dma2_stream5", + "dma2_stream6", + "dma2_stream7", + "usart6", + "i2c3_ev", + "i2c3_er", + "otg_hs_ep1_out", + "otg_hs_ep1_in", + "otg_hs_wkup", + "otg_hs", + "dcmi", + "cryp", + "hash_rng", + "fpu", + "uart7", + "uart8", + "spi4", + "spi5", + "spi6", + "sai1", + "lcd_tft", + "lcd_tft_err", + "dma2d" + ], + "partname_humanreadable": "STM32 F7 series", + "partname_doxygen": "STM32F7", + "includeguard": "LIBOPENCM3_STM32_F7_NVIC_H" +} diff --git a/include/libopencm3/stm32/f7/memorymap.h b/include/libopencm3/stm32/f7/memorymap.h new file mode 100644 index 00000000..093c7ca6 --- /dev/null +++ b/include/libopencm3/stm32/f7/memorymap.h @@ -0,0 +1,164 @@ +/* + * 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 . + */ + +#ifndef LIBOPENCM3_MEMORYMAP_H +#define LIBOPENCM3_MEMORYMAP_H + +#include + +/* --- STM32F4 specific peripheral definitions ----------------------------- */ + +/* Memory map for all busses */ +#define PERIPH_BASE (0x40000000U) +#define PERIPH_BASE_APB1 (PERIPH_BASE + 0x00000) +#define PERIPH_BASE_APB2 (PERIPH_BASE + 0x10000) +#define PERIPH_BASE_AHB1 (PERIPH_BASE + 0x20000) +#define PERIPH_BASE_AHB2 0x50000000U +#define PERIPH_BASE_AHB3 0x60000000U + +/* Register boundary addresses */ + +/* APB1 */ +#define TIM2_BASE (PERIPH_BASE_APB1 + 0x0000) +#define TIM3_BASE (PERIPH_BASE_APB1 + 0x0400) +#define TIM4_BASE (PERIPH_BASE_APB1 + 0x0800) +#define TIM5_BASE (PERIPH_BASE_APB1 + 0x0c00) +#define TIM6_BASE (PERIPH_BASE_APB1 + 0x1000) +#define TIM7_BASE (PERIPH_BASE_APB1 + 0x1400) +#define TIM12_BASE (PERIPH_BASE_APB1 + 0x1800) +#define TIM13_BASE (PERIPH_BASE_APB1 + 0x1c00) +#define TIM14_BASE (PERIPH_BASE_APB1 + 0x2000) +#define LPTIM1_BASE (PERIPH_BASE_APB1 + 0x2400) +#define RTC_BASE (PERIPH_BASE_APB1 + 0x2800) +#define WWDG_BASE (PERIPH_BASE_APB1 + 0x2c00) +#define IWDG_BASE (PERIPH_BASE_APB1 + 0x3000) +/* PERIPH_BASE_APB1 + 0x3400 (0x4000 3400 - 0x4000 37FF): Reserved */ +#define SPI2_BASE (PERIPH_BASE_APB1 + 0x3800) +#define SPI3_BASE (PERIPH_BASE_APB1 + 0x3c00) +#define SPDIF_BASE (PERIPH_BASE_APB1 + 0x4000) +#define USART2_BASE (PERIPH_BASE_APB1 + 0x4400) +#define USART3_BASE (PERIPH_BASE_APB1 + 0x4800) +#define UART4_BASE (PERIPH_BASE_APB1 + 0x4c00) +#define UART5_BASE (PERIPH_BASE_APB1 + 0x5000) +#define I2C1_BASE (PERIPH_BASE_APB1 + 0x5400) +#define I2C2_BASE (PERIPH_BASE_APB1 + 0x5800) +#define I2C3_BASE (PERIPH_BASE_APB1 + 0x5C00) +#define I2C4_BASE (PERIPH_BASE_APB1 + 0x6000) +#define BX_CAN1_BASE (PERIPH_BASE_APB1 + 0x6400) +#define BX_CAN2_BASE (PERIPH_BASE_APB1 + 0x6800) +#define CEC_BASE (PERIPH_BASE_APB1 + 0x6C00) +#define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000) +#define DAC_BASE (PERIPH_BASE_APB1 + 0x7400) +#define UART7_BASE (PERIPH_BASE_APB1 + 0x7800) +#define UART8_BASE (PERIPH_BASE_APB1 + 0x7c00) +/* PERIPH_BASE_APB1 + 0x7800 (0x4000 8000 - 0x4000 FFFF): Reserved */ + +/* APB2 */ +#define TIM1_BASE (PERIPH_BASE_APB2 + 0x0000) +#define TIM8_BASE (PERIPH_BASE_APB2 + 0x0400) +/* PERIPH_BASE_APB2 + 0x0800 (0x4001 0800 - 0x4001 0FFF): Reserved */ +#define USART1_BASE (PERIPH_BASE_APB2 + 0x1000) +#define USART6_BASE (PERIPH_BASE_APB2 + 0x1400) +/* PERIPH_BASE_APB2 + 0x1800 (0x4001 1800 - 0x4001 1FFF): Reserved */ +#define ADC1_BASE (PERIPH_BASE_APB2 + 0x2000) /* TODO */ +#define ADC2_BASE (PERIPH_BASE_APB2 + 0x2100) /* TODO */ +#define ADC3_BASE (PERIPH_BASE_APB2 + 0x2200) /* TODO */ +#define ADC_COMMON_BASE (PERIPH_BASE_APB2 + 0x2300) /* TODO */ +/* PERIPH_BASE_APB2 + 0x2400 (0x4001 2400 - 0x4001 27FF): Reserved */ +#define SDIO_BASE (PERIPH_BASE_APB2 + 0x2C00) /* SDMMC */ +/* PERIPH_BASE_APB2 + 0x2C00 (0x4001 2C00 - 0x4001 2FFF): Reserved */ +#define SPI1_BASE (PERIPH_BASE_APB2 + 0x3000) +#define SPI4_BASE (PERIPH_BASE_APB2 + 0x3400) +#define SYSCFG_BASE (PERIPH_BASE_APB2 + 0x3800) +#define EXTI_BASE (PERIPH_BASE_APB2 + 0x3C00) +#define TIM9_BASE (PERIPH_BASE_APB2 + 0x4000) +#define TIM10_BASE (PERIPH_BASE_APB2 + 0x4400) +#define TIM11_BASE (PERIPH_BASE_APB2 + 0x4800) +/* PERIPH_BASE_APB2 + 0x4C00 (0x4001 4C00 - 0x4001 4FFF): Reserved */ +#define SPI5_BASE (PERIPH_BASE_APB2 + 0x5000) +#define SPI6_BASE (PERIPH_BASE_APB2 + 0x5400) +#define SAI1_BASE (PERIPH_BASE_APB2 + 0x5800) +#define SAI2_BASE (PERIPH_BASE_APB2 + 0x5C00) +#define LCD_TFT_BASE (PERIPH_BASE_APB2 + 0x6800) +/* PERIPH_BASE_APB2 + 0x6C00 (0x4001 6C00 - 0x4001 FFFF): Reserved */ + +/* AHB1 */ +#define GPIO_PORT_A_BASE (PERIPH_BASE_AHB1 + 0x0000) +#define GPIO_PORT_B_BASE (PERIPH_BASE_AHB1 + 0x0400) +#define GPIO_PORT_C_BASE (PERIPH_BASE_AHB1 + 0x0800) +#define GPIO_PORT_D_BASE (PERIPH_BASE_AHB1 + 0x0C00) +#define GPIO_PORT_E_BASE (PERIPH_BASE_AHB1 + 0x1000) +#define GPIO_PORT_F_BASE (PERIPH_BASE_AHB1 + 0x1400) +#define GPIO_PORT_G_BASE (PERIPH_BASE_AHB1 + 0x1800) +#define GPIO_PORT_H_BASE (PERIPH_BASE_AHB1 + 0x1C00) +#define GPIO_PORT_I_BASE (PERIPH_BASE_AHB1 + 0x2000) +#define GPIO_PORT_J_BASE (PERIPH_BASE_AHB1 + 0x2400) +#define GPIO_PORT_K_BASE (PERIPH_BASE_AHB1 + 0x2800) +/* PERIPH_BASE_AHB1 + 0x2C00 (0x4002 2C00 - 0x4002 2FFF): Reserved */ +#define CRC_BASE (PERIPH_BASE_AHB1 + 0x3000) +/* PERIPH_BASE_AHB1 + 0x3400 (0x4002 3400 - 0x4002 37FF): Reserved */ +#define RCC_BASE (PERIPH_BASE_AHB1 + 0x3800) +#define FLASH_MEM_INTERFACE_BASE (PERIPH_BASE_AHB1 + 0x3C00) +#define BKPSRAM_BASE (PERIPH_BASE_AHB1 + 0x4000) +/* PERIPH_BASE_AHB1 + 0x5000 (0x4002 5000 - 0x4002 5FFF): Reserved */ +#define DMA1_BASE (PERIPH_BASE_AHB1 + 0x6000) +#define DMA2_BASE (PERIPH_BASE_AHB1 + 0x6400) +/* PERIPH_BASE_AHB1 + 0x6800 (0x4002 6800 - 0x4002 7FFF): Reserved */ +#define ETHERNET_BASE (PERIPH_BASE_AHB1 + 0x8000) + +#define DMA2D_BASE (PERIPH_BASE_AHB1 + 0xB000) + +#define USB_OTG_HS_BASE (PERIPH_BASE_AHB1 + 0x20000) + + +/* AHB2 */ +#define USB_OTG_FS_BASE (PERIPH_BASE_AHB2 + 0x00000) +/* PERIPH_BASE_AHB2 + 0x40000 (0x5004 0000 - 0x5004 FFFF): Reserved */ +#define DCMI_BASE (PERIPH_BASE_AHB2 + 0x50000) +/* PERIPH_BASE_AHB2 + 0x50400 (0x5005 0400 - 0x5005 FFFF): Reserved */ +#define CRYP_BASE (PERIPH_BASE_AHB2 + 0x60000) +#define HASH_BASE (PERIPH_BASE_AHB2 + 0x60400) +/* PERIPH_BASE_AHB2 + 0x60C00 (0x5006 0C00 - 0x5006 07FF): Reserved */ +#define RNG_BASE (PERIPH_BASE_AHB2 + 0x60800) +/* PERIPH_BASE_AHB2 + 0x61000 (0x5006 1000 - 0x5FFF FFFF): Reserved */ + +/* AHB3 */ +#define FMC1_BASE (PERIPH_BASE_AHB3 + 0x00000000U) +#define FMC2_BASE (PERIPH_BASE_AHB3 + 0x10000000U) +#define FMC3_BASE (PERIPH_BASE_AHB3 + 0x20000000U) +#define QSPI_BASE (PERIPH_BASE_AHB3 + 0x30000000U) +#define FMCC_BASE (PERIPH_BASE_AHB3 + 0x40000000U) +#define QSPIC_BASE (PERIPH_BASE_AHB3 + 0x40001000U) +#define FMC5_BASE (PERIPH_BASE_AHB3 + 0x60000000U) +#define FMC6_BASE (PERIPH_BASE_AHB3 + 0x70000000U) + +/* PPIB */ +#define DBGMCU_BASE (PPBI_BASE + 0x00042000) /* TODO */ + +/* Device Electronic Signature */ +#define DESIG_FLASH_SIZE_BASE (0x1FFF7A22U) /* TODO */ +#define DESIG_UNIQUE_ID_BASE (0x1FFF7A10U) /* TODO */ +#define DESIG_UNIQUE_ID0 MMIO32(DESIG_UNIQUE_ID_BASE) /* TODO */ +#define DESIG_UNIQUE_ID1 MMIO32(DESIG_UNIQUE_ID_BASE + 4)/* TODO */ +#define DESIG_UNIQUE_ID2 MMIO32(DESIG_UNIQUE_ID_BASE + 8)/* TODO */ + +/* ST provided factory calibration values @ 3.3V */ +#define ST_VREFINT_CAL MMIO16(0x1FFF7A2A) /* TODO */ +#define ST_TSENSE_CAL1_30C MMIO16(0x1FFF7A2C) /* TODO */ +#define ST_TSENSE_CAL2_110 MMIO16(0x1FFF7A2E) /* TODO */ + +#endif diff --git a/include/libopencm3/stm32/gpio.h b/include/libopencm3/stm32/gpio.h index 7cc4640e..3aa55740 100644 --- a/include/libopencm3/stm32/gpio.h +++ b/include/libopencm3/stm32/gpio.h @@ -30,6 +30,8 @@ # include #elif defined(STM32F4) # include +#elif defined(STM32F7) +# include #elif defined(STM32L0) # include #elif defined(STM32L1) diff --git a/include/libopencm3/stm32/memorymap.h b/include/libopencm3/stm32/memorymap.h index 9ae7b7bd..6ff00990 100644 --- a/include/libopencm3/stm32/memorymap.h +++ b/include/libopencm3/stm32/memorymap.h @@ -30,6 +30,8 @@ # include #elif defined(STM32F4) # include +#elif defined(STM32F7) +# include #elif defined(STM32L0) # include #elif defined(STM32L1) diff --git a/ld/devices.data b/ld/devices.data index 9e0e1882..0ace7f94 100644 --- a/ld/devices.data +++ b/ld/devices.data @@ -129,6 +129,10 @@ stm32f4[01][57]?g* stm32f4ccm ROM=1024K RAM=128K CCM=64K stm32f4[23][79]?g* stm32f4ccm ROM=1024K RAM=192K CCM=64K stm32f4[23][79]?i* stm32f4ccm ROM=2048K RAM=192K CCM=64K +# on F7 CCM is in some datasheets named as DTCM +stm32f756?e* stm32f7ccm ROM=512K RAM=256K CCM=64K +stm32f756?g* stm32f7ccm ROM=1024K RAM=256K CCM=64K + stm32l0???6* stm32l0 ROM=32K RAM=8K stm32l0???8* stm32l0 ROM=64K RAM=8K @@ -314,6 +318,7 @@ rm46l852* rm46l ROM=1280K RAM=192K stm32f3ccm stm32f3 CCM_OFF=0x10000000 stm32f4ccm stm32f4 CCM_OFF=0x10000000 +stm32f7ccm stm32f7 CCM_OFF=0x20000000 stm32l1eep stm32l1 EEP_OFF=0x08080000 ################################################################################ @@ -339,6 +344,8 @@ stm32f1 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m3 -mthumb -DST stm32f2 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m3 -mthumb -DSTM32F2 -lopencm3_stm32f2 -msoft-float stm32f3 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m4 -mthumb -DSTM32F3 -lopencm3_stm32f3 -mfloat-abi=hard -mfpu=fpv4-sp-d16 stm32f4 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m4 -mthumb -DSTM32F4 -lopencm3_stm32f4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 +#stm32f7 is supported on GCC-arm-embedded 4.8 2014q4 +stm32f7 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20010000 -mcpu=cortex-m7 -mthumb -DSTM32F7 -lopencm3_stm32f7 -mfloat-abi=hard -mfpu=fpv4-sp-d16 stm32l0 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m0 -mthumb -DSTM32L0 -lopencm3_stm32l0 -msoft-float stm32l1 stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m3 -mthumb -DSTM32L1 -lopencm3_stm32l1 -msoft-float stm32w stm32 ROM_OFF=0x08000000 RAM_OFF=0x20000000 -mcpu=cortex-m3 -mthumb diff --git a/lib/dispatch/vector_chipset.c b/lib/dispatch/vector_chipset.c index 6036e164..1d13c761 100644 --- a/lib/dispatch/vector_chipset.c +++ b/lib/dispatch/vector_chipset.c @@ -2,6 +2,8 @@ # include "../stm32/f3/vector_chipset.c" #elif defined(STM32F4) # include "../stm32/f4/vector_chipset.c" +#elif defined(STM32F7) +# include "../stm32/f7/vector_chipset.c" #elif defined(LPC43XX_M4) # include "../lpc43xx/m4/vector_chipset.c" #elif defined(VF6XX) diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c index cc466510..31afaa03 100644 --- a/lib/dispatch/vector_nvic.c +++ b/lib/dispatch/vector_nvic.c @@ -8,6 +8,8 @@ # include "../stm32/f3/vector_nvic.c" #elif defined(STM32F4) # include "../stm32/f4/vector_nvic.c" +#elif defined(STM32F7) +# include "../stm32/f7/vector_nvic.c" #elif defined(STM32L0) # include "../stm32/l0/vector_nvic.c" #elif defined(STM32L1) diff --git a/lib/stm32/f7/Makefile b/lib/stm32/f7/Makefile new file mode 100644 index 00000000..d7f314f7 --- /dev/null +++ b/lib/stm32/f7/Makefile @@ -0,0 +1,70 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2009 Uwe Hermann +## Copyright (C) 2013 Alexandru Gagniuc +## +## 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 . +## + +LIBNAME = libopencm3_stm32f7 +SRCLIBDIR ?= ../.. + +PREFIX ?= arm-none-eabi + +CC = $(PREFIX)-gcc +AR = $(PREFIX)-ar + +# By default, use double precision FPU +FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv5-d16 + +CFLAGS = -Os -g \ + -Wall -Wextra -Wimplicit-function-declaration \ + -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ + -Wundef -Wshadow \ + -I../../../include -fno-common \ + -mcpu=cortex-m7 -mthumb $(FP_FLAGS) \ + -Wstrict-prototypes \ + -ffunction-sections -fdata-sections -MD -DSTM32F7 + +ARFLAGS = rcs + +OBJS = gpio.o gpio_common_all.o gpio_common_f0234.o + +VPATH += ../../usb:../:../../cm3:../common +VPATH += ../../ethernet + +############################################################################### +# Checking CPU support in the toolchain +############################################################################### +# TODO: This check and silent skip of build should be removed, when it will be +# sure that first compatible toolchain (g-a-e 4.8 2014q3) will be sufficiently +# penetrated in majority of user stations. +define MISSING_CPU +Your toolchain doesn't support -mcpu=cortex-m7. +Please use gcc-arm-embedded 4.8 2014q3 or newer. Skipping this sub-library. +endef + +ifneq ($(shell $(CC) -fsyntax-only -mcpu=cortex-m7 -mthumb -xc /dev/null 2>&1; echo $$?),0) + $(warning $(MISSING_CPU)) + +all clean: + @true + +$(SRCLIBDIR)/$(LIBNAME).a: + @true + +else + include ../../Makefile.include +endif diff --git a/lib/stm32/f7/gpio.c b/lib/stm32/f7/gpio.c new file mode 100644 index 00000000..a5fb4afc --- /dev/null +++ b/lib/stm32/f7/gpio.c @@ -0,0 +1,31 @@ +/** @defgroup gpio_file GPIO + +@ingroup STM32F7xx + +@brief libopencm3 STM32F7xx General Purpose I/O + +@version 1.0.0 + +@date 18 August 2012 + +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 diff --git a/lib/stm32/f7/libopencm3_stm32f7.ld b/lib/stm32/f7/libopencm3_stm32f7.ld new file mode 100644 index 00000000..3fc2ccb6 --- /dev/null +++ b/lib/stm32/f7/libopencm3_stm32f7.ld @@ -0,0 +1,106 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * + * 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 . + */ + +/* Generic linker script for STM32 targets using libopencm3. */ + +/* Memory regions must be defined in the ld script which includes this one. */ + +/* Enforce emmition of the vector table. */ +EXTERN (vector_table) + +/* Define the entry point of the output file. */ +ENTRY(reset_handler) + +/* Define sections. */ +SECTIONS +{ + .text : { + *(.vectors) /* Vector table */ + *(.text*) /* Program code */ + . = ALIGN(4); + *(.rodata*) /* Read-only data */ + . = ALIGN(4); + } >rom + + /* C++ Static constructors/destructors, also used for __attribute__ + * ((constructor)) and the likes */ + .preinit_array : { + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + } >rom + .init_array : { + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + } >rom + .fini_array : { + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + } >rom + + /* + * Another section used by C++ stuff, appears when using newlib with + * 64bit (long long) printf support + */ + .ARM.extab : { + *(.ARM.extab*) + } >rom + .ARM.exidx : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >rom + + . = ALIGN(4); + _etext = .; + + .data : { + _data = .; + *(.data*) /* Read-write initialized data */ + . = ALIGN(4); + _edata = .; + } >ram AT >rom + _data_loadaddr = LOADADDR(.data); + + .bss : { + *(.bss*) /* Read-write zero initialized data */ + *(COMMON) + . = ALIGN(4); + _ebss = .; + } >ram + + /* + * The .eh_frame section appears to be used for C++ exception handling. + * You may need to fix this if you're using C++. + */ + /DISCARD/ : { *(.eh_frame) } + + . = ALIGN(4); + end = .; +} + +PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram)); + diff --git a/lib/stm32/f7/vector_chipset.c b/lib/stm32/f7/vector_chipset.c new file mode 100644 index 00000000..145be057 --- /dev/null +++ b/lib/stm32/f7/vector_chipset.c @@ -0,0 +1,27 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2010 Piotr Esden-Tempski + * Copyright (C) 2011 Fergus Noble + * + * 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 + +static void pre_main(void) +{ + /* Enable access to Floating-Point coprocessor. */ + SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11); +}