arch/arm/src/stm32l4: Avoid using redundant CONFIG_STM32L4_STM32L4X2. This is almost always same as CONFIG_STM32L4_STM32L4X3. Avoid duplication to reduce macro clutter. This patch limits CONFIG_STM32L4_STM32L4X2 usage to dependency tracking and pinmap. Also enable ADC for CONFIG_STM32L4_STM32L4X5 (untested, but same RM).

This commit is contained in:
Juha Niskanen 2018-08-09 06:33:39 -06:00 committed by Gregory Nutt
parent e88093ff37
commit e402dadf5d
21 changed files with 85 additions and 43 deletions

View File

@ -76,7 +76,7 @@
#define STM32L4_IRQ_FIRST (16) /* Vector number of the first external interrupt */
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include <arch/stm32l4/stm32l4x3xx_irq.h>
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include <arch/stm32l4/stm32l4x5xx_irq.h>

View File

@ -147,7 +147,7 @@
#define STM32L4_IRQ_I2C4EV (STM32L4_IRQ_FIRST + 83) /* 83: I2C4 event interrupt */
#define STM32L4_IRQ_I2C4ER (STM32L4_IRQ_FIRST + 84) /* 84: I2C4 error interrupt */
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# define STM32L4_IRQ_NEXTINTS 85
#else
# error "Unsupported STM32L4 chip"

View File

@ -380,10 +380,43 @@ config ARCH_CHIP_STM32L496AG
---help---
STM32 L4 Cortex M4, 1024Kb FLASH, 320 Kb SRAM
config ARCH_CHIP_STM32L4A6 # REVISIT: expand for each chip
bool "STM32L4A6xx"
config ARCH_CHIP_STM32L4A6RG
bool "STM32L4A6RG"
select STM32L4_STM32L4A6XX
select STM32L4_FLASH_CONFIG_G
select STM32L4_IO_CONFIG_R
---help---
STM32 L4 Cortex M4, AES, HASH, 1024Kb FLASH, 320 Kb SRAM
config ARCH_CHIP_STM32L4A6VG
bool "STM32L4A6VG"
select STM32L4_STM32L4A6XX
select STM32L4_FLASH_CONFIG_G
select STM32L4_IO_CONFIG_V
---help---
STM32 L4 Cortex M4, AES, HASH, 1024Kb FLASH, 320 Kb SRAM
config ARCH_CHIP_STM32L4A6QG
bool "STM32L4A6QG"
select STM32L4_STM32L4A6XX
select STM32L4_FLASH_CONFIG_G
select STM32L4_IO_CONFIG_Q
---help---
STM32 L4 Cortex M4, AES, HASH, 1024Kb FLASH, 320 Kb SRAM
config ARCH_CHIP_STM32L4A6ZG
bool "STM32L4A6ZG"
select STM32L4_STM32L4A6XX
select STM32L4_FLASH_CONFIG_G
select STM32L4_IO_CONFIG_Z
---help---
STM32 L4 Cortex M4, AES, HASH, 1024Kb FLASH, 320 Kb SRAM
config ARCH_CHIP_STM32L4A6AG
bool "STM32L4A6AG"
select STM32L4_STM32L4A6XX
select STM32L4_FLASH_CONFIG_G
select STM32L4_IO_CONFIG_A
---help---
STM32 L4 Cortex M4, AES, HASH, 1024Kb FLASH, 320 Kb SRAM
@ -392,12 +425,28 @@ endchoice # STM32 L4 Chip Selection
# Chip product lines
config STM32L4_STM32L4X1
# Note: This is _not_ for L471xx as in RM0392
# STM32L4x1 Access Lines
#
# Avoid using this config as it is basically same subfamily
# as STM32L4_STM32L4X3 (documented in RM0394).
#
# Note: This is _not_ for STM32L471xx (documented in RM0392).
bool
default n
select STM32L4_STM32L4X3
config STM32L4_STM32L4X2
# STM32L4x2 USB Device Lines
#
# Avoid using this config as it is basically same subfamily
# as STM32L4_STM32L4X3 (documented in RM0394).
bool
default n
select STM32L4_STM32L4X3
config STM32L4_STM32L4X3
# STM32L4 devices documented in RM0394, regardless of what ST's
# marketing calls them.
bool
default n
select ARCH_HAVE_FPU
@ -408,21 +457,10 @@ config STM32L4_STM32L4X2
select STM32L4_HAVE_LPTIM2
select STM32L4_HAVE_COMP
select STM32L4_HAVE_SAI1
config STM32L4_STM32L4X3
bool
default n
select ARCH_HAVE_FPU
select STM32L4_HAVE_USART1
select STM32L4_HAVE_USART2
select STM32L4_HAVE_USART3
select STM32L4_HAVE_LPTIM1
select STM32L4_HAVE_LPTIM2
select STM32L4_HAVE_COMP
select STM32L4_HAVE_SAI1
select STM32L4_HAVE_LCD if !STM32L4_STM32L4X1
select STM32L4_HAVE_LCD if !(STM32L4_STM32L4X1 || STM32L4_STM32L4X2)
config STM32L4_STM32L4X5
# STM32L4 USB OTG Lines (documented in RM0351)
bool
default n
select ARCH_HAVE_FPU
@ -451,6 +489,7 @@ config STM32L4_STM32L4X5
select STM32L4_HAVE_DFSDM1
config STM32L4_STM32L4X6
# STM32L4x6 (documented in RM0351)
bool
default n
select ARCH_HAVE_FPU

View File

@ -13,9 +13,9 @@ The various supported STM32L4 families are:
|
| Not supported | RM0392 | STM32L471xx
|
| STM32L4_STM32L4X1 | RM0394 | Subset of STM32L4_STM32L4X3
| STM32L4_STM32L4X1 | RM0394 | Subset of STM32L4_STM32L4X3 [*]
|
| STM32L4_STM32L4X2 | RM0394 | Subset of STM32L4_STM32L4X3
| STM32L4_STM32L4X2 | RM0394 | Subset of STM32L4_STM32L4X3 [*]
|
| STM32L4_STM32L4X3 | RM0394 | STM32L43xxx/44xxx/45xxx/46xxx
|
@ -27,6 +27,9 @@ The various supported STM32L4 families are:
| Not supported | RM0432 | STM32L4Rxxx, STM32L4Sxxx
-------------------------------------------------------------
[*]: Please avoid depending on CONFIG_STM32L4_STM32L4X1 and
CONFIG_STM32L4_STM32L4X2 as the MCUs are of the same subfamily
as CONFIG_STM32L4_STM32L4X3.
TODO list
---------

View File

@ -131,7 +131,7 @@
#define STM32L4_OPAMP_BASE 0x40007800
#define STM32L4_DAC_BASE 0x40007400
#define STM32L4_PWR_BASE 0x40007000
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# define STM32L4_USB_SRAM_BASE 0x40006c00
# define STM32L4_USB_FS_BASE 0x40006800
#else

View File

@ -43,7 +43,7 @@
#include <nuttx/config.h>
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "chip/stm32l4x3xx_syscfg.h"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "chip/stm32l4x5xx_syscfg.h"

View File

@ -45,7 +45,7 @@
#include <nuttx/config.h>
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
/****************************************************************************************************
* Pre-processor Definitions

View File

@ -43,7 +43,7 @@
#include <nuttx/config.h>
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
/****************************************************************************************************
* Pre-processor Definitions

View File

@ -76,12 +76,12 @@
#if defined(CONFIG_STM32L4_ADC1) || defined(CONFIG_STM32L4_ADC2) || \
defined(CONFIG_STM32L4_ADC3)
#if !(defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X6))
#if !(defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6))
# error "Unrecognized STM32 chip"
#endif
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# if defined(CONFIG_STM32L4_ADC2) || defined(CONFIG_STM32L4_ADC3)
# error "Using non-existent ADC"
# endif
@ -105,7 +105,7 @@
/* ADC interrupts ***********************************************************/
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# define STM32L4_IRQ_ADC12 STM32L4_IRQ_ADC1
#endif

View File

@ -54,7 +54,7 @@
#include <errno.h>
#if !(defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
#if !(defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6))
# error "Unrecognized STM32 chip"
#endif
@ -373,7 +373,7 @@ static int stm32l4_compconfig(FAR const struct comp_dev_s *dev)
regval |= COMP_CSR_INPSEL_PIN2;
break;
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
case STM32L4_COMP_INP_PIN_3:
stm32l4_configgpio(cmp == STM32L4_COMP1 ? GPIO_COMP1_INP_3 : GPIO_COMP2_INP_3);
regval |= COMP_CSR_INPSEL_PIN3;
@ -437,7 +437,7 @@ static int stm32l4_compconfig(FAR const struct comp_dev_s *dev)
#endif
break;
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
case STM32L4_COMP_INM_PIN_3:
stm32l4_configgpio(cmp == STM32L4_COMP1 ? GPIO_COMP1_INM_3 : GPIO_COMP2_INM_3);
regval |= COMP_CSR_INMSEL_INMESEL;

View File

@ -50,7 +50,7 @@
* Public Types
************************************************************************************/
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
/* Comparators */

View File

@ -45,7 +45,7 @@
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "chip/stm32l4x3xx_dbgmcu.h"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "chip/stm32l4x5xx_dbgmcu.h"

View File

@ -49,7 +49,7 @@
* TODO: do we need separate implementation for STM32L4X3?
*/
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
#if defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6)
#include "stm32l4x6xx_dma.c"
#else

View File

@ -49,7 +49,7 @@
/* Include the correct DMA register definitions for this STM32 family */
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "chip/stm32l4x3xx_dma.h"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "chip/stm32l4x5xx_dma.h"

View File

@ -69,7 +69,7 @@ static struct comp_callback_s g_comp_handlers[STM32L4_COMP_NUM];
static const uint32_t g_comp_lines[STM32L4_COMP_NUM] =
{
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
#if defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6)
EXTI1_COMP1,
EXTI1_COMP2

View File

@ -47,7 +47,7 @@
/* Include the correct firewall register definitions for this STM32L4 family */
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "chip/stm32l4x3xx_firewall.h"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "chip/stm32l4x5xx_firewall.h"

View File

@ -63,7 +63,7 @@
#include "up_arch.h"
#if !(defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
#if !(defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6))
# error "Unrecognized STM32 chip"
#endif

View File

@ -54,7 +54,7 @@
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
#if defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6)
# include "chip/stm32l4_gpio.h"
#else

View File

@ -79,7 +79,7 @@
/* Include chip-specific clocking initialization logic */
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "stm32l4x3xx_rcc.c"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "stm32l4x5xx_rcc.c"

View File

@ -45,7 +45,7 @@
#include "up_arch.h"
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X3)
# include "chip/stm32l4x3xx_rcc.h"
#elif defined(CONFIG_STM32L4_STM32L4X5)
# include "chip/stm32l4x5xx_rcc.h"

View File

@ -45,8 +45,8 @@
#include "chip.h"
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6)
#if defined(CONFIG_STM32L4_STM32L4X3) || defined(CONFIG_STM32L4_STM32L4X5) || \
defined(CONFIG_STM32L4_STM32L4X6)
# include "chip/stm32l4_uart.h"
#else
# error "Unsupported STM32L4 chip"