-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32F7 SoC family and STM32F746G Discovery board basic support #7284
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b192f94
arch: arm: stm32: Basic STM32F7 family support
cd29ee2
drivers: clock_control: STM32F7 family clock control
8480701
drivers: flash: stm32: STM32F7 flash memory suport
fcb0cf1
drivers: gpio: stm32: STM32F7 GPIO support
6eccb1f
drivers: pinmux: stm32: STM32F7 pinmux support
2cb17f1
serial: stm32: STM32F7 UART support
b7554b7
drivers: interrupt_controller: stm32: STM32F7 EXTI support
787cee9
arm: stm32: STM32F7 family device tree
7c027e5
boards: arm: stm32: Basic support for STM32F746G-DISCO board
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
zephyr_include_directories(${ZEPHYR_BASE}/drivers) | ||
zephyr_sources( | ||
soc.c | ||
) | ||
zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Kconfig.defconfig.series - ST Microelectronics STM32F7 MCU line | ||
# | ||
# Copyright (c) 2018 Yurii Hamann | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
if SOC_SERIES_STM32F7X | ||
|
||
gsource "arch/arm/soc/st_stm32/stm32f7/Kconfig.defconfig.stm32f7*" | ||
|
||
config SOC_SERIES | ||
default "stm32f7" | ||
|
||
if GPIO_STM32 | ||
|
||
config GPIO_STM32_PORTD | ||
default y | ||
|
||
config GPIO_STM32_PORTE | ||
default y | ||
|
||
config GPIO_STM32_PORTH | ||
default y | ||
|
||
config GPIO_STM32_PORTI | ||
default y | ||
|
||
endif # GPIO_STM32 | ||
|
||
endif # SOC_SERIES_STM32F7X |
28 changes: 28 additions & 0 deletions
28
arch/arm/soc/st_stm32/stm32f7/Kconfig.defconfig.stm32f746xg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Kconfig - ST STM32F746XG MCU configuration options | ||
# | ||
# Copyright (c) 2018 Yurii Hamann | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
if SOC_STM32F746XG | ||
|
||
config SOC | ||
string | ||
default "stm32f746xx" | ||
|
||
if GPIO_STM32 | ||
|
||
config GPIO_STM32_PORTJ | ||
default y | ||
|
||
config GPIO_STM32_PORTK | ||
default y | ||
|
||
endif # GPIO_STM32 | ||
|
||
config NUM_IRQS | ||
int | ||
default 98 | ||
|
||
endif # SOC_STM32F746XG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Kconfig - ST Microelectronics STM32F7 MCU series | ||
# | ||
# Copyright (c) 2018 Yurii Hamann | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
config SOC_SERIES_STM32F7X | ||
bool "STM32F7x Series MCU" | ||
select CPU_CORTEX_M7 | ||
select CPU_HAS_FPU | ||
select SOC_FAMILY_STM32 | ||
select SYS_POWER_LOW_POWER_STATE_SUPPORTED | ||
select HAS_STM32CUBE | ||
select CPU_HAS_SYSTICK | ||
select CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL | ||
help | ||
Enable support for STM32F7 MCU series |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Kconfig.soc - ST Microelectronics STM32F7 MCU line | ||
# | ||
# Copyright (c) 2018 Yurii Hamann | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
choice | ||
prompt "STM32F7x MCU Selection" | ||
depends on SOC_SERIES_STM32F7X | ||
|
||
config SOC_STM32F746XG | ||
bool "STM32F746XG" | ||
|
||
endchoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* SoC level DTS fixup file */ | ||
|
||
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS | ||
|
||
#define CONFIG_UART_STM32_USART_1_BASE_ADDRESS ST_STM32_USART_40011000_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_1_BAUD_RATE ST_STM32_USART_40011000_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_1_IRQ_PRI ST_STM32_USART_40011000_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_1_NAME ST_STM32_USART_40011000_LABEL | ||
#define USART_1_IRQ ST_STM32_USART_40011000_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_2_BASE_ADDRESS ST_STM32_USART_40004400_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_2_BAUD_RATE ST_STM32_USART_40004400_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_2_IRQ_PRI ST_STM32_USART_40004400_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_2_NAME ST_STM32_USART_40004400_LABEL | ||
#define USART_2_IRQ ST_STM32_USART_40004400_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_3_BASE_ADDRESS ST_STM32_USART_40004800_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_3_BAUD_RATE ST_STM32_USART_40004800_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_3_IRQ_PRI ST_STM32_USART_40004800_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_3_NAME ST_STM32_USART_40004800_LABEL | ||
#define USART_3_IRQ ST_STM32_USART_40004800_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_4_BASE_ADDRESS ST_STM32_USART_40004C00_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_4_BAUD_RATE ST_STM32_USART_40004C00_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_4_IRQ_PRI ST_STM32_USART_40004C00_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_4_NAME ST_STM32_USART_40004C00_LABEL | ||
#define USART_4_IRQ ST_STM32_USART_40004C00_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_5_BASE_ADDRESS ST_STM32_USART_40005000_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_5_BAUD_RATE ST_STM32_USART_40005000_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_5_IRQ_PRI ST_STM32_USART_40005000_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_5_NAME ST_STM32_USART_40005000_LABEL | ||
#define USART_5_IRQ ST_STM32_USART_40005000_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_6_BASE_ADDRESS ST_STM32_USART_40011400_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_6_BAUD_RATE ST_STM32_USART_40011400_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_6_IRQ_PRI ST_STM32_USART_40011400_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_6_NAME ST_STM32_USART_40011400_LABEL | ||
#define USART_6_IRQ ST_STM32_USART_40011400_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_7_BASE_ADDRESS ST_STM32_USART_40007800_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_7_BAUD_RATE ST_STM32_USART_40007800_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_7_IRQ_PRI ST_STM32_USART_40007800_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_7_NAME ST_STM32_USART_40007800_LABEL | ||
#define USART_7_IRQ ST_STM32_USART_40007800_IRQ_0 | ||
|
||
#define CONFIG_UART_STM32_USART_8_BASE_ADDRESS ST_STM32_USART_40007C00_BASE_ADDRESS | ||
#define CONFIG_UART_STM32_USART_8_BAUD_RATE ST_STM32_USART_40007C00_CURRENT_SPEED | ||
#define CONFIG_UART_STM32_USART_8_IRQ_PRI ST_STM32_USART_40007C00_IRQ_0_PRIORITY | ||
#define CONFIG_UART_STM32_USART_8_NAME ST_STM32_USART_40007800_LABEL | ||
#define USART_8_IRQ ST_STM32_USART_40007C00_IRQ_0 | ||
|
||
/* End of SoC Level DTS fixup file */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2018 Yurii Hamann | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef _STM32F7X_FLASH_REGISTERS_H_ | ||
#define _STM32F7X_FLASH_REGISTERS_H_ | ||
|
||
/** | ||
* @brief | ||
* | ||
* Based on reference manual: | ||
* RM0385 Reference manual STM32F75xxx and STM32F74xxx | ||
* advanced ARM(r)-based 32-bit MCUs | ||
* | ||
* Chapter 3: Embedded Flash Memory | ||
*/ | ||
|
||
union __flash_acr { | ||
u32_t val; | ||
struct { | ||
u32_t latency :4 __packed; | ||
u32_t rsvd__4_7 :4 __packed; | ||
u32_t prften :1 __packed; | ||
u32_t arten :1 __packed; | ||
u32_t rsvd__10 :1 __packed; | ||
u32_t artrst :1 __packed; | ||
u32_t rsvd__12_31 :20 __packed; | ||
} bit; | ||
}; | ||
|
||
/* 3.7 FLASH registers */ | ||
struct stm32f7x_flash { | ||
volatile union __flash_acr acr; | ||
volatile u32_t keyr; | ||
volatile u32_t optkeyr; | ||
volatile u32_t sr; | ||
volatile u32_t cr; | ||
volatile u32_t optcr; | ||
volatile u32_t optcr1; | ||
}; | ||
|
||
#endif /* _STM32F7X_FLASHREGISTERS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2018 Yurii Hamann | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef _STM32F7X_GPIO_REGISTERS_H_ | ||
#define _STM32F7X_GPIO_REGISTERS_H_ | ||
|
||
/** | ||
* @brief Driver for GPIO of STM32F7X family processor. | ||
* | ||
* Based on reference manual: | ||
* RM0385 Reference manual STM32F75xxx and STM32F74xxx | ||
* advanced ARM(r)-based 32-bit MCUs | ||
* | ||
* Chapter 6: General-purpose I/Os (GPIOs) | ||
*/ | ||
|
||
/* 6.4 GPIO registers - each GPIO port controls 16 pins */ | ||
struct stm32f7x_gpio { | ||
u32_t moder; | ||
u32_t otyper; | ||
u32_t ospeedr; | ||
u32_t pupdr; | ||
u32_t idr; | ||
u32_t odr; | ||
u32_t bsrr; | ||
u32_t lckr; | ||
u32_t afr[2]; | ||
u32_t brr; | ||
}; | ||
|
||
union syscfg_exticr { | ||
u32_t val; | ||
struct { | ||
u16_t rsvd__16_31; | ||
u16_t exti; | ||
} bit; | ||
}; | ||
|
||
/* 7.2 SYSCFG registers */ | ||
struct stm32f7x_syscfg { | ||
u32_t memrmp; | ||
u32_t pmc; | ||
union syscfg_exticr exticr1; | ||
union syscfg_exticr exticr2; | ||
union syscfg_exticr exticr3; | ||
union syscfg_exticr exticr4; | ||
u32_t cmpcr; | ||
}; | ||
|
||
#endif /* _STM32F7X_GPIO_REGISTERS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* linker.ld - Linker command/script file */ | ||
|
||
/* | ||
* Copyright (c) 2018 Yurii Hamann | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <arch/arm/cortex_m/scripts/linker.ld> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2018 Yurii Hamann | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief System/hardware module for STM32F7 processor | ||
*/ | ||
|
||
#include <kernel.h> | ||
#include <device.h> | ||
#include <init.h> | ||
#include <soc.h> | ||
#include <arch/cpu.h> | ||
#include <cortex_m/exc.h> | ||
|
||
/** | ||
* @brief Perform basic hardware initialization at boot. | ||
* | ||
* This needs to be run from the very beginning. | ||
* So the init priority has to be 0 (zero). | ||
* | ||
* @return 0 | ||
*/ | ||
static int st_stm32f7_init(struct device *arg) | ||
{ | ||
u32_t key; | ||
|
||
ARG_UNUSED(arg); | ||
|
||
key = irq_lock(); | ||
|
||
_ClearFaults(); | ||
|
||
/* Install default handler that simply resets the CPU | ||
* if configured in the kernel, NOP otherwise | ||
*/ | ||
NMI_INIT(); | ||
|
||
irq_unlock(key); | ||
|
||
/* Update CMSIS SystemCoreClock variable (HCLK) */ | ||
/* At reset, system core clock is set to 16 MHz from HSI */ | ||
SystemCoreClock = 16000000; | ||
|
||
return 0; | ||
} | ||
|
||
SYS_INIT(st_stm32f7_init, PRE_KERNEL_1, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2018 Yurii Hamann | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file SoC configuration macros for the ST STM32F7 family processors. | ||
* | ||
* Based on reference manual: | ||
* RM0385 Reference manual STM32F75xxx and STM32F74xxx | ||
* advanced ARM(r)-based 32-bit MCUs | ||
* | ||
* Chapter 2.2.2: Memory map and register boundary addresses | ||
*/ | ||
|
||
#ifndef _STM32F7_SOC_H_ | ||
#define _STM32F7_SOC_H_ | ||
|
||
#define GPIO_REG_SIZE 0x400 | ||
/* base address for where GPIO registers start */ | ||
#define GPIO_PORTS_BASE (GPIOA_BASE) | ||
|
||
#ifndef _ASMLANGUAGE | ||
|
||
#include <device.h> | ||
#include <misc/util.h> | ||
#include <stm32f7xx.h> | ||
|
||
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE | ||
#include <stm32f7xx_ll_utils.h> | ||
#include <stm32f7xx_ll_bus.h> | ||
#include <stm32f7xx_ll_rcc.h> | ||
#include <stm32f7xx_ll_system.h> | ||
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */ | ||
|
||
#ifdef CONFIG_SERIAL_HAS_DRIVER | ||
#include <stm32f7xx_ll_usart.h> | ||
#endif | ||
|
||
#endif /* !_ASMLANGUAGE */ | ||
|
||
#endif /* _STM32F7_SOC_H_ */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use exact names as mentioned in Reference manual:
moder, otyper, ospeedr, ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion names like moder aren't human readable. I think it would better to left it like for STMF4 series or add ending reg, for example mode_reg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should use naming rules that are not subjective, and then will not vary depending on the developer.
Hence, when possible, aligning on ref manual is the better option to me.